Reputation: 6259
I want to code a script to compile and run a java file in the Windows env, but failed. It is failed in the java classpath.
This Test.java is not inside any package.
Please help. Thanks.
set SOURCE=C:\Documents and Settings\xxx\Desktop
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_25\bin
"%JAVA_HOME%\javac" "%SOURCE%\Test.java"
pause
"%JAVA_HOME%\java" -cp "%SOURCE%" Test.class
pause
Upvotes: 0
Views: 410
Reputation: 274838
Try removing the .class
extension from the name of the class you pass to the java
command:
"%JAVA_HOME%\java" -cp "%SOURCE%" Test
Upvotes: 2