Cannot create an RGBImage instance

Right now our robot doesn’t have a camera on it so we’re trying to run a local program with the wpilibj libraries. We’re loading an image taken from last year onto the program but we can’t get it to do anything. We simplified the code down to just the declaration:

new RGBImage();

Which results in this error:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at edu.wpi.first.wpilibj.image.Image.<init>(Image.java:24)
	at edu.wpi.first.wpilibj.image.ColorImage.<init>(ColorImage.java:16)
	at edu.wpi.first.wpilibj.image.RGBImage.<init>(RGBImage.java:20)
	at localapp.Optical.main(Optical.java:33)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to com.sun.squawk.Address
	at com.sun.squawk.NativeUnsafe.getInt(NativeUnsafe.java:340)
	at com.sun.squawk.NativeUnsafe.getUWord(NativeUnsafe.java:360)
	at com.sun.squawk.NativeUnsafe.getObject(NativeUnsafe.java:404)
	at com.sun.squawk.NativeUnsafe.getAddress(NativeUnsafe.java:414)
	at com.sun.squawk.GC.getKlass(GC.java:1077)
	at com.sun.cldc.jna.Pointer.createStringBuffer(Pointer.java:402)
	at com.sun.cldc.jna.TaskExecutor.<init>(TaskExecutor.java:105)
	at com.sun.cldc.jna.TaskExecutor.<init>(TaskExecutor.java:116)
	at edu.wpi.first.wpilibj.image.NIVision.<clinit>(NIVision.java:29)
	... 4 more
Java Result: 1

What are we doing wrong here?

This seems to be a problem with the squawk VM not being able to work with the hardware. If I understand your post correctly, you’re trying to run this on a computer. The exception says that a string cannot be cast to an address, and it seems that an address has to do with lower level communication to peripherals and some of the primitive data types. The squawk VM is not designed to be run on the computer, so when java tries to allocate some block of memory for your empty image and it uses the address class to access the memory, it fails to do so. Ifyou want to experiment with image pprocessing, you can use vision assistant.