I am trying to make a batch file to automate the compiling and execution of java programs. Here is my batch script:
@echo off
cd X:\
echo Compile/Execute Java
echo Author: Phil Eaton
echo Created: 09-28-2012
set /P file=File name: %=%
set java = %file%.java
javac %java%
java %file%
set /P quit=
However it is returning “Exception in thread “main” java.lang.NoClassDefFoundError: HelloWorld” where HelloWorld is the user input. However when I run javac HelloWorld.java in the command prompt, it compiles fine, and when I run java HelloWorld it also runs fine. Any suggestions? Thanks!
setdoesn’t allow spaces around=: