Windows Phone Thoughts - Daily News, Views, Rants and Raves

Check out the hottest Windows Mobile devices at our Expansys store!


Digital Home Thoughts

Loading feed...

Laptop Thoughts

Loading feed...

Android Thoughts

Loading feed...




Go Back   Thoughts Media Forums > WINDOWS PHONE THOUGHTS > Windows Phone Software

Reply
 
Thread Tools Display Modes
  #1  
Old 06-12-2005, 08:33 PM
atrain
Pupil
Join Date: Jun 2005
Posts: 26
Default Compiling java on the pda

I know its an odd question, but is there a way to compile and run java directly on the pocket pc?

I want to start learning java but im going to be away from computers for a while, so im wondering if theres a way to do this on my axim X5.

I know nothing about java on pdas, so please tell me everything i will have to know.
 
Reply With Quote
  #2  
Old 06-13-2005, 02:34 AM
Janak Parekh
Editor Emeritus
Janak Parekh's Avatar
Join Date: Aug 2006
Posts: 15,171

You may find this link to be of help.

That said, the Pocket PC isn't an ideal way to learn Java. The Javadocs alone for 1.5 are 250MB/10,000 files... 8O

--janak
 
Reply With Quote
  #3  
Old 06-15-2005, 03:22 AM
atrain
Pupil
Join Date: Jun 2005
Posts: 26

id use a tutorial...

thanx!
 
Reply With Quote
  #4  
Old 06-15-2005, 03:42 AM
atrain
Pupil
Join Date: Jun 2005
Posts: 26

Hmm...
Those all look like JVMs...
im looking for JDK's that can compile directly on the pda...

Im begining to think there isnt such a thing...
 
Reply With Quote
  #5  
Old 06-15-2005, 04:09 AM
Janak Parekh
Editor Emeritus
Janak Parekh's Avatar
Join Date: Aug 2006
Posts: 15,171

Quote:
Originally Posted by atrain
Hmm...
Those all look like JVMs...
im looking for JDK's that can compile directly on the pda...
Right -- most Java bundles are JVMs, as the compiler is going to run fairly slow on a PDA and will eat up RAM. There was "jCompiler" on that list, though. No idea how well it works or if it's adequate. I personally learned Java on the desktop, and considering its verbosity ("public static void main", etc.), couldn't imagine doing it on the PDA. But more power to you if you can pull it off.

--janak
 
Reply With Quote
  #6  
Old 06-15-2005, 02:13 PM
Menneisyys
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067

Well, for quick prototyping/hacking/writing some tools on-the-go, even a PPC-based, "only" Personal Java or CLDC 1.1/MIDP 2.0-compliant JVM's are OK.

I'm testing the various tools for compiling Java on the Pocket PC. Serious hacking is involved because they're heavily outdated and have severe problems with currently available JVM's. Stay tuned
 
Reply With Quote
  #7  
Old 06-15-2005, 02:16 PM
Menneisyys
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067

Quote:
Originally Posted by atrain
Hmm...
Those all look like JVMs...
im looking for JDK's that can compile directly on the pda...

Im begining to think there isnt such a thing...
There are. It's just that you'll need to wait a bit until I sourt out all their bugs and hack them to be usable.
 
Reply With Quote
  #8  
Old 06-15-2005, 05:13 PM
Janak Parekh
Editor Emeritus
Janak Parekh's Avatar
Join Date: Aug 2006
Posts: 15,171

Quote:
Originally Posted by Menneisyys
I'm testing the various tools for compiling Java on the Pocket PC. Serious hacking is involved because they're heavily outdated and have severe problems with currently available JVM's. Stay tuned
You have way too much time on your hands.

Seriously, if you make measurable progress, fire off a news item to us and, if appropriate, we'll do up a DEVELOPER post.

--janak
 
Reply With Quote
  #9  
Old 06-15-2005, 06:46 PM
Menneisyys
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067

So... after several hours of serious hacking, I'm proud to present the working results

What you'll need?

1. Insignia/Esmertec Jeode. It has been shipped with higher-end iPAQ's from 2001, so, you may have it. I've tested version 1.7.3. Unfortunately, much as it was one of my main goals, I haven't managed to hack the freely downloadable IBM J9 JVM to work - it's unhackable, unlike Jeode JVM's. If anyone knows how you can generate J9-compliant class files so that I can enable compilation support with recompiling some classes in the java.lang package (unfortunately, this is a must to enable compilation with J9), please, let me know!

