October 19, 2004 11:13 PM
For the last Java lab session, I was stuck on a machine with no Linux
or Cygwin. It was running MS Win 2000 and had no IDE for Java. I found
the quickest way to edit and run simple java programs was to use the
built-in edit.com
and a batch file which contains the following
commands provided the bin directory containing the java
executable is
in your PATH
environment variable.
javac %1.java java -cp . %1
If the following lines were saved into j.bat
, recompiling
and running the java source file hello.java is as simple as executing:
j hello
Note: The DOS shell can take up to 9 arguments from %1 to %9.