I have a Java Google App Engine project which references a class in another project and at runtime, I’m getting NoClassDefFoundError.
I’ll call my Google App Engine project ‘Main‘ and the project it depends on ‘Sub‘
It looks like the reason for the runtime error is that a jar for Sub cannot be found in WEB-INF/lib. In eclipse, when I export Sub as a jar, and copy it into the WEB-INF/lib folder, everything works fine. Do I need to do this every time I change a file in Sub now?
Coming from a Visual Studio world, I’m used to projects being build into dlls, and those being copied into the ‘bin’ folders that depend on them. I thought eclipse would support something similar, but I’m not seeing it. What’s the correct way of fixing this? Ant script?
Yes – when you see .dll in .NET, think JAR in Java EE.
If a dependent JAR changes, you have to update the contents of WEB-INF/lib of your web app.
I’m not sure how Eclipse handles dependencies. In IntelliJ, I could create a dependency between two separate modules if I wished or treat the dependent JAR in exactly the way I described above.
I think the best thing to do is to use an Ant script, especially if you’ve already got one to create your WAR file.