• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of JavaSE class in JavaME application?

 
Alex Wright
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, first post here at JavaRanch! ...you guessed it, it's a question!

Right, i'm fairly new to JavaME programming.

Part of the application i'm developing needs to connect to google translate to perform translations. I'm trying to use an API to do this which i found here: http://code.google.com/p/google-api-translate-java/

I've added this library to my project, which requires java.lang.reflect.Method, but when i try to compile, i get the error:
Error preverifying class org.json.JSONObject
VERIFIER ERROR org/json/JSONObject.<init>(Ljava/lang/Object;)V:
Cannot find class java/lang/reflect/Method

I'm assuming this class is in JavaSE, but not microedition.

So, is there any way i can use this class in my JavaME application?

Cheers!
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaME was designed to fit in devices with limited memory, so the JRE core classlibs are stripped down. Unfortunately, there is a reasons wh you can't add what you want. Java is a secure, tamper-resistant environment and the core libraries are digitally signed. If you alter the libraries, the signature no longer matches and Java will refuse to run.

You'd probably find that once you added reflection (assuming you created and signed new libraries) , other classes and methods would be pulled in and you would either end up with a rogue JRE that is incompatible with the standard or you'd have recreated JSE, which probably wouldn't fit in available memory.
 
Darryl Burke
Bartender
Posts: 5149
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm assuming this class is in JavaSE, but not microedition.


Don't assume. Read the API.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic