Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Command Line Java

Tags:

java

eclipse

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.

like image 708
Dan Rosenstark Avatar asked Sep 22 '10 20:09

Dan Rosenstark


2 Answers

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.

like image 179
John Gardner Avatar answered Sep 19 '22 15:09

John Gardner


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

like image 29
Hendrik Brummermann Avatar answered Sep 18 '22 15:09

Hendrik Brummermann