Hey,
I'm trying to use the BufferedImage class in AWT. I'm using J2ME on IBM's J9 virtual machine.
When I try and call the BufferedImge.getRastor() method I get the following exception:
Exception in thread "main" java.lang.NoSuchMethodError: java/awt/image/BufferedImage.getRastor()Ljava/awt/image/WritableRaster;
Now, from what I know about the JVM that error is basically telling me that the BufferedImage class does not have a method called getRastor() which returns a WritableRaster object, however this method is documented in the API and it's from version 1.4.2 so should be compatable with J2ME.
I have no idea what is going on here, can you help?
Cheers,
Pete
-
I don't think this is your answer... but since you quoted your exception and I assume you cut and pasted it, I'll try to help.
Isn't the method:
getRaster
not
getRastor
?
(sorry if this is not what it is ailing you...)
-
You won't be able to use anything from AWT in J2ME since its not supported.
That happens because J2ME doesn't have AWT. AWT is intended to be used in desktop applications (Java SE), with a different user model and functionalities.
You can take a look at J2ME docs here
J2ME uses a different approach regarding GUIs, you may use the high level abstraction API (FORMS) and the low level API (CANVAS).
Decio Lira : Maybe because your IDE has JavaSE on the classpath. I'm not sure.:/ What are you using? the sun's Wireless toolkit? Or some proprietary toolkit? Can you sucefully run this code on the actual device? -
The accepted answer is not correct (as of 2009-08-05). Exactly which API's you have available depends on the configuration and profile combination you deploy. However, you do need to refer to the J2ME documentation for exactly which 1.4 classes and members are supported.
Using CDC 1.0 with Personal Profile 1.1 you get a cut-down version of Java SE 1.4. Personal Profile 1.0 is a cut-down Java SE 1.3. Both have a fairly complete implementation of AWT (no Swing, though).
We actually use J9's CDC/PP on handheld/PDA devices quite successfully.
0 comments:
Post a Comment