Entry
Java: Stand alone: Run: How to possibly run a stand alone Java program?
May 26th, 2006 15:05
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 07 September 2003 - 04:07 am ------------------
Java: Stand alone: Run: How to possibly run a stand alone Java program?
===
Method: Run java.exe interpreter
Usually you run a stand alone by calling the program via the command:
java.exe <your program name>
e.g.
java.exe HelloWorld
===
Method: Run a batch file which runs java.exe interpreter
You can put this in a batch file, with the name of the file as a
command line parameter
e.g.
java.exe %1
---
e.g.
create a batch file j.bat, containing
java.exe %1
save it, call it with
j.bat HelloWorld
===
Method: Double click file filename in Microsoft Explorer
If you do not want to pass parameters, and run it by e.g. double
clicking on it in Microsoft Explorer, create a batch file containing
the name of your program.
This batch file (e.g. mybatchfile.bat) should contain the following
text:
java.exe <yourclassname>
---
PS be sure that java.exe is in your PATH or put e.g. java.exe in the
same directory as your class file and your batchfile.
===
Method: Create a shortcut
Another possibility is to create a shortcut.
e.g.
-right click on your Windows desktop
-select from list 'Shortcut'
-type for the location 'c:\myfilepath\java.exe yourclassname'
-give the shortcut a name
if you then double click on this shortcut, it will run java.exe, which
will run yourclassname.
===
Method: Use the 'Java Web Start' program
This is a universal solution from Sun to run your Java programs
===
Internet: see also:
---
----------------------------------------------------------------------