OpenJDK port: final report

Blog post by hamish on Sun, 2012-08-26 23:43

Since my three-quarter term report I've been working on adding audio input support to the jsound port and fixing various bugs in the JDK. Since the AWT/Java2d and jsound ports are now completed, my goals for the summer have been accomplished! The OpenJDK port is now in a fairly usable state, and community members have been using it to run some large scale Swing apps such as NetBeans and ThinkFree office.

The next thing I would like to do is merge my work in to the Haiku port repository at the OpenJDK project. From there I'd like to look into the possibility of acquiring access to the Java TCK, which will allow for comprehensive testing of the port. This will no doubt uncover many bugs and keep me busy for a while. Here are some other possible areas of expansion for the future:

  • An x86-64 Hotspot port to go along with our brand new x86-64 Haiku port.
  • A native Haiku look and feel for Swing.
  • Merge in updates from the jdk7u branch (the codebase of the Haiku port is more than a year old now).

Further development of the Haiku OpenJDK port will be going on here: Anyone interested in contributing is more than welcome.

Finally, I would like to thank my mentor Andrew Bachmann, the Haiku developers, and the rest of the Haiku community for all their help and for all the bug reports. This has been a very rewarding and educational experience. :-)

Recent-ish binaries available here - hrev44492 or newer required.


Re: OpenJDK port: final report

Thank you for your work!
It was very interesting to test various software with your port.

Re: OpenJDK port: final report

Thanks for the work on this; it is appreciated.

Re: OpenJDK port: final report

Awesome. This is a feature that Haiku needed.

Re: OpenJDK port: final report

I'm absolutely fascinated on how far this has gone, i.e. real applications being able to run. For me this is far beyond expectation and I just hope your experience has been as rewarding for you as your results will be for Haiku.
Great to see that you've gone into creating the interfaces for audio - important for Haiku which still carries the "Media OS" tag.
Many, many thank's for the effort and skill you've put into this.

And, yes this should not be forgotten - thank you Google for funding this. Don't know of any company who devised anything near GSoC and if so, would actually support an alternative OS if they themselves are in the OS business.

Re: OpenJDK port: final report

CongratsHamish, you've done and are doing a great service to Haiku! I just got a new wifi card for my laptop so my Haiku experience is improving. Let me know if you need me to take a look at your work. In any case, enjoy yourself!

Also anyone else interested in contributing to OpenJDK, now is a great time....

-Andrew Bachmann

Re: OpenJDK port: final report

Thanks for the great work Hamish, you've added lots of useful applications to Haiku's repertoire with your successful GSOC project.

Re: OpenJDK port: final report

Thank you so much! this is amazing, I can't wait to start testing my java apps on haiku. Regarding the future of haiku what is the chance this will just be included in the next alpha?

Re: OpenJDK port: final report

Great work! For a summer project this is really amazing.

In my younger years, i delivered newspapers in my summer vacation ;)
I could only wish for such a great opportunity back then...

Re: OpenJDK port: final report

First, let me say thank you for your great work! This is indeed an amazing piece of work.

I'm definitely interested in contributing.

I've cross compiled (gcc4) and deployed on VirtualBox the latest Haiku Nightly for both 32 and 64 bits and I was not able to get your openjdk running. Java fails and request to debug it. I'll can post the gdb backtrace in here if you think it will help.

Still, I simplythink that I might be doing something wrong.

Here's what I did:

- Expanded your package to /boot/apps
- set java env vars on .bash_profile:

export JAVA_HOME=/boot/apps/j2sdk-image/jre
export PATH=$PATH:/boot/apps/j2sdk-image/jre/bin
export LIBRARY_PATH=/boot/apps/j2sdk-image/jre/lib/i386/:$LIBRARY_PATH

I've also tried to build it from haikuports, but so far to no avail.

Is there something that I'm missing? Could you please paste the necessary steps?

Re: OpenJDK port: final report

I haven't tested it on the latest nightly, but I can't imagine any of the recent changes would have broken OpenJDK. Can you post the backtrace?

Re: OpenJDK port: final report

Hello, why don't you use JAVA_HOME while you set it?
PATH and LIBRARY_PATH shuold be like $JAVA_HOME/bin and $JAVA_HOME/lib.


Re: OpenJDK port: final report

Hamish, thanks for the follow up.

Here's the backtrace for the execution of 'java':

#0  0x00648d93 in os::init_system_properties_values ()
   from /boot/home/dev/jdk-images/j2sdk-image/jre/lib/i386/client/
#1  0x003663c1 in Arguments::init_system_properties ()
   from /boot/home/dev/jdk-images/j2sdk-image/jre/lib/i386/client/
#2  0x006ff98a in Threads::create_vm ()
   from /boot/home/dev/jdk-images/j2sdk-image/jre/lib/i386/client/
#3  0x00567b73 in JNI_CreateJavaVM ()
   from /boot/home/dev/jdk-images/j2sdk-image/jre/lib/i386/client/
#4  0x00204dc0 in JavaMain ()
   from /boot/home/dev/jdk-images/j2sdk-image/jre/lib/i386/jli/
#5  0x002522c0 in _ZL20pthread_thread_entryPvS_ ()
   from /boot/system/lib/
#6  0x70053fec in ?? ()
(gdb) continue
haiku_remove_debug_event(): event 0x1845fa80 not found in list 0x4849a0

Is it possible to explain the steps on how to build a new j2sdk-image?

Re: OpenJDK port: final report

I've tested it on the latest nightly, hrevr1alpha4-44631 gcc2h, and I don't get this crash. I assume the cause is a segfault? Which hrev and GCC versions are you running? Could you try running it with LIBRARY_PATH set back to its default value?

Building a new j2sdk-image requires an existing working OpenJDK build. The steps for doing a build are probably best described in the bep on Haiku ports: That looks complete to me, but you may need to work around a few things.

Re: OpenJDK port: final report


Thanks for your prompt response.

I've cross-compiled my own nightly build from revision 43238. I've created this one two days ago or so.
I'm using gcc4.

I just updated checked Haiku's repository revision and confirms that I'm using the latest (or so I think):

:~/dev/haiku/develop/haiku$ svn update trunk/
At revision 43238.

Which seems to differ from yours!

Those are exactly the steps that I've been using. Exactly from that same file. With the slight change that I'm using the repository from as opposed to the one you have at Altova's bitbucket.

In these same steps, one of the first requirements is it to build Ant, which in turn requires the existing OpenJDK image. The one I have is the one you have provided in this post from August and the problem that I'm having is that the java/javac will simply fail to execute. So, I'm in this chicken/egg kind of situation.

Is there a boostrap for this? How can I build an executable javac before I get to run the full build on ant?

Re: OpenJDK port: final report

Ooopss, just realized that Haiku has been moved into a Git Repository for quite some time now!

And you are correct... the latest version is 44693!

I'll give that a try.

Re: OpenJDK port: final report

EDIT: Oops, didn't see your latest post. Yes, that should hopefully solve your problem.

Cross-compiled from which branch, alpha4 or master? Alpha4 is the only one getting tested in the nightlies at the moment, so it's possible master might have issues.

I downloaded the most recent GCC4 nightly, r44584, and was unable to reproduce your crash. When you cross-compiled from r43238 did you use the version of GCC4 already present on the system or did you build your own buildtools? Our GCC4 version has changed since r43238 and I think there may have been an issue with the wrong version of libstdc++ getting copied into the built image.

If you really want to try bootstrapping OpenJDK, you can use JamVM, Classpath and the E