EDIT on 16/06 11:50CET: just move on to the next post if you want to know how to make it work with CrEme!

2. Jon Fernquest's IDE for Personal Java on the iPAQ. It's available here. Get the single ipaqide.jar.

3. JDK 1.3.1_15 from here. Make sure you choose JDK and not JRE!

Why not 1.4 or 1.5, you may ask. It's simple: they are just not compatible with Jeode. I've tried hard to hack them to work - without success. (Again: please note that I've done all this with a relatively old Jeode version. Newer ones may be compatible with newer JDK's. Version 1.3, compared to the bare-bone C(L)DC/J2ME standards/implementations, is, however, pretty good.)

Install Jeode. If it's an old version (say, the above-mentioned 1.7.3), it's highly possible it can't be installed to any storage card. Much as they offer the installation-time option of an alternative storage media, it'll be still installed in main memory. It's, fortunately, pretty easy to relocate it to a storage card. I've described this here.

Next, you'll need to fix a bug in the IDE: move the contents of the root of ipaqide.jar to a subdirectory called ipaqide inside it. The easiest way to do this is creating a ipaqide directory somewhere on your hard disk, stepping into it, renaming ipaqide.jar to ipaqide.zip, stepping into it, pressing + on the numeric keypad, pressing F6 and Yes (that is, moving). Then, move back the entire subdirectory to the ZIP file, and, finally, rename it back to ipaqide.jar.

EDIT on 16/06 11:50CET: I've uploaded the fixed version here so that you don't need to fix it yourself.


Next, copy c:\jdk1.3.1_15\jre\lib\rt.jar and c:\jdk1.3.1_15\lib\tools.jar to your PDA; preferably, a storage card. Let's assume you copy them to \SD-MMCard\jars\. Please note that the actual version number/JDK home path may be different from c:\jdk1.3.1_15; the relative path of rt.jar and tools.jar, however, is the same with all 1.2+ JDK's.

Now, create the following link file to invoke the IDE, along with adding rt.jar, tools.jar and ipaqide.jar to the CLASSPATH:

255#\SD-MMCard\jeode\evm.exe -Djeode.evm.console.local.keep=true -cp \SD-MMCard\jars\tools.jar;\SD-MMCard\jars\ipaqide.jar;\SD-MMCard\jars\rt.jar ipaqide.Javacw2

In this example, I've assumed that JEODE is installed to \SD-MMCard\jeode\. If its path is something else, modify the invocation command accordingly, as with the case of different JAR paths.

Copy the link file to your PDA and run it. After some seconds, the GUI should be visible:



Click the Open button. The contents of \My Documents will be displayed.

WARNING: if there is any file with real Unicode (>255 character code) characters in it, Jeode will crash with a UTF-8 problem in java.io.File().list()! This is because of the not-really-i18n-avare Jeode and can't otherwise be helped. Make sure you remove all files that have non-Western characters in their name from here before clicking Open.

EDIT on 16/06 11:50CET: in the next post, I've also described where, in what class file can you modify the default directory name so that you don't need to clean up \My Documents to make iPAQIDE work

