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.
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
.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".
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.
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.
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.
(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 changingjavaw.exe
tojava.exe
might be advisable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With