Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Comman line invocation of Java application
Comman line invocation of Java application [message #226642] Mon, 27 March 2006 21:44 Go to next message
Eclipse UserFriend
Originally posted by: chandrac.kestral.com.au

Folks,

Suppose I have developed within Eclipse a simple Java application with a
main method that requires input from standard input and that outputs to
standard output. It has been run successfully as a Java application
from within Eclipse.

Without copying individual files to some other directory, and keeping
intact the existing project directory structure in my workspace, I want
to run the application outside of Eclipse with a command line invocation
to java, passing the appropriate command line arguments.

Is there any way I can extract this invocation from within Eclipse, to
use on a command line window like a bash shell in Linux or a DOS window
in Windows?

If I cannot extract the invocation from within Eclipse, how may I
assemble it otherwise?

Thanks.

Chandra
Re: Comman line invocation of Java application [message #226648 is a reply to message #226642] Mon, 27 March 2006 23:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: newsgroups.pellaton.li

Hello,

The only place I know where the complete command line of the invocation
is shown is in the debugger.

- set some breakpoint in your app
- run it using the debugger
- in the 'Debug' view, right click on the thread
- select 'Properties'
- this should give you the command that was used to invoke the app

HTH,

Michael Pellaton
Re: Comman line invocation of Java application [message #226652 is a reply to message #226648] Tue, 28 March 2006 00:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chandrac.kestral.com.au

Thank you. That worked.

I needed to modify the extracted command line as follows:

1. Change the executable from javaw to java for Windows;
2. Remove the following options from the command line:

-Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,suspend=y,address=localhost:16 80

The resulting command then ran just like any Java application invoked
from the command line.

Chandra

Michael Pellaton wrote:
> Hello,
>
> The only place I know where the complete command line of the invocation
> is shown is in the debugger.
>
> - set some breakpoint in your app
> - run it using the debugger
> - in the 'Debug' view, right click on the thread
> - select 'Properties'
> - this should give you the command that was used to invoke the app
>
> HTH,
>
> Michael Pellaton
Re: Comman line invocation of Java application [message #226662 is a reply to message #226652] Tue, 28 March 2006 03:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.news.gmx.net

R (Chandra) Chandrasekhar wrote:
> Thank you. That worked.
>
> I needed to modify the extracted command line as follows:
>
> 1. Change the executable from javaw to java for Windows;
> 2. Remove the following options from the command line:
>
> -Xdebug -Xnoagent
> -Xrunjdwp:transport=dt_socket,suspend=y,address=localhost:16 80
>
> The resulting command then ran just like any Java application invoked
> from the command line.

There's something else you can do: create a Jar with all the classes in
them and a manifest that contains a proper Class-Path and Main-Class.
You then still have to provide JVM and other command line arguments but
you can invoke it with

java -jar -X... your.jar arg1 arg2

Kind regards

robert
Re: Comman line invocation of Java application [message #226755 is a reply to message #226662] Tue, 28 March 2006 22:24 Go to previous message
Eclipse UserFriend
Originally posted by: chandrac.kestral.com.au

Robert,

I exported the project as a JAR (ensuring that the package and relevant
class were recognized) and invoked the program with

java -jar <full_path_to_.jar_file>

and it worked perfectly.

Thank you.

Chandra
29 Mar 06

Robert Klemme wrote:
>
> There's something else you can do: create a Jar with all the classes in
> them and a manifest that contains a proper Class-Path and Main-Class.
> You then still have to provide JVM and other command line arguments but
> you can invoke it with
>
> java -jar -X... your.jar arg1 arg2
>
> Kind regards
>
> robert
Previous Topic:How can I turn off the source lookup in the debug framework
Next Topic:Putting jars from jared plugins on classpath
Goto Forum:
  


Current Time: Fri Nov 07 05:23:32 EST 2025

Powered by FUDForum. Page generated in 0.03311 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top