This list of questions and answers might be a good place to check first when problems occur using JamaicaVM and its tools.
Q: I am using Eclipse to develop my Java applications. Is there a plugin available which will help me using JamaicaVM and the Builder from within Eclipse?
A: Yes. There is a plugin available that will help you configure the Builder, download and execute your application on your target. For more information, see http://www.aicas.com/eclipse.html. For a quick start, you can use the Eclipse Update Site Manager with the following Update Site URL: http://www.aicas.com/download/eclipse. This convenietly downloads and installs the plugin.
A: Yes. Since JamaicaVM 2.0 the specification has been implemented. The last thing missing is the support for the physical memory classes. The specifiction is availalbe at http://www.rtj.org. The API documentation of the implementation can be found at http://www.aicas.com/jamaica/rtsj-api/index.html.
Q: When I use javac from JDK 1.4, I get error messages such as javac: Class <myclass> should be declared abstract or jamaica/jamaicavm: Link failed / method not found. What am I doing wrong?
A: There are incompatibilities between different versions of the Java standard classes. Interfaces have been extended, making it impossible to compile old code that does not implement the complete new interface, and new overloaded methods have been added causing linkage problems when compiling a class against newer (JDK 1.4) classes and then executing it in an environment like JamaicaVM that implements classes according to the 1.3 specification. Unfortunately, these problems can also occur in code that does not use any of the new features of JDK 1.4. To avoid these difficulties, always provide the Jamaica classes in the -bootclasspath argument of javac, i.e., use javac -bootclasspath /usr/local/jamaica/classes <myclass.java> to compile a class.
Q: When I try to execuate an application with the JamaicaVM I get the error message OUT OF MEMORY. What can I do?
A: The JamaicaVM has a predefined setting for the internal heap size. If it is exhausted the error message OUT OF MEMORY is printed and JamaicaVM exit with an error code. The predefined heap size is usually large enough, e. g. 40MB, but for some applications it could happen that it is not sufficient. You can set the heap size via the environment variable JAMAICAVM_HEAPSIZE, e. g. under bash with JAMAICAVM_HEAPSIZE=268435456; export JAMAICAVM_HEAPSIZE;.
Q: When the built application terminates I see some output like WARNING: termination of thread 7 failed. What is going wrong?
A: At termination of the application the JamaicaVM tries to shutdown all running threads by sending some signal. If a thread is stuck in a native function, e. g. waiting in some OS kernel call, the signal is not received by the thread and there is no responce. In this case the JamaicaVM does a hard-kill of the thread and outputs the warning. In general the warning can simply be ignored, but you have to take into account that a hard-kill could leave the OS in some unstable state or some resources, e. g. memory allocated in a native function, are lost. To avoid such hard-kills make sure no thread get stuck in a native-function call for a long time (e. g. more than 100ms).
Q: My application runs fine using JamaicaVM directly or after using the builder. However, when I quit the application, I see error messages such as
LOADING FAILED FOR CLASS: tutorial/example1/Activator LOADING FAILED FOR CLASS: com/aicas/java/net/protocol/file/Handler LOADING FAILED FOR CLASS: org/ungoverne |
What is going wrong?
A: For easier debugging of applications that catch exceptions without providing propoer error messages to the user, JamaicaVM records severe errors and prints them after an application terminated. This is the case for errors such as running out of memory, stack overflows and failure to load a class.
Some applications, however, try to load classes that do not exist and handle the Java exception that was caused by this internally. Since JamaicaVM cannot distinguish this case from the failure to load a class that causes an application to fail, these error messages are still recored and printed on termination of the application.
A: These two tools are included in JamaicaVM and can be executed like this:
jamaicavm gnu.java.rmi.rmic.RMIC
jamaicavm gnu.java.rmi.registry.RegistryImpl
When building a standalone application of your RMI server or client, the stub of the RMI service implementation and classes from the package gnu.java.rmi have to be included in the binary. As an example, the Builder arguments could look like this:
jamaica -smart -numThreads=10 -includeClasses=MyServiceImpl_Stub:gnu.java.rmi... MyRMIServer
Q: When I try to start a Jamaica compiled executable in a Linux 2.4.x environment, I get an error message like ' __alloc_pages: 0-order allocation failed (gfp=0x1d0/0) from c0123886'.
A: This is a bug in the Linux 2.4.10 kernel. Please use a newer kernel version. The problem seems to occur if the amount of allocated memory is close to the amount of available memory, which is usually no problem if you use Jamaica on a desktop PC, but occurs quite often on embedded systems running Linux 2.4.10 and jamaica (e.g., the DILNet/PC.
Q: When I try to compile an application with the Builder I get the error message OUT OF MEMORY. What can I do?
A: The Builder has a predefined setting for the internal heap size. If the memory space is exhausted the error message OUT OF MEMORY is printed and Builder exit with an error code. The predefined heap size is usually large enough, e. g. 96MB, but for some applications it could happen that it is not sufficient. You can set the heap size via the environment variable JAMAICA_BUILDER_HEAPSIZE, e. g. under bash with JAMAICA_BUILDER_HEAPSIZE=268435456; export JAMAICA_BUILDER_HEAPSIZE;.
Q: When I build an application which contains native code it seems that some fields of the class files can be accessed with the function GetFieldID() from the native code, but some others not. What happend those fields?
A: If an application is build with the option -smart (smart-linking-process) the Builder remove all not-referenced methods and fields of the classes. If a field in a class is referenced from native code only the Builder can not detect this reference and protect the field from the smart-linking-process. To avoid this use the -notSmart with the class containing the field. This will instruct the Builder to avoid smart-linking for the specified class(es).
Q: When I try to build an application with the Builder I get some errors in the Java API classes of Jamaica. I have set the environment variable CLASSPATH to appropiated class directories and JAMAICA to the Jamaica installation directory, but it does not help. What is going wrong?
A: If you try to build an application with the Builder the environment variable CLASSPATH overwrite the setting of JAMAICA for the class directories. Because some of classes of the package java.lang contain Jamaica specific private fields you will get strange errors if your try to compile against non-Jamaica class files from java.lang. Do not include some basic API Java packages into your CLASSPATH other than from Jamaica.
Q: When I build a application with the Builder I get some warning like WARNING: Unknown native interface type of class '...' (....h) - assume JNI calling convention. Is there something wrong?
A: This is not an error in general. The Builder output this warning when he is not able to detect if a native function is implemented using JNI (standard Java native interface; see chapter Chapter 6) or JBI (the Jamaica.specific, but more efficient native interface; see Chapter 9). Usually this means the appropiated header file generated with some prototype tool like Jamaicah is not in the proper format. To avoid this warning remake the header file with Jamaicah.
Q: How can I set properties (using -D<name>=<value>) for an application that was built using the builder?
A: For commands like jamaicavm parsing of VM arguments such as -D<name>=<value> stops at the name of the main class of the application. After the application has been built, the main class is an implicit argument, so there is no direct way to provide additional options to the VM.
However, there is a way out of this problem: the Builder option -XnoMain removes the implicit argument for the main class, hence normal argument parsing as for the jamaicavm command is used to find the main class. When launching this application, the name of the main class must hence be specified as an argument, and it is possible to add additional VM options such as -D<name>=<value> before this argument.
Q: When I run the Builder an error "exec fail" is reported when the intermediate C code should be compiled. The exit code is 69. What happend?
A: For compiling the intermediate C code an external C compiler is called. The compiler command and some arguments are defined in etc/jamaica.conf. If the compiler command can not be executed the Builder terminates with an error message and the exitcode 69 (see list of exit codes in the appendix). Try to use the verbose-output with the option -verbose and check if the printed compiler-command call can be executed in your command shell. If not check the parameters for the compiler in etc/jamaica.conf and the PATH environment variable.
Q: Can I build an application which expect the name of the main class on the command line like JamaicaVM do?
A: With the Builder a standalone VM can be build with the option -XnoMain. If this option is specified the Builder does not expect a main class while compiling, instead the build application expect one later after startup. Some classes or resources can also be included in the created VM, thus a VM can be build including all classes of the selected API except the main program with main class. The main program is loaded when the VM is started. variable.
Q: When I load a built application I get an error of the dynamic linker Undefined symbol: ftruncate (binding 1 type 0).
A: This linker error occurre when the VxWorks system is configured without Posix ftruncate-support. See the define INCLUDE_POSIX_FTRUNC in target/config/all/configAll.h in your VxWorks installation directory. The ftruncate() function is needed by e. g. the Java API methode java.io.RandomAccessFile.setLength().
A: Because of the C-like syntax of the VxWorks command shell parameters to an application have to be passed as a string. An application can simply be started by jamaica_vm,"..." where ... is a space separated list of arguments which should be passed to the application (yust like a command line).