This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Command line argument question.

 
Roger Fed
Ranch Hand
Posts: 82
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
I have developed a class using NetBeans and i want to run it using command line , I've configured command line and it work correctly but my question is:
where this class should be stored to run it using command line arguments?
thanks........
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anywhere you like. A class doesn't have to be stored in a special place or special way to be able to run it using command line arguments.

You can run it from a Windows command prompt with the java command, something like this:

C:\Project> java -classpath classes org.mypackage.MyProgram arg0 arg1 arg2 ...

where classes is the directory that contains the class files and org.mypackage.MyProgram is the fully-qualified name of the class that contains the main method, and arg0, arg1 etc. are the command line arguments.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic