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
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
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
Foo-> onlyinfoo.txt: Returns foo.jar/onlyinfoo.txt.
Foo-> onlyinbar.txt: Returns
Foo-> inboth.txt: Returns foo.jar/inboth.txt.
Foo-> Foo.class: Should return
Foo-> Bar.class: Should return
Bar-> onlyinfoo.txt: Returns
Bar-> onlyinbar.txt: Returns bar.jar/onlyinbar.txt
Bar-> inboth.txt: Returns bar.jar/inboth.txt.
Bar-> Foo.class: Should return
Bar-> Bar.class: Should return
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
All threads including the main thread must have a
Thread object initialized
Thread.__start() is executed for the threads. This method is in
the virtual machine itself and performs most of the logic needed by the
library so that porting is simpler.