This section of our site will be devoted to showing code examples for several topics. The topics will range from very simple to more complex. Code samples will be provided. If there is a topic that you would like to see covered please let us know!
How can Java applications be used on the JNIOR?
INTEG has only implemented a subset of the JDK. Not all classes and methods are available. You can explore the Javadoc to explore the classes that are available.
Generally this is not a problem. Learning to code for the JNIOR and stay within the available classes is not hard. You will notice the differences if you look for examples online and they are provided in the more recent versions of the JDK that INTEG hasn’t implemented yet. Those examples may use classes that aren’t available. There is almost always a way to get the functionality implemented with the classes we have. INTEG has numerous premade classes you can setup for your project here. If you need help with a specific implementation please let us know!
Versioning your application is optional but highly recommended. INTEG uses the build.xml file in NetBeans to auto increment the version number. The build.xml file in NetBeans gives you access to Ant commands for additional compile-time functionality.
Logging events to the filesystem is very helpful for many reasons. It can help you verify that an event happened or if something went wrong. When something goes wrong it is helpful to log additional information to help you determine the cause.
The filesystem resides in three different areas of memory. The
flash/ folder resides in
temp/ resides in
DRAM, and all other files and directories resides in
SRAM. There are pros and cons to each type of memory.
flash/ folder is best for long term storage. It is the storage location for INTEG applications and the web server pages. The drawback to flash memory is the speed. It is slower to access than other forms of memory. INTEG employs a caching strategy to speed up flash access by writing to
DRAM and committing to flash less often.
temp/ folder access is the fastest file storage location. It also has the largest storage capacity. The JNIORs are produced with 64 MB of
DRAM space is shared between the
temp/ folder and all other system and application memory. The drawback to this storage location is that it is temporary. All content is erase each time the JNIOR boots.
All other filesystem storage in the
SRAM is faster than
flash and battery backed so content is not lost on boot. The drawback here is that space is limited.
What about the
etc/ folder? The
etc/ folder is a read-only location that is updated by the
jrupdate command when the operating system, JANOS, is updated. The etc/ folder contains the JanosClasses.jar file.
At the Java application level, the JNIOR has support for TCP and UDP communications. You can use the classes in the java.net package.
You can set the Inputs and Outputs of the JNIOR not only through manual setup, but you can also create code that can toggle or pulse them as well.