Where to put external archives to configure running in Eclipse?

Posted by Buggieboy on Stack Overflow See other posts from Stack Overflow or by Buggieboy
Published on 2010-04-16T20:39:21Z Indexed on 2010/04/16 20:43 UTC
Read the original article Hit count: 397

Filed under:
|
|
|

As a Java/Eclipse noob coming from a Visual Studio .NET background, I'm trying to understand how to set up my run/debug environment in the Eclipse IDE so I can start stepping through code.

I have built my application with separate src and bin hierarchies for each library project, and each project has its own jar. For example, in a Windows environment, I have something like:

c:\myapp\myapp_main\src\com\mycorp\myapp\main

...and a parallel "bin" tree like this:

c:\myapp\myapp_main\bin\com\mycorp\myapp\main

Other supporting projects are, similarly: **c:\myapp\myapp_util\src\com\mycorp\myapp\uti**l (and a parallel "bin" tree.) ... etc.

So, I end up with, e.g., myapp_util.jar in the ...\myapp_util\bin... path and then add that as an external archive to my myapp_main project.

I also use utilities like gluegen-rt.jar, which I add ad external dependencies to the projects requiring them.

I have been able to run outside of the Eclipse environment, by copying all my project jars, gluegen-rt DLL, etc., into a "lib" subfolder of some directory and executing something like:

java -Djava.library.path=lib -DfullScreen=false -cp lib/gluegen-rt.jar;lib/myapp_main.jar;lib/myapp_util.jar; com.mycorp.myapp.Main

When I first pressed F11 to debug, however, I got a message about something like /com/sun/../glugen... not being found by the class loader.

So, to debug, or even just run, in Ecplipse, I tried setting up my VM arguments in the Galileo Debug -> (Run/Debug) Configurations to be the command line above, beginning at "-Djava.libary.path...". I've put a lib subdirectory - just like the above with all jars and the native gluegen DLL - in various places, such as beneath the folder that my main jar is built in and as a subfolder of my Ecplipse starting workspace folder, but now Eclipse can't find the main class:

java.lang.NoClassDefFoundError: com.mycorp.myapp.Main

Although the Classpath says that it is using the "default classpath", whatever that is. Bottom line, how do I assemble the constituent files of a multi-project application so that I can run or debug in Ecplipse?

© Stack Overflow or respective owner

Related posts about java

Related posts about eclipse