Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I determine the command string eclipse uses to launch my java program?

I've got a simple java program, socket, AWT and jUnit dependencies.

I've built it in eclipse and when I run/debug it from eclipse it works.

When I launch it from the command line I get an error saying

Exception in thread "main" java.lang.NoClassDefFoundError

I'm guessing it's due to not finding one of the required dependencies in the classpath.

Given that launching from eclipse works, Is there a way of determining what command line eclipse uses to launch the same program?

like image 560
chollida Avatar asked Dec 01 '11 15:12

chollida


1 Answers

It looks like your classpath isn't set appropriately when you try to run via the command line. You can easily export the command Eclipse uses by doing this:

  1. Run your application and go to your Debug perspective
  2. In the process viewer, there should be an entry for the app you've just executed
  3. Right-click the row that mentions java.exe or javaw.exe
  4. Select Properties
  5. In the dialog that pops up you'll see the Command Line which includes all classpath entries and arguments
like image 61
Chris Avatar answered Oct 04 '22 03:10

Chris