2

From what I understand, Blackberry Java Runtime runs micro-java runtime.

Which is based on Java 1.3. (thanks Andreas_D)

Blackberry supplies a few alternatives, or the micro-java supplies some alternatives.

But its such a pain. We have an App that uses android java, of which supports full Java 1.6. We were hoping for a conversion of the UI components, but now have to rewrite code?

Is there an easy way to over come this problem?

I cant get a java.io.File for example. And its not the only one..

Are there alternatives for :

java.io.RandomAccessFile

java.io.File

java.io.FileOutputStream

IAmGroot
  • 13,760
  • 18
  • 84
  • 154
  • Java-ME is based on Java 1.3, AFAIK. 4th paragraph on [this wikipedia article](http://en.wikipedia.org/wiki/Java_Platform,_Micro_Edition) – Andreas Dolk Feb 14 '12 at 14:13

2 Answers2

4

Missing a bit? Yes if you're comparing it to a full Java SE / EE implementation. No if you're comparing it against the Java ME reference implementation.

Java ME (J2ME) doesn't contain all the API classes you may expect in a full Java SE platform - it was never intended to. Also, mobile devices need to be able to grant and revoke specific permissions to applications etc.

Remember it's a deliberate subset for devices with limited resources and the omissions are pretty well documented. For example, file access in Java ME is done via file connection api:

File Connection API

Also see these sites (for other/general differences):

Differences between Java SE, EE and ME

Difference between Android and Java ME development

Differences between programming for a J2ME JVM, and programming for a J2SE JVM

Java ME Wikipedia Page

Java ME CLDC - Noteworthy limitations list at Wikipedia

Community
  • 1
  • 1
Michael
  • 7,348
  • 10
  • 49
  • 86
3

Blackberry supports Java 1.3, not 1.4.

The cleanest way to get around those missing File-related classes would be to write some wrapper classes which just expose the functionality you need, then you can write implementations for BlackBerry using whatever's available via the J2ME and BlackBerry APIs.

Alternatively, you could just write your own versions of java.io.File etc for BlackBerry, and include those in your project. If you take this approach you'll need to be very careful to mimic the behaviour exactly or you could be opening yourself up to a whole new world of painful bugs.

There may well be libraries out there for BlackBerry which do what you want, I'll leave it up to you to do some googling on that...

vaughandroid
  • 4,315
  • 1
  • 27
  • 33