tags:

views:

165

answers:

1

Okay i'm trying to make ChucK available in exported Processing sketches, i.e. if i export an app from Processing, the ChucK VM binary will be executed from inside the app. So as a user of said app you don't need to worry about ChucK being in your path at all.

Right now i'm generating and executing a bash script file, but this way i don't get any console output from ChucK back into Processing:

#!/bin/bash
cd "[to where the Chuck executable is located]"
./chuck --kill
killall chuck # just to make sure
./chuck chuckScript1.ck cuckScriptn.ck

then

Process p = Runtime.getRuntime().exec("chmod 777 "+scriptPath);
p = Runtime.getRuntime().exec(scriptPath);

This works but i want to run ChucK directly from Processing instead, but can't get it to execute:

String chuckPath = "[folder in which the chuck executable is located]"
ProcessBuilder builder = new ProcessBuilder
                              (chuckPath+"/chuck", "test.ck");

        final Process process = builder.start();
        InputStream is = process.getInputStream();
        InputStreamReader isr = new InputStreamReader(is);
        BufferedReader br = new BufferedReader(isr);
        String line;
        while((line = br.readLine()) != null) println(line);
        println("done chuckin'! exitValue: " + process.exitValue());

Sorry if this is newbie style :D

+1  A: 
ProcessBuilder builder = new ProcessBuilder
                              (chuckPath+"/chuck", chuckPath+"/test.ck");

the args all need an absolute path.

Jakob
Please edit your question and do NOT provide more infos in an answer.
ZeissS
i've put this in an answer because this works. Since the arg to chuck is a file itself, it needed the full path as well.
Jakob
well if it works, you should accept your own answer
seanizer
yeah thanks but i can't within the next 23 hours.
Jakob