Re: [Tinyos-help] question about dual platform java CLASSPATH
I think the problem is in your TOS* variables. I have them set like this: vincent:schip [207] echo $TOSDIR /opt/tinyos-1.1.7/tos vincent:schip [208] echo $TOSROOT C:/cygwin/opt/tinyos-1.1.7 Because the "/opt/..." syntax is only relevant to programs which use the cygwin dll. Java does not, so it is probably not able to follow your TOSDIR setting. MS Elong Jin wrote: > Hi all, (i'm sorry about the length of this email) I have been confused > by the setting of CLASSPATH for days. > > I have tos1 and tos2 > installed according to http://www.5secondfuse.com/tinyos/install.html > > Now i'm trying to use TOSBase to listen to the serial port, here's what > happened: > * > * > *1. when I in tos1. I 'cd' to $TOSROOT/tools/java, 'make' gives me all > sorts of error message. * > *2. the 'listen' feature is not working properly, it gives error message > like this: * > > Exception in thread "main" java.lang.NoClassDefFoundError: > net/tinyos/packet/BuildSource > at net.tinyos.tools.Listen.main(Listen.java:47) > Caused by: java.lang.ClassNotFoundException: net.tinyos.packet.BuildSource > at java.net.URLClassLoader$1.run(URLClassLoader.java:217) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:205) > at java.lang.ClassLoader.loadClass(ClassLoader.java:321) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) > at java.lang.ClassLoader.loadClass(ClassLoader.java:266) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334) > ... 1 more > > *3. when I hope to use 'listen' in tos2, it gives me the same error > message.* > > After doing a few research, I think maybe this is because of an error in > CLASSPATH setting. > > can any one please tell me how to make it right? > > i have tinyos.sh in $TOSROOT of tinyos2.x like this > == > #! /usr/bin/env bash > # Here we setup the environment > # variables needed by the tinyos > # make system > > echo "Setting up for TinyOS 2.1.0" > export TOSROOT= > export TOSDIR= > export MAKERULES= > > TOSROOT="/opt/tinyos-2.1.0" > TOSDIR="$TOSROOT/tos" > CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java > MAKERULES="$TOSROOT/support/make/Makerules" > > export TOSROOT > export TOSDIR > export CLASSPATH > export CLASSPATH="$CLASSPATH;." > export MAKERULES > echo $MAKERULES > > > > and .bash_tinyos in my home folder like this: > > > > # Java > export JDKROOT=/usr/lib/jvm/java-1.5.0-sun > export JAVAXROOT=$JDKROOT > > > if [ "$LD_LIBRARY_PATH" == "" ]; then > # So Java can find libtoscomm.so and libgetenv.so > export LD_LIBRARY_PATH=$JDKROOT/jre/lib/i386 > fi > > # Set your default version of TinyOS here. > if [ "$TINYOS_VER" == "" ]; then > export TINYOS_VER=2 > fi > > # Preserve any non Tinyos related class paths that have been set prior > # to this file being sourced. We check the for an empty OLD_CLASSPATH > # to ensure that OLD_CLASSPATH only gets set once. > if [ "$OLD_CLASSPATH" == "" ]; then > if [ "$CLASSPATH" == "" ]; then > export OLD_CLASSPATH="empty" > else > export OLD_CLASSPATH=$CLASSPATH > fi > fi > > # Conditional environmental setup for 3 versions of TinyOS > if [ "$TINYOS_VER" == "1" ]; then > > echo "Setting up for TinyOS 1.x" > > export TOSROOT=/opt/tinyos-1.x > export TOSDIR=$TOSROOT/tos > export MAKERULES=$TOSROOT/tools/make/Makerules > unset CLASSPATH > > # Restore the old non tinyos classpath if its not empty > if [ "$OLD_CLASSPATH" != "empty" ]; then > export CLASSPATH=$OLD_CLASSPATH > fi > > export CLASSPATH=$CLASSPATH\:`$TOSROOT/tools/java/javapath` > > > # These aliases only apply to a 1.x environment > > alias tinyviz="$TOSROOT/tools/java/net/tinyos/sim/tinyviz" > alias Deluge="java net.tinyos.tools.Deluge" > > else > > echo "Setting up for TinyOS 2.x" > export TOSROOT=/opt/tinyos-2.1.0 > export TOSDIR=$TOSROOT/tos > unset CLASSPATH > > # Restore the old non tinyos classpath if its not empty > if [ "$OLD_CLASSPATH" != "empty" ]; then > export CLASSPATH=$OLD_CLASSPATH > fi > > export > CLASSPATH=$CLASSPATH\:$TOSROOT/support/sdk/java/tinyos.jar\:$TOSROOT/support/sdk/java/ > > export PYTHONPATH=:$TOSROOT/support/sdk/python/ > export MAKERULES=$TOSROOT/support/make/Makerules > unset TOSMAKE_PATH > > fi > > # Finally set the path for the new MSPGCCROOT > export MSPGCCROOT=/opt/msp430 > export PATH="$MSPGCCROOT/bin:$PATH" > > # Helpful aliases > alias sf="java net.tinyos.sf.SerialForwarder" > alias listen="java net.tinyos.tools.Listen" > > alias apps="cd $TOSROOT/apps" > alias tos="cd $TOSROOT/tos" > > # Environment changing functions > > # Change this shell's environment to support Tinyos 2.x development > function tos2 () { > export TINYOS_VER=2 > . ~/.bash_tinyos > } > > # Change this shell's environment to support Tinyos 1.x development > function tos1 () { > exp
Re: [Tinyos-help] question about dual platform java CLASSPATH
Hi, I failed to understand everything you write but here is a way to set your CLASSPATH. Type the following command and hit enter CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java/tinyos.jar:. Now check its effect: echo $CLASSPATH It should print the above directories. As long as you have tinyos.jar in the corresponding directory, tinyos java programs should work. Good luck, Ali ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
[Tinyos-help] question about dual platform java CLASSPATH
Hi all, (i'm sorry about the length of this email) I have been confused by the setting of CLASSPATH for days. I have tos1 and tos2 installed according to http://www.5secondfuse.com/tinyos/install.html Now i'm trying to use TOSBase to listen to the serial port, here's what happened: * * *1. when I in tos1. I 'cd' to $TOSROOT/tools/java, 'make' gives me all sorts of error message. * *2. the 'listen' feature is not working properly, it gives error message like this: * Exception in thread "main" java.lang.NoClassDefFoundError: net/tinyos/packet/BuildSource at net.tinyos.tools.Listen.main(Listen.java:47) Caused by: java.lang.ClassNotFoundException: net.tinyos.packet.BuildSource at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334) ... 1 more *3. when I hope to use 'listen' in tos2, it gives me the same error message. * After doing a few research, I think maybe this is because of an error in CLASSPATH setting. can any one please tell me how to make it right? i have tinyos.sh in $TOSROOT of tinyos2.x like this == #! /usr/bin/env bash # Here we setup the environment # variables needed by the tinyos # make system echo "Setting up for TinyOS 2.1.0" export TOSROOT= export TOSDIR= export MAKERULES= TOSROOT="/opt/tinyos-2.1.0" TOSDIR="$TOSROOT/tos" CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java MAKERULES="$TOSROOT/support/make/Makerules" export TOSROOT export TOSDIR export CLASSPATH export CLASSPATH="$CLASSPATH;." export MAKERULES echo $MAKERULES and .bash_tinyos in my home folder like this: # Java export JDKROOT=/usr/lib/jvm/java-1.5.0-sun export JAVAXROOT=$JDKROOT if [ "$LD_LIBRARY_PATH" == "" ]; then # So Java can find libtoscomm.so and libgetenv.so export LD_LIBRARY_PATH=$JDKROOT/jre/lib/i386 fi # Set your default version of TinyOS here. if [ "$TINYOS_VER" == "" ]; then export TINYOS_VER=2 fi # Preserve any non Tinyos related class paths that have been set prior # to this file being sourced. We check the for an empty OLD_CLASSPATH # to ensure that OLD_CLASSPATH only gets set once. if [ "$OLD_CLASSPATH" == "" ]; then if [ "$CLASSPATH" == "" ]; then export OLD_CLASSPATH="empty" else export OLD_CLASSPATH=$CLASSPATH fi fi # Conditional environmental setup for 3 versions of TinyOS if [ "$TINYOS_VER" == "1" ]; then echo "Setting up for TinyOS 1.x" export TOSROOT=/opt/tinyos-1.x export TOSDIR=$TOSROOT/tos export MAKERULES=$TOSROOT/tools/make/Makerules unset CLASSPATH # Restore the old non tinyos classpath if its not empty if [ "$OLD_CLASSPATH" != "empty" ]; then export CLASSPATH=$OLD_CLASSPATH fi export CLASSPATH=$CLASSPATH\:`$TOSROOT/tools/java/javapath` # These aliases only apply to a 1.x environment alias tinyviz="$TOSROOT/tools/java/net/tinyos/sim/tinyviz" alias Deluge="java net.tinyos.tools.Deluge" else echo "Setting up for TinyOS 2.x" export TOSROOT=/opt/tinyos-2.1.0 export TOSDIR=$TOSROOT/tos unset CLASSPATH # Restore the old non tinyos classpath if its not empty if [ "$OLD_CLASSPATH" != "empty" ]; then export CLASSPATH=$OLD_CLASSPATH fi export CLASSPATH=$CLASSPATH\:$TOSROOT/support/sdk/java/tinyos.jar\:$TOSROOT/support/sdk/java/ export PYTHONPATH=:$TOSROOT/support/sdk/python/ export MAKERULES=$TOSROOT/support/make/Makerules unset TOSMAKE_PATH fi # Finally set the path for the new MSPGCCROOT export MSPGCCROOT=/opt/msp430 export PATH="$MSPGCCROOT/bin:$PATH" # Helpful aliases alias sf="java net.tinyos.sf.SerialForwarder" alias listen="java net.tinyos.tools.Listen" alias apps="cd $TOSROOT/apps" alias tos="cd $TOSROOT/tos" # Environment changing functions # Change this shell's environment to support Tinyos 2.x development function tos2 () { export TINYOS_VER=2 . ~/.bash_tinyos } # Change this shell's environment to support Tinyos 1.x development function tos1 () { export TINYOS_VER=1 . ~/.bash_tinyos } # Set the MOTECOM variable to the first mote in motelist function setMoteCom () { MOTE=`motelist -c| cut -d, -f2` if [ "$BOOMERANG" == "1" ]; then TYPE="tmote" else TYPE="telosb" fi export MOTECOM="ser...@$mote:$TYPE" } # Change ownership of the TinyOS directories to the TinyOS group. This # was originally written for the LiveCD xubuntos but it's handy to have # around. function tos-fix-permissions () { echo "sudo may prompt you for your password." sudo chown -R root:tinyos /opt/tinyos-* sudo chmod -R g+w /opt/tinyos-* sudo find /opt/tinyos-* -type d -exec chmod 2775 {} \; }