Jamvm help...please

I just received an Arduino Yun, I have been writing a Java application on my development system using the Oracle JVM. I would like to port this to the Yun, I've installed the jamvm, it is installed in:

/opt/usr/bin/

I've uploaded my jars onto the Yun, when I try to run it using:

/opt/usr/bin/jamvm -jar DSgateway.jar

I get:

Exception occurred while VM initialising.
java/lang/NoClassDefFoundError: jamvm/java/lang/VMClassLoaderData

I have all the required jars in the same folder as DSgateway.jar, I've looked around for help and documentation and can't find anything...

Any help is very gratefully received.

Thank you,

I use this one line bash script to properly start up the javmv executable (I named it 'java):

exec jamvm -Xbootclasspath:/opt/usr/share/jamvm/classes.zip:/opt/usr/share/classpath/glibj.zip $1 $2 $3 $4 $5 $6 $7 $8 $9

jamvm needs to know where those bootstrap classes are stored, hence that terrible command line argument; also type 'jamvm -X' for a short explanation.

kind regards,

Jos

ps. check where your installation has put the classes.zip and glibj.zip files ...

Thanks for the reply.

I'm using putty and ssh to connect to the Yun, created script 'java' containing:
exec /opt/usr/bin/jamvm -Xbootclasspath:/opt/usr/share/jamvm/classes.zip:/opt/usr/share/classpath/glibj.zip $1 $2 $3 $4 $5 $6 $7 $8 $9

I installed jamvm on the microsd card.

classes.zip is in /opt/usr/share/jamvm/
glibj.zip is in /opt/usr/share/classpath/

Also tried launching with:
/opt/usr/bin/jamvm -Dgnu.classpath.boot.library.path=/opt/usr/lib/classpath -Xbootclasspath:/opt/usr/share/jamvm/classes.zip:/opt/usr/share/classpath/glibj.zip -jar DSgateway
.jar

But when I run either the script or the above, I get:

Exception occurred while VM initialising.
java/lang/NoClassDefFoundError: java/lang/Class

Still having problems, thanks for your help...

Hold on, I forgot something (sorry about that); I also added/changed the following two lines in the /etc/profile script:

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/usr/bin
export LD_LIBRARY_PATH=/opt/usr/lib:/opt/usr/lib/classpath

kind regards,

Jos

Thanks, but no change.

Applied settings then rebooted and tried again.

Well, you know all my settings now; the only thing I can think of is: did you use an ext2/ext3/ext4 formatted SD disk? (the jamvm installation needs a couple of symbolic links and a FAT16/32 formatted disk can't create symbolic links).

kind regards,

Jos

fdisk information on partition:

Disk /dev/sda: 7948 MB, 7948206080 bytes
255 heads, 63 sectors/track, 966 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

df -h:
Filesystem Size Used Available Use% Mounted on
rootfs 7.5M 5.8M 1.7M 78% /
/dev/root 7.0M 7.0M 0 100% /rom
tmpfs 29.9M 104.0K 29.8M 0% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mtdblock3 7.5M 5.8M 1.7M 78% /overlay
overlayfs:/overlay 7.5M 5.8M 1.7M 78% /
/dev/sda1 68.3M 16.0E 110.2M 100% /opt
/dev/sda2 3.2G 598.0M 2.5G 19% /mnt/sda2

mount:
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=30568k)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
/dev/mtdblock3 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlayfs (rw,noatime,lowerdir=/,upperdir=/overlay)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/sda1 on /opt type ext4 (rw,noatime)
/dev/sda2 on /mnt/sda2 type ext4 (rw,sync,relatime,data=ordered)

Thank you,

That looks ok to me; I'm out of ideas now; are you sure those two .zip files are where that -X option says they are?

kind regards,

Jos

Thanks for the replies, I'm also talking to the developer of jamvm, Rob, who is being extremely helpful.

If you figure out what the cause was, please let me/us know here; also, if Rob whispers dark, useful secrets w.r.t. jamvm, I'm all ears too :wink:

kind regards,

Jos

Its looking and sounding like the actual package install was not completed successfully, some folders not present...also looks like my SD card may have some corruption, fixing these now, will probably download jamvm and install manually.

I just used opkg (don't forget to add a line to the /etc/opkg.conf file for the correct installation destination).

kind regards,

Jos

Having removed jamvm, 'opkg remove jamvm'

Then reinstalling, 'opkg install jamvm', it would seem that now it will fit, no complaints or error messages, that were displayed initially and I had to install it on microSD.

But now after a supposedly good install, I can't find any sign of glibj.zip

It should be: /opt/usr/share/classpath/glibj.zip; the other one should be: /opt/usr/share/jamvm/classes.zip. Also see the -X option in the 'java' script above.

kind regards,

Jos

Been away all week, returned refresh and started over, this time have progressed better, the same application runs fine in standard java environment on PC, but under jamvm I get:

java.lang.ClassNotFoundException: cantley/co/uk/clsMain
at java.lang.VMClass.forName(Native Method)
at java.lang.Class.forName(Class.java:233)
at jamvm.java.lang.JarLauncher.main(JarLauncher.java:46)

I'm not really sure what this is saying because the main class is present in the jar,

Can you show the command line and the manifest entry?

kind regards,

Jos

Command line:

/opt/usr/bin/jamvm -Dgnu.classpath.boot.library.path=/opt/usr/lib/classpath -Xbootclasspath:/opt/usr/share/jamvm/classes.zip:/opt/usr/share/classpath/glibj.zip -jar DSgateway.jar

I don't have a manifest file.

http://forum.arduino.cc/index.php?topic=228204.msg1649522#msg1649522

Use Rootfs, then install jamvm as standard package, or wait linino team updated Uboot which could release 8 MB mirror image at 16 MB flush memory, as total of 15 MB then installing jamvm is a piece of cake.

SPlatten:
Command line:

/opt/usr/bin/jamvm -Dgnu.classpath.boot.library.path=/opt/usr/lib/classpath -Xbootclasspath:/opt/usr/share/jamvm/classes.zip:/opt/usr/share/classpath/glibj.zip -jar DSgateway.jar

I don't have a manifest file.

That means that you didn't run your classes from a .jar file with your other Java implementation. Jamvm doesn't know which class in the .jar file to use for a starting point. You need to have a manifest entry in your .jar file as follows;

Main-Class: YourMainClass

kind regards,

Jos

I'm using Eclipse Juno Release 2

I export the project as a Runnable JAR file, it doesn't give me the option of creating a manifest file.

I did find the manifest in the generated jar file, it contains:

Manifest-Version: 1.0
Rsrc-Class-Path: ./ netty-codec-http-4.0.13.Final.jar slf4j-api-1.7.5.
jar jackson-databind-2.2.3.jar RXTXcomm.jar slf4j-simple-1.7.7.jar ja
ckson-core-2.2.3.jar netty-socketio-1.6.0.jar jackson-annotations-2.2
.3.jar netty-common-4.0.13.Final.jar netty-buffer-4.0.13.Final.jar ne
tty-codec-4.0.13.Final.jar netty-handler-4.0.13.Final.jar netty-trans
port-4.0.13.Final.jar
Class-Path: .
Rsrc-Main-Class: cantley.co.uk.clsMain
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader

Looks like the Main-Class isn't correct. I've edited and changed to read:

Main-Class: cantley.co.uk.clsMain

Now I get:

java.lang.reflect.InvocationTargetException
at java.lang.reflect.VMMethod.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:327)
at jamvm.java.lang.JarLauncher.main(JarLauncher.java:50)
Caused by: java.lang.OutOfMemoryError
<>

I then modified the build to export the files to a sub-folder, the manifest now reads:

Manifest-Version: 1.0
Class-Path: . DSgateway_lib/netty-codec-http-4.0.13.Final.jar DSgatewa
y_lib/slf4j-api-1.7.5.jar DSgateway_lib/jackson-databind-2.2.3.jar DS
gateway_lib/RXTXcomm.jar DSgateway_lib/slf4j-simple-1.7.7.jar DSgatew
ay_lib/jackson-core-2.2.3.jar DSgateway_lib/netty-socketio-1.6.0.jar
DSgateway_lib/jackson-annotations-2.2.3.jar DSgateway_lib/netty-commo
n-4.0.13.Final.jar DSgateway_lib/netty-buffer-4.0.13.Final.jar DSgate
way_lib/netty-codec-4.0.13.Final.jar DSgateway_lib/netty-handler-4.0.
13.Final.jar DSgateway_lib/netty-transport-4.0.13.Final.jar
Main-Class: cantley.co.uk.clsMain

But when I try to run the jar I get:

java.lang.ClassNotFoundException: cantley/co/uk/clsMain
at java.lang.VMClass.forName(Native Method)
at java.lang.Class.forName(Class.java:233)
at jamvm.java.lang.JarLauncher.main(JarLauncher.java:46)