File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes how to pass the arguments to the main class ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to pass the arguments to the main class ..." Watch "how to pass the arguments to the main class ..." New topic
Author

how to pass the arguments to the main class ...

srinivas daroori
Greenhorn

Joined: Feb 23, 2004
Posts: 18
I am running my application by making it as a jar
like : java -jar application.jar (where application.jar is the jar file which consists my application.)

Now the question is , the main class in my above application requires command line parameters. How can I pass that while I am running it as a jar.
(sth like if I run the application alone I would be running like
java MyApplication processJob

Thanks!
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Type java -? from the command line to get all the syntax options. Here's part of what mine said:

Does the 3rd line look like what you need?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
am running my application by making it as a jar
like : java -jar application.jar (where application.jar is the jar file which consists my application.)

Now the question is , the main class in my above application requires command line parameters. How can I pass that while I am running it as a jar.
(sth like if I run the application alone I would be running like
java MyApplication processJob


Same thing when you run it for a jar:

jajav -jar application.jar processJob
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Moving to Java in General (Beginner). Followups there, please.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to pass the arguments to the main class ...
 
Similar Threads
How to deploy and run a java executable with package?
read properties file from jar
JFrame & Jar Files
A question on setting CLASSPATH on linux
Package several jars lib in one single jar file