Thursday, September 4, 2008

SunSPOT sdk blue compiles with JDK1.4

By default, the blue version of the SunSPOT compiles with JDK1.4. This is not much content for a blog post, but the problem wasted an hour of my life/development time. Here's the error message:

generics are not supported in -source 1.4

Simple enough, right? Obviously, generics weren't around until version 1.5. Usually, this error yields to a simple change in the project properties or platform manager in Netbeans. Or, on the command line, you would specify "-source=1.5" as an option when compiling. Unfortunately, we're dealing with SunSPOT applications that use special ant scripts that automatically specify all the paths and properties needed to compile/run either a host or client application, with host-compile/host-run and compile/run, respectively.

The solution: In your %SPOT_HOME%/sdk directory exists a file named default.properties. Open this file for editing and search for "host.java.version". You'll see that the file sets this property to some value (1.4 in my case). Change that value to the latest version of Java.

Perhaps the fine researchers at Sun Research Labs will change the default setting of host.java.version from 1.4 to 1.5 in future SDK releases.

1 comment:

Unknown said...

A better way is to add "host.java.version=1.5" to the build.properties file which is located in the root of a SPOT apps project directory.