This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
srinivas daroori
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Java in General (Beginner). Followups there, please.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic