9

I would like to see the command that Eclipse is running when I hit run for a Java program. I've looked around the Eclipse preferences for Run/Debug (and console) and the Run Configurations, but to no avail. How can I see the line that Eclipse is using to launch?

In JBuilder, it was the first line in the output.

Edit: I'm not asking whether it uses javac to compile and then java to run. I want to see the line that starts with java and has all the flags, etc. I'm not asking "what does Eclipse run?" since I already know that. I want to see it in a specific case in a specific project.

3 Answers 3

10

Set up a launch configuration, then run or debug it.

Go to the "Debug" window of the Debug perspective, the one that shows all the processes and threads.

Right click on the java.exe or javaw.exe item in the tree (its at the bottom under all of the threadgroups and threads), and choose "Properties" on that guy.

You should get a window that contains 2 sections, the left being a list of items, including "process information" and "vm capabilities"

The process information section has 3 sections, showing the time it launched the session, the path to the exe, and the full command line that eclipse used to start the VM. The command line will include everything, including library paths, classpaths, the debug info it passes to the VM, any custom args you pass, etc.

I think that's what you're looking for.

Sign up to request clarification or add additional context in comments.

3 Comments

Excellent. I was just trying to find this -Djava.library.path= which I did. Now I know what I'm looking for.
hopefully you're mot messing with the library path manually. eclipse has a way of setting that up too! :)
no, Eclipse is doing it fine, I wanted to find out how it's doing it (so I can do it without Eclipse). Thanks and good luck here on SO.
6

On Unix systems you can see the command line with

ps -e x | grep java

For example (line wrapped for readability):

24925 pts/6    Sl     0:16 
/usr/lib/jvm/java-6-openjdk/bin/java 
-agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:53880 
-Dfile.encoding=UTF-8 
-Xbootclasspath:/usr/lib/jvm/java-6-openjdk/jre/lib/resources.jar
  :/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar
  :/usr/lib/jvm/java-6-openjdk/jre/lib/jsse.jar
  :/usr/lib/jvm/java-6-openjdk/jre/lib/jce.jar
  :/usr/lib/jvm/java-6-openjdk/jre/lib/charsets.jar
  :/usr/lib/jvm/java-6-openjdk/jre/lib/rhino.jar
  :/usr/share/java/gnome-java-bridge.jar 
-classpath /home/hendrik/workspace/webflag/WEB-INF/classes
  :/home/hendrik/workspace/webflag/WEB-INF/lib/log4j.jar
  :/home/hendrik/workspace/webflag/WEB-INF/lib/junit.jar
nhb.webflag.importtools.tools.ImportArmoryCharacter 

-agentlib specifies the debugging connection, -Xbootclasspath is based on the JDK configuration, -classpath based on the build path settings of the project

1 Comment

+1 for this convoluted way to go, since it will work on the OSX system I'm on. Plus it's a pretty cool answer which sidesteps the problem of not knowing Eclipse too well.
0

If it can find any class with the main method, it runs that using "java com.example.Main" where Main is the class with main method.

If you have many classes with main method, then eclipse gives you an option to choose one.

1 Comment

This doesn't address the question asked -- how to log the command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.