Hi,

I have been developing a Java program and some functionality of the
program is to run tinyos specific commands from within the program.
Since, we have few lines of codes, I am using shell script and running
the script from my java program. I am having some problems in
executing the command 'java Oscilloscope' from my program.

The java code to execute shell script is:

# Java code
                        File file = new
File("/opt/tinyos-2.x/apps/Oscilloscope/java");
                        String COMMAND= "./run";
                        ProcessBuilder p = new ProcessBuilder(COMMAND);
                        p.directory(file);
                        try {
                        Process startProcess= p.start();                        
        
                        } catch (IOException e) {
                        e.printStackTrace();
                        }
# End of java code.

The script has following commands:

# start of script
java net.tinyos.sf.SerialForwarder -comm serial@/dev/ttyUSB0:telosb &
sleep 4
if cygpath -w / >/dev/null 2>/dev/null; then
  CLASSPATH="oscilloscope.jar;$CLASSPATH"
else
  CLASSPATH="oscilloscope.jar:$CLASSPATH"
fi
java Oscilloscope
# end of script

I cannot see the Oscilloscope program running. The script works fine
when executed from the terminal but from my java program is only
executing the SerialForwarder.

Is it because of the classpath command in the script? I also tried to
execute the script by passing environment variable classpath (as in
the script), but that too didn't work. What can be the possible cause
and solution?

-- 
Regards,
Ashish.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to