All I want to do is have my GUI .java program compile code that the user specifies.
Process p = Runtime.getRuntime().exec("javac theirJavaFileName.java");
Whenever I run this, I simply get:
java.io.IOException: Cannot run program "javac theirJavaFileName.java" CreateProcess error=2, The system cannot find the file specified
When I run my commands (which are a little more complex in my program), the code compiles fine through CMD. What could be the problem?
PS all variables are defined correctly: My code looks like this:
Process p = Runtime.getRuntime().exec("javac -classpath \"" + fileDestination + "\" \"" + file.getAbsolutePath() +"\"");