views:

943

answers:

2

Hi,

I am currently porting my development environment from Windows to Linux.

Under Linux, I noticed a "No class found" compilation error related to my classes in the directory <PROJECT_HOME>/src/groovy. Under windows, it works fine.

Is this "src/groovy" directory included in the CLASSPATH when running "grails run-app" ? Why does it behave differently under Windows and under Linux? (GRAILS_HOME and GROOVY_HOME are defined in both environments)

Is there a way to display the current CLASSPATH in the logs?

And most important, how do I solve my problem? (except by setting the global CLASSPATH=<PROJECT_HOME>/src/groovy)

Thank you for your help,

Regards,

Fabien.

A: 

Yes, src/groovy and src/java are automatically in the classpath when using the grails commands. I would recommend making sure your package statements are correct and that the error isn't referring to something your code is referencing.

John Wagenleitner
I will check again...but teh same code compiles fine under Windows.Also, do you know hos to display current CLASSPATH ?
fabien7474
When you do a run-app or test-app the groovy files are all compiled, so you can look in $HOME/.grails/<version>/projects/<project>/classes/ to see if you files from src/groovy are there (unless you specified grails.work.dir). You can try Thread.currentThread().getContextClassLoader().getURLs(), but this should just point to the classes directories.
John Wagenleitner
A: 

Does the code still work after you do a grails clean on Windows?

I wonder if you have refactored and have an old version still kicking around in your classes directory. Otherwise verify the case of the .class files with what you expect (as John W. suggested).

Keep in mind that Linux file systems are typically case-sensitive where Windows is not (by defauly anyway).

Could you post the exception that you are seeing?

Colin Harrington
Yes. It is working fine on Windows after a "grails clean". I will try to display the CLASSPATH dirs and to look at the classes direcvtory as well. If after investigation, I still do not find a fix, I'll post you the exception and source code. Thx for your help.
fabien7474