SquirrelJME As A Runtime

To use the SquirrelJME library as the main supporting run-time library will require that you implement the native methods which are located in the cc.squirreljme.runtime.cldc.asm package. Implementing these native methods will in the result end up with a library compatible implementation of SquirrelJME.

Requirements of Java ME

Java ME is different from Java SE and operates in a slightly different fashion. However, every conforming Java SE JVM can run Java ME programs but the same is not possible in most cases because Java ME is a subset of Java SE.

JAR Resource Lookup

When using Class.getResourceAsStream() in Java ME, there is a strict method in how resource lookup is performed. A single JAR is considered to be a single unit where resources and classes are located. A class within one unit is not able to access the resources in another unit. Class files should not be visible to this method and not accessible as resources, the reason for this is that output executables may be ROMized which would destroy the class files that executable code is derived from.

As an example, here is a set of two JAR files:

This would be the result of multiple Class.getResourceAsStream() calls from each class:

This reason for this is that in each JAR, there is a resource called META-INF/MANIFEST.MF. This resource is used and looked up my programs which are MIDlets in order to obtain their application properties. It also is used by the run-time to determine what a JAR is and what it supports.

Class Loading And Lookup

Unlike Java SE, there are no ClassLoaders. Java ME operates entirely on a single two tier approach. The first tier are classes which are built-in and available to every program. The second tier are classes which are not built-in and which have been loaded dynamically from the launcher. When a class is looked up, the order is always built-in classes first. If a program is currently being executed then it may only look up classes which exist in its execution context. If two programs are loaded they are both in two different execution contexts and they cannot lookup each others classes. Thus if two JARs have the same class, it will only use the class that is in their same JAR.