Run class file using cmd commands
How can I run a开发者_运维百科 class file using a java program with cmd commands?
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.
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.
精彩评论