3

I'm trying to program a game using lwjgl library and I'm using vim as my editor. I would like to have syntax cheking so I use syntastic.

The javac checker page explains how to add the classpath to the javac checker using SyntasticJavacEditClasspath command.

My problem is that I put there the path to lwjgl.jar and lwjgl_utils.jar and it's still founding a lot of missing library errors.

I put this on the opened buffer:

/home/ionthas/development/java/Jump2Box/lib/jars/lwjgl.jar  

I think I'm inserting the classpath in the wrong way.

Here is one of the 17 errors that show up: (The code runs perfectly)

src/com/ionsoft/engine/Engine.java|1 col 17 error| 
package org.lwjgl does not exist import org.lwjgl.LWJGLException; 

Here it is my configuration in .vimrc

18 " Syntastic                    
19 highlight SyntasticErrorSign guifg=white guibg=red          
20 highlight SyntasticErrorLine guibg=red                              
21 let g:syntastic_check_on_open = 1                                    
22 let g:syntastic_enable_signs = 0                                
23 let g:syntastic_enable_ballons = 0                  
24 let g:syntastic_quiet_warnings = 1
25 let g:syntastic_auto_loc_list = 1
26 let g:syntastic_java_checkers = ['checkstyle', 'javac'] 
27 let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'                                     
28 let g:syntastic_mode_map = { 'mode': 'active',
29                         \ 'active_filetypes': ['ruby', 'java'],
30                         \ 'passive_filetypes': [''] }
31 let g:syntastic_java_javac_classpath = '~/home/ionthas/development/java/Jump2Box/lib/jars/lwjgl.jar'                                      

Anyone can help me?

Kara
  • 6,115
  • 16
  • 50
  • 57
Marc Sola
  • 434
  • 4
  • 15
  • I solved the problem using the relative path ./lib/jars/lwjgl.jar insted of the absolute path /home/ionthas/development/java/Jump2Box/lib/jars/lwjgl.jar – Marc Sola Nov 04 '13 at 22:16
  • Please add that as an answer (and accept it) to mark this question as solved. – Ingo Karkat Nov 05 '13 at 07:29

3 Answers3

3

If you use gradle to manage your project you can use the following plugin to automatically manage you classpath. Every time you add/update dependencies it will update a local class path file.

https://github.com/Scuilion/gradle-syntastic-plugin

KevinO
  • 970
  • 2
  • 13
  • 31
  • 1
    Very nice! This works. Great work! Took me a while to figure out that I had to run `gradle syntastic` to actually generate the file. The usage instructions could be a tiny bit clearer for Gradle newbies like me. – UTF_or_Death Mar 12 '16 at 16:02
  • 1
    @UTF_or_Death, it will also automatically build the syntastic file when you call `gradle build`. – KevinO Mar 12 '16 at 21:02
2

Tilde ~ is your home directory. In your case, probably /home/ionthas/.
So your classpath:

~/home/ionthas/development/java/Jump2Box/lib/jars/lwjgl.jar

Would actually expand to:

/home/ionthas/home/ionthas/development/java/Jump2Box/lib/jars/lwjgl.jar

An extra home directory, hence the error.
Taking out the tilde ~ would probably do the trick.

xpcoffee
  • 98
  • 1
  • 9
0

I solved the problem using the relative path

./lib/jars/lwjgl.jar

insted of the absolute path

/home/ionthas/development/java/Jump2Box/lib/jars/lwjgl.jar  
Marc Sola
  • 434
  • 4
  • 15