Computer Hope
Microsoft => Microsoft DOS => Topic started by: san_crazy on September 27, 2008, 12:38:37 AM
-
hi friends,
I made a batch file to compile java programs using javac
here it is
@ echo off
cd C:\Program Files\Java\jdk1.6.0_02\bin
javac %1
at commond line i type jrun javafile.java
then the target file get compiled successfully.
now what code snippet should I add to run the class file also using java class loader tool, that has been come from compilation?
-
This should help you with the mechanics, you may have to provide the details:
@echo off
javac %1.java
if not errorlevel 1 java %1.class
at commond line i type jrun javafile.java
Change that to jrun javafile and let the batch file determine the file extensions.
Check your path, if the java install did not add itself to your path, then a suggestion would be to login to the directory where your source code resides and use a path pointer to java directories. This will keep your source libraries and the java libraries separate.
@echo off
cd C:\YourSourceDirectory
C:\Program Files\Java\jdk1.6.0_02\bin\javac %1.java
if not errorlevel 1 C:\Program Files\Java\jdk1.6.0_02\bin\java %1.class
You will have to test this to make sure java can find all it's components.
8)