Program Files Programming
DESCRIPTION
Application programs are written in the Java language. The application
program and any other supporting .java files are compiled into .class
files. The resulting class files which contain the bytecode are then packaged
into a single library file with the .JAR extension.
In addition to class files the JAR file contains a Manifest.mf file used
by the JVM among other things to locate the main() program entry point. An
AppInfo.ini file may be present. The presence of this file is detected by
JANOS during boot an used to Register the application. Registered
applications show up in the WebUI Configuration Applications tab.
There may be other files added to the JAR file as needed by the application.
Sometimes the developer will include the source files. This is the case
with JBakup.jar for instance.
COMPILING
For proper operation the application program MUST be compiled against the
JanosClasses.jar runtime library or the expanded JanosRuntime_2.0.jar
runtime (available from
jnior.com ). With Java being standard a
simple "Hello World" program compiled with standard Java libraries will,
in fact, execute properly on the JNIOR. With those libraries however, you
will not be able to utilize the unique classes that provide access to all
of JNIOR features and hardware.
Depending on your choice of IDE or compiler the procedure will vary. With
NetBeans (
https://netbeans.apache.org// ) when a Project is created you
need to specify JanosRuntime_2.0.jar as a Library in the Project Properties
dialog. With that JAR you can edit the library entry to indicate that it
contains both Javadoc and Sources.
Additionally in the Project Properties under Build and Compiling you must
add a -bootclasspath option as an Additional Compiler Option. For
example:
-bootclasspath "C:\My Projects\JanosRuntime_2.0.jar"
The above instructs the compiler to build on the JANOS runtime only.
Adding the library to the project tells the IDE about classes unique to
JNIOR.
One last thing that will help the Netbeans IDE popup useful information as
you develop your program is to edit one of the project.properties in the
nbproject folder. You can make the following setting or otherwise point the
endorsed.classpath to the JanosRuntime_2.0.jar file.
endorsed.classpath=${javac.classpath}
This setting insures that only JANOS pertinent information is displayed
eliminating references to the standard libraries. If you do not make this
change you might be led to use a class or method that is actually not
supported on the JNIOR. With the -bootclasspath setting above the program
will not successfully compile when it encounters the unknown.
NOTES
The .JAR file extension identifies the library as containing an application
that can be executed by JANOS using the JAVA command. JAR files located in
the /flash folder are in the default search path for programs and can be
executed by name on the command line without specifically using the JAVA
command. This allows application programs to masquerade as custom commands.
The FtpClient is an example where /flash/ftp.jar creates an FTP command
for interaction with an external FTP server.
A JAR file is identical in structure to a ZIP file. These can be manipulated
with the ARC command (same as ZIP and JAR commands).
SEE ALSO
HELP Topics:
JVM,
ARC,
JAR,
JanosClasses.jar,
JAVA,
JBakup,
FtpClient
[/flash/manpages/program.hlp:104]