SunSPOT Install Notes

SunSPOTs where a cool IoT hardware from SUN/Oracle that ran JavaME. They are now dead, but this may help some that catch them again.

Ref: How to change environment variables on Windows

Install

For Windows 64 Bits see below for extra steps.

  1. Install the latest JDK
  2. install ant (comes with Eclipse)
    • add the C:\Programs\eclipse\plugins\org.apache.ant_1.7.0.v200803061910\bin to the path (version of ant may be different).
  3. add to PATH env the path to the bin in the jdk (by default it will add the jre only)
    • this will make javac work on a prompt
  4. add a JAVA_HOME variable with the dir of the jdk
    • this will make ant work on the prompt (needs the tools.jar from the jdk)
  5. As the jnlp for the SPOTManager is signed with an old certificate, the Java security settings will stop it from running. You need to change the Java security settings for this.
  6. install the SpotManager

Serial port classes

They should be available from the installation, but may need to be added to path see Errors.

Changing Java Security Settings in Windows

  1. Open the Java Control Panel (either search in the control panel or do Win+Q keys and search for java (choose Configure Java)
  2. In the Security tab, downgrade the security level to one allowing for Java applications to run even if the revocation status of the certificate may not be verified.
  3. Add http://www.sunspotworld.com/ to the Exception List

This will make it prompt for running the SPOTManager, giving the option to run it (instead of just saying that it won’t run).

Running SPOTManager as Administrator in Windows

You can either start a command line with administrator rights or create a batch file and then change its properties to be run as admin.
First you need to download the SPOTManager.jnlp instead of running it from the browser. After that:

Batch File

  1. Create a batch file in the same directory of the downloaded jnlp with:

    javaws SPOTManager.jnlp

    • The enviroment variables state in the instalation above must be defined, namely javaws and ant in the PATH, and JAVA_HOME
  2. With right-click on the bat file edit its properties. On the compatibility tab, check “Run this program as Administrator”
  3. Execute the batch file

Command Line

  1. Run a command prompt as Administrator (ex.: do WIN and X keys and choose the admin command prompt).
  2. Run the command on the directory where you downloaded the file.

C:\temp> javaws SPOTManager.jnlp

Windows 64 bits

SPOTManager will not install in a 64 bits OS using a 32 bits Java version. As such:

  • need to install Java 64 bits
  • eclipse is also available in 64 bits
    • go to downloads and follow the latest version, choosing 64 bits version

Installing Drivers for SunSPOTs in Windows 64 bits

As explained in this blog post, the drivers need a little tweaking for windows 64 bits.

  1. Download the .inf file from the above blog entry
  2. As the driver is not correctly signed (was for the 32 bits version) enable installing unsigned drivers in windows following this post
  3. The driver can now be installed (ex.: right click on the .inf file and install or go to Device Manager and update the driver if you have already plugged in a Spot)

Upgrade Spots

  1. in a directory with a build.xml for the spots (the BounceDemo for example) do:
    ant upgrade
  2. after that for the base station do
    ant selectbasestation

IDE setup

See: forum posting

Doing Sun SPOT development in Eclipse is fairly straightforward, and some members of the team use that IDE - we just don’t have pre-packaged modules for it. Here’s a rough sketch of setting up a SPOT project. First, copy an existing Sun SPOT app from the examples. Then do File/New Project in Eclipse, then select Java project. In the next dialog, give the project a name, click “Create project from existing source” and give it the path to your copied app. In the next dialog, click on the libraries tag, remove the JRE System library, and click “Add external Jars”. Navigate to the lib subfolder of your SDK installation, and pick these jars:

  • multihoplib_rt.jar
  • transducerlib_rt.jar
  • spotlib_common.jar
  • spotlib_device.jar
  • squawk_rt.jar
  • spotworld_ext.jar

You should remove the JRE system libray. And change the settings for the Java compiler to match a “Compliance Level” of 1.4.

Click “Finish” and you have a project. To attach source, first open the project’s properties dialog. Select the Libraries tag, expand each jar, double click the source attachment, click “External file” and navigate to the matching source jar in the src folder within your SDK installation. spotlib_source.jar covers both the spotlib jars, and there is no source shipped for squawk_rt.jar. To attach javadoc, double click the javadoc location for each jar and use the browse button to go to the doc/javadoc folder inside your SDK installation. This location is good for all the jars. For a host app, the process is much the same, except the jar list is now

  • multihoplib_rt.jar
  • spotlib_common.jar
  • spotlib_host.jar
  • squawk_classes.jar

and the javadoc location is doc/hostjavadoc. And for a host app, you should not remove the JRE System library.

If using the SpotClientCommands to issue commands to the spot, read its library, etc, you also need to include the:

  • spotclient_host.jar
    • src: src/spotclient_source.jar
    • documentation: doc/hostjavadoc/

Sharing SunSpots (key issue)

From the SunSpot developer's guide.pdf

If you want to share Sun SPOTs between two or more SDK installations or users, you have to ensure that the SDK installations and users share the same key-pair. To do this, start by installing each SDK as normal. Then, copy the key-pair from one “master” user to each of the others. You can do this by copying the file sdk.key from the sunspotkeystore sub-directory of the “master” user’s home directory and replacing the corresponding file in each of the other user’s sunspotkeystore directories.
You then have to force the master’s public key onto each of the Sun SPOTs associated with the other installations. The simplest way to do this is to re-deploy the application via USB
ant deploy
for each Sun SPOT.

Errors

When running Solarium it complains about not being able to load jvm.dll

This may be due to some mismatch with 32 bits and 64 bits java versions. When running a 64 bit system and thus a 64 bits java, Solarium seems to nonetheless use a 32 bits reference to jvm.dll. The solution to me was to point the JVMDLL environment variable to jre/lib/client/jvm.dll from the 32 bit version of java. I installed both the 32 and 64 bits version as I was running windows 8 64 bits (see above regarding SunSPOTMAnager needs for 64 bits java on a Windows 64b version).

set JVMDLL=C:\Progra~2\Java\jre7\bin\client\jvm.dll
ant command complains of not finding tools.jar

Either add it to the JAVAPATH or copy it from jdk/lib to jre/lib.

Solarium windows does not shown

If the Solarium windows does not show up when running the command ant (or calling it from the SPOTManager application), it may be that the window was closed on another use and that got saved in .solarium.properties. Delete the file (located in the user’s home, in Windows in C:\Users\<usernanme>) and start solarium again.

no rxtxSerial in java.library.path

Add the -Djava.library.path=C:\Develop\SunSpot\sdk\lib to the VM args in the running configuration Or add the LD_LIBRARY_PATH to the running environment with the path to the lib in SunSpot

SERIAL_PORT property must be set to access the basestation

Add the -DSERIAL_PORT=COM7 to the VM args in the running config

Fedora 64 bits

Some more things are needed for Fedora 64 bits (libs for 32 in 64 system), but two main points troubled our deployment (the 1st is more or less known but it has similar solution to the 2nd):

  • Permissions for the /dev/ttyACM*: either set the permissions of /dev/ttyACM* to 777 or add the developer/java compiler user to the dialout group. The /dev/ttyACM* should already have rw permissions for that group’s members.
  • Permissions errors for /var/lock: same as the above, but this time for the group lock. The /var/lock should also be chgrped to lock.
  • ant build complains about missing hal-device: fedora has removed HAL from the distribution. The build process can live without it, but the shared basestation and the usage of the base station was not possible until we installed the hal rpm from alternative source.
Previous
Next