Now, just navigate to the directory that contain your Java sources (if you don't want to start writing them from strach - if the latter is the case, just click New on the above screen). Double-click the file name you want to compile/edit so that its name becomes visible in the lower textfield:



Click Open:



On this screen, just choose the Java file you want to edit (so far, you've only added one, so, only one is visible in the lower pane). Click Compile to compile it (it'll be tolerably fast in cases; in other cases, it'll be very slow) or, if you want to edit it, just double-click it:



From this editing screen, you can return to the first screen by pressing Return. Menu, on the other hand, takes you to the standard menu options, including Save As.

Note that, much as the GUI offers the Run button on the main screen, I haven't managed to run anything from here. You'll need to make a separate link file for invoking the newly-created class file. For example, if a HelloWorld.class class file is in the root directory of your PDA (the IDE stores the resulting class file in there), this link file should read as follows:

255#\SD-MMCard\jeode\evm.exe -Djeode.evm.console.local.keep=true -cp \ HelloWorld

Just run it in a separate Jeode instance - you don't need to shut down the IDE process to do so. That is, just go to Start menu without closing iPAQIDE and click the link.

People that are interested in more PPC/Java-related stuff may also want to read the following threads:

Pretty instructive, but a bit outdated (there is no Personal Java for WinCE at Sun's site any more) and instructs to do far more than is really needed
Open letter to SUN to produce a JRE for Pocket PC - this is also very instructive. Shame on Sun for not releasing anything serious for the PPC!

Feel free to ask for help. Please also let me know if the images aren't visible from your PC. (I've just paid for the server hosting and would like to know how it works from around the world.)
 
Reply With Quote
  #10  
Old 06-16-2005, 10:39 AM
Menneisyys
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067

I have great news! I've continued playing with iPAQIDE and found out that CrEme also works great with iPAQIDE !

Basically, both version 3.26 and 4.00beta will work. The only difference is the JDK version/Java conformance they have. The most notable difference, in addition to the different JDK conformance they have, is that 3.26 can't step out from the initial \My Documents by clicking Up. Therefore, put all your sources there or in some of its subdirs; or, alternatively, modify, recompile and repackage the default constructor in ipaqide.Javacw2 (the sources are in the iPAQIDE JAR file); it's in the curDir = new File("\\My Documents"); assignment that the initial directory is set.

Before deciding for 4.00beta over 3.26, however, you should also be aware of that it does have a lot of bugs. One of the bugs is, for example, that I wasn't able to make it work with the new (still unpublished; I've only got it for testing), entirely CDC-compliant version of the toonel client because it has Socket-based input stream bugs. Therefore, as a runtime environment, you may want to opt for the older but stable version, if 1.1.8-compliance with the system classes (java.* packages) is sufficient.

The best thing is that, like Jeode, CrEme doesn't need to be hacked - if you just add tools.jar (the jar file that contains the classes needed for compilation, starting with sun.tools.javac.Main.main) and rt.jar to the compile-time classpath, everything will be fine.

The script to call CrEme installed into main memory:

255#"\Windows\creme\bin\CrEme.exe" -Ob -classpath \SD-MMCard\jars\tools.jar;\SD-MMCard\jars\ipaqide.jar;\SD-MMCard\jars\rt.jar ipaqide.Javacw2

And, a storage card-based installation:

255#"\SD-MMCard\creme\bin\CrEme.exe" -Ob -classpath \SD-MMCard\jars\tools.jar;\SD-MMCard\jars\ipaqide.jar;\SD-MMCard\jars\rt.jar ipaqide.Javacw2

Some problems concerning running non-CDC (4.00beta; with 3.26, non-Personal Java) compliant Java programs:

- additional classes contained by Java when compared to the CDC 1.0/JDK1.3.1 supported by CrEme 4.0 (Personal Java/JDK 1.1.8 supported by 3.26) the are found and used in rt.jar (for example, the java.lang.StringBuilder in 1.5). Running these programs require no additional hacks.

- old, but updated classes (for example, the new getRemoteSocketAddress() method in java.net.Socket) in rt.jar are, however, shadowed by the system library. I have played around a lot with hacking \Windows\CrEme\lib\VMclasses.zip by overwriting first the java.*, then also the sun.* packages; without success (other people having more free time, however, may have more success at this.). This means, at present, I don't know any way to run Java programs depending on system classes that have additional methods compared to the CDC 1.0 specification. That is, you won't run be able programs that use, say, the above-mentioned java.net.Socket.getRemoteSocketAddress(). You'll need to modify (reimplement the same functionality using older constructs / methods) and then, recompile these classes to be CDC- and, therefore, CrEme compliant. Then, incidentally, they will also become IBM J9-compliant, so, you may want to opt for using the free J9 instead of the commercial CrEme.

Compile-time 1.4/1.5-compliance:
Unfortunately, much as Creme doesn't report the same error than Jeode with JDK1.4/1.5 (that is, it's at least able to run Java programs using even the latest Java versions), it's unable to compile because of sun.tools.javac.Main's being deprecated. (The above-linked thread in the Sun discussion board discusses this problem too, along with a lot of other articles/threads; now, there is no standardized way of compilation.)

Other differences between CrEme and Jeode (why would you want to choose one over the other etc):

- the text editor/any text output in CrEme is much worse/slower and is low-res on VGA devices

- CrEme can be far faster at compiling than Jeode - the speed difference can even be tenfold. For example, Jeode compiled a simple Hello World program in 28 seconds, while CrEme 4.00b in one.

- CrEme is available for download/purchase, unlike Jeode.

- it displays the main menu bar, unlike Jeode. It offers little, though; all that functionality is accessible through the buttons as well. BTW, the Compile/Options doesn't work - it's just not "wired in" in the application, so, it's futile to try to make it work.

- its GUI is far worse-looking than that of Jeode (especially the source editor), though.
 
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:40 AM.