WPILib projects don't have standard Java classes?

Hey all,

Been doing some programming lately, wanted to use a .properties file to hold sensor/motor channels. Unfortunately, it appears that the WPILib libraries doesn’t have the java.util.Properties class. In fact, that package is missing a lot of the standard Java classes.

I checked in the project settings (using Netbeans 7.4), and it says I’m using JDK 1.7, so the classes should be there.

Any advice?

The cRIO runs the Squawk JVM, which is based on Java ME (a subset of Java 1.3). There are lots of things that aren’t implemented in newer versions of Java that aren’t in squawk. The project properties in netbeans don’t mean anything, since it uses the ant buildscripts provided with the FIRST sdk.

There are some classes that aren’t required by Java ME, that squawk implements anyway. These are in com.sun.squawk.util, but properties aren’t one of them. What did you want to use properties for?

The 2015 control system will use Java SE Embedded. It won’t be nearly as stripped down as Squawk.

If you are looking into using a properties file to avoid having to recompile/deploy every time you want to tweak a setting, I would suggest taking a look at 254’s Constant implementation from 2013.


It’s a pretty straight forward implementation. Default values for all variables are stored in the Constants class. When an instance of this class is created (from robotInit() would be a good idea), it will go out and look for a file called Constants.txt. It will read in the key value pairs defined in the txt file. For each key/value pair in the file, it will search the list of known keys for a match. If it finds a matching key, it will overwrite the value specified.

Your Constants.txt file only needs to define values for keys you would like to override the default of.

I integrated the ConstantBase class into my team’s code last night, haven’t had a chance to deploy the code yet, but we will likely use this on our 2014 robot.