Go to Post There is a really bad trap most people fall into, when presented with data they tend to trust it. This is dangerous. - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-25-2014, 11:03 AM
amesmich's Avatar
amesmich amesmich is offline
Registered User
FRC #4638 (Jagbots)
Team Role: Teacher
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Maryland
Posts: 97
amesmich is an unknown quantity at this point
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 01-25-2014, 12:17 PM
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,547
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: WPILib projects don't have standard Java classes?

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.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-25-2014, 02:33 PM
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 429
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: WPILib projects don't have standard Java classes?

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.

ConstantBase
Constants

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.
__________________
http://team2168.org
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:04 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi