How to run java .class file from a script providing some command line parameters? The script is built using autohotkey framework. Can we trigger the execution of .class files from a script? Please let me know if I am wrong.
Asked
Active
Viewed 1,347 times
3
-
1You cannot run a class file directly. You run the executable java or javaw, usually with a jar file as the argument. So if autohotkey can run an executable, it can run Java. – John Watts Jun 13 '12 at 12:11
-
[Crossposting](http://stackoverflow.com/questions/11011527/autohotkey-script-running-program-with-command-line-arguments) – user unknown Jun 14 '12 at 00:08
1 Answers
3
I am not familiar with autohotkey, but if your command line is something like
java -cp <yourclasspath> <yourclassname> <yourarguments>
you are good to go, I guess.
ADDITION:
It seems to me that the Run directive allows you to do that. Assuming to have your MyClass.class
file (with MyClass in the default package) in C:\mypath
, I expect you have to issue something like
Run,java -cp . MyClass,C:\mypath
I am not able to verify the above line, since I do not have a Windows installation at hand.

Luca Geretti
- 10,206
- 7
- 48
- 58