Reputation: 107
How can I run a class file using a java program with cmd commands?
Upvotes: 1
Views: 2844
Reputation: 17785
Your question is a little vague, are you asking how to run java classes within java? If so, take a look at the Runtime class.
Like so:
Runtime.getRuntime.exec( /*params here*/ );
I would suggest using this version (using a String array), as I've had the best outcomes with it.
Upvotes: 0
Reputation: 25139
From your command prompt, type
java classname
where classname is the name of your compiled class. Note that the class must contain a main
method.
Upvotes: 2