Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Simple CMD Problem... Please help!

846531Mar 10 2011 — edited Mar 11 2011
All I want to do is have my GUI .java program compile compile .java code to .class code from a UI form the fill out.

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?

Thanks!

PS all variables are defined correctly: My code looks like this:

Process p = Runtime.getRuntime().exec("javac -classpath \"" + fileSource + "\" \"" + file.getAbsolutePath() +"\"");

ToXSiK
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 8 2011
Added on Mar 10 2011
12 comments
342 views