Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse - Showing how eclipse runs project with java.exe

When I run a Java project within the Eclipse IDE, I assume in the background it is simply calling java.exe or javaw.exe with certain parameters, such as the classpath it's using and the actual class it's running.

Is there a way I can make Eclipse show this invocation, with all it's parameters? Ideally I'd like to be able to copy&paste it into a command window to duplicate the running of the project outside of the Eclipse IDE.

like image 624
Luch Avatar asked Feb 01 '11 04:02

Luch


People also ask

How do I know if a program is running in Eclipse?

You can do that by opening the "Open Run Dialog" ("Run" menu), then select your type of application and add in the "Arguments" tab a -DrunInEclipse=true . In your Java code, you can check the value of the property: String inEclipseStr = System. getProperty("runInEclipse"); boolean inEclipse = "true".

Why run as is not showing in eclipse?

If your project folder is in another project, aka. belongs to a parent project, try: Right click the project which main class belongs too, and click "import as new project" or something like that, then there should be a new project in the project Explorer at the bottom of the list.

How do I view stack trace on Eclipse?

Go to the "expression" view and add expression e. printStackTrace() . The stack trace will be printed to your STDERR, i.e. to eclipse console if your application is running inside the Eclipse IDE.

How do I run a Java program in Eclipse?

Step 1: Open Eclipse and click File > New > Java Project. Step 2: Provide the Project Name and click on the Finish button. Step 3: In the Package Explorer (left-hand side of the window) select the project which you have created. Step 4: Right-click on the src folder, select New > Class from the submenu.


1 Answers

(Original Answer: February 2011)

Launch your program in debug mode in Eclipse.
You can then see the exact command in the properties of the Debug views (see this thread or this thread)

First run or debug one of the configurations.
In the Debug view in the Debug perspective, right-click the running process and select "Properties". The command line used to launch the configuration is displayed.

Bug 10820 was about "[java launching] Launch config: show cmd line before launch"... but it is closed as WONTFIX.


Update (March 2012)

bbuser reports in the comment having

had to remove -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:60019 from the command line shown in properties in the Debug view.
Otherwise I got connection errors.
Also changing javaw.exe to java.exe might be advisable

like image 152
VonC Avatar answered Sep 21 '22 13:09

VonC