@echo off

rem Compile MyClass.java with sp.jar in the classpath
javac -cp sp.jar MyClass.java

if errorlevel 1 (
  echo Compilation failed! Check for errors in MyClass.java.
  exit /b 1
)

rem Run MyClass, including both the current directory (".") and sp.jar in the classpath
java -cp sp.jar;. MyClass

if errorlevel 1 (
  echo Execution failed! Check for errors or classpath issues.
  exit /b 1
)

echo Program execution successful!