We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Calling ProcessBuilder on Mac generates error
Page Index Toggle Pages: 1
Calling ProcessBuilder on Mac generates error (Read 810 times)
Calling ProcessBuilder on Mac generates error
Sep 15th, 2007, 4:32pm
 
I have a few lines of code to call an external application:

     ProcessBuilder processBuilder = new ProcessBuilder(cmd);
     File file = new File(mApplet.sketchPath(""));
     processBuilder.directory(file);              
     process = processBuilder.start();

On Windows this works as expected, but on Mac the same file won't compile and gives the error:
Semantic Error: Type "ProcessBuilder" was not found.

ProcessBuilder is available since Java 1.5, and "java -version" returns "1.5.0_07", so that should be ok.
Re: Calling ProcessBuilder on Mac generates error
Reply #1 - Sep 15th, 2007, 6:46pm
 
Not a solution but a different way to get the same results:

     File dir = new File(mApplet.dataPath(""));
     Runtime rt = Runtime.getRuntime();
     process = rt.exec(cmd, null, dir);
Re: Calling ProcessBuilder on Mac generates error
Reply #2 - Sep 15th, 2007, 7:07pm
 
hmm ... you can verify that processing / your sketch uses 1.5 with:
Code:

println( System.getProperty("java.version") );


have you tried with standard java? make a simple class with your processbuilder thing in it and try to compile that outside of processing ..

Code:

public class MyTest {
ProcessBuilder pb;
}


put in "MyTest.java" and run
javac MyTest.java
in the files directory with terminal

if that gives any errors it should not be a processing problem.

F
Re: Calling ProcessBuilder on Mac generates error
Reply #3 - Sep 15th, 2007, 8:43pm
 
Processing returns as version: 1.5.0_07.

The test class compiles without any errors. This points to a bug in Processing.
Re: Calling ProcessBuilder on Mac generates error
Reply #4 - Sep 15th, 2007, 10:38pm
 
no clue whats wrong, testing against jikes gives no error too:

Code:

cd /Applications/Processing\ 0125/
./jikes -classpath /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar ~/Desktop/MyTest.java


maybe ben has an idea ..

F
Page Index Toggle Pages: 1