简体   繁体   中英

Eclipse Command Line Java

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.

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM