Java (OpenJDK)

Forum thread started by ti.teg.tnod.I on Tue, 2011-04-12 15:10

So I've been following the progress of Haiku for about a year and a half now. I've been intending to develop a lot of user-friendly software for Haiku (probably mostly in Python). I wrote a basic repository for my own needs while I was using Haiku so I could re-install Haiku constantly (Almost every night). The only thing that kept me (and is still keeping me) from using Haiku is the lack of Java support.

For me to properly develop for Haiku I would like to immerse myself in the environment by using it as my primary OS. The latest bit of information about the OpenJDK port is here. Has there been any progress since then? It's literally the only thing keeping me from Haiku. I'm fine porting small things like the wireless drivers I require, graphics drivers, etc (Well I'm getting a new laptop with an ATI card and that might be a bitch...).

I'm just wondering: Is anyone working on the OpenJDK port anymore? If so, fantastic! If not, I could probably find a bit of time to port some code and help out, I just don't understand why the OpenJDK port isn't more active. It'll help increase the userbase and pull in more developers.

Haiku is the only OS birthd from the death of BeOS I see left standing, I would love to see it pick up a little more. I think this could easilly be my all-time favourite OS, please offer me some insight, I find the information for Haiku to be painfully disorganized (I think I'll organize it myself ... It's honestly only the lack of Java holding me back from Haiku)

Cheers,
ti.teg.tnod.I

P.S. Another thing I've been wondering: Is Haiku planning on dropping the BeOS backwards compatability? If so, when?

Comments

Re: Java (OpenJDK)

Update on Java port requires contacting one of the developers working on it. I think it stopped or stalled but can't say for sure. You need to email the programmer directly.

I think they added a newer ATI driver to Haiku for Radeon HD cards which may work for you.

Not many people use Java. I don't. Neither do the people I know. I imagine very few people use Java and only for a couple of programs. I believe it would bring very few end users to Haiku and don't believe worth the time or effort. Qt & SDL give Haiku lots of apps & games to play with.

For development to pick up in Haiku would require getting to R1 or late Beta sooner. That's when it'll catch the interest of more people and will be seen as more serious.

BeOS compatibility will be dropped in R3 (or even R2). Depends on the application situation. I think Haiku will have enough apps available that they could drop the compatibility in R2. Some want to drop it now but not likely to happen.

Re: Java (OpenJDK)

Thanks for the info! You see I'm usually hooked on a Java game (Such as Runescape or Minecraft), and it's usualy what I do to unwind. In fact, the only reason anyone I know can provide for not using Haiku is the lack of Java support.

Maybe I'll install Haiku on a box and play with it some more.

Re: Java (OpenJDK)

ti.teg.tnod.I wrote:

Thanks for the info! You see I'm usually hooked on a Java game (Such as Runescape or Minecraft), and it's usualy what I do to unwind. In fact, the only reason anyone I know can provide for not using Haiku is the lack of Java support.

Maybe I'll install Haiku on a box and play with it some more.

Maybe port the game to another language.

Re: Java (OpenJDK)

BeOS compatibility won't be dropped that soon. With R2 the aim is to introduce new APIs for GCC4 only, and leave the GCC2 API in place for compatibility. This will allow us to rethink/redesign a lot of things, and correct API failures without sacrificing compatibility.

The GCC2 API will probably be maintained a while, and eventually be moved out to an optional package before it will no longer be supported. But that's far in the future anyway, AFAIR we're still busy getting R1 out of the door :-)

Re: Java (OpenJDK)

ti.teg.tnod.I wrote:

Thanks for the info! You see I'm usually hooked on a Java game (Such as Runescape or Minecraft), and it's usualy what I do to unwind. In fact, the only reason anyone I know can provide for not using Haiku is the lack of Java support.

You can always switch to a browser based game that uses HTML + Javascript. I've played Ikariam from Gameforge on Haiku. Ikariam is little slow and best played when they first introduce new world. Gameforge has other games which may work with web browser but I haven't tested any of them. I think their other games will work too since Ikariam does but cannot say for sure.

http://us.gameforge.com/browser-games

Haiku is more for developers right now. For end users, Haiku is a 2nd or 3rd OS until it gets to late Beta or R1. Good for playing around with.

Re: Java (OpenJDK)

I am also interested in Haiku and maybe one day using it with (mostly server-side) java and tools like Eclipse. Will also keep an eye out!

Re: Java (OpenJDK)

My personal opinion is that languages like Java,.net etc. they all just need to die and the sooner the better. Just like Flash must die.

Re: Java (OpenJDK)

You may be taking about something specific, but java is a very popular choice for business server-side software engineering so I doubt it is going anywhere soon.

Re: Java (OpenJDK)

Seriously thatguy, when someone asks about and is interested in OpenJDK it's not nice at all to spew out this kind of opinion. Encouragement and support would be much more welcome. Please try to respect and value others point of view.

Btw, I'd work on the java port if I had time and my todo-list wasn't very long already.

Re: Java (OpenJDK)

I don't understand this hate for JAVA: I think is a very beautiful language (a lot better of C/C++ for its a lack of pionters, garbage collection, biggest API): the write once run everywhere thing is HUGE!

I think it should merited more success it had.

The confront with Flash is absurd JAVA is real programming language and it is open source, too...

So, I think Haiku should have this language, too...

Re: Java (OpenJDK)

tqh wrote:

Seriously thatguy, when someone asks about and is interested in OpenJDK it's not nice at all to spew out this kind of opinion. Encouragement and support would be much more welcome. Please try to respect and value others point of view.

Btw, I'd work on the java port if I had time and my todo-list wasn't very long already.

Whats wrong with c/c++ ? the java interpretters are written in c/c++. My biggest beef is the performance overhead of these languages. Java while better then .net still comes with a heavy performance penalty for anything that requires heavy lifting. Its works great for net applications however.

I remeber Java applets, they where horriable, I have used java applications, also horriable performance. Much like I have watched my machine overhead jump dramatically with alot of commercial apps that have moved to .net. Which is insane in reality. I know microcsofts motiviation is to drive the hardware market so they keep adding heavy features to push the upgrade cycle, anyone who denys this is crazy. Java just never really took off but for similar reasons. Its been great on the web though with its run anywhere type capability and html5 embraces javascript with the canvas functions.

Java was a technology looking for a application. At this point mono and .net are taking its place.The only people using it are server operators becuase it offers a short development cycle. Performance isn't much of a concern with the compute power these clusters have.

Are there any apps that even run java as a language anymore in a desktop enviroment ? I know theres a bunch of server side stuff.

whats the benefit to haiku as a desktop system to have jdk ? Is the juice worth the squeeze ?

Re: Java (OpenJDK)

It just shows how little you know of Java and it's on the border of trolling when you state your personal opinion 'it should die', which has nothing to do with the subject. It just shows you rather express what 'you think' instead of helping the poster talking about Java.

It's also very stupid when many of the core Haiku developers work in Java or .Net in their daytime jobs so that they can spend their spare time working on Haiku.

Could we get back to talking about helping the original poster instead! All of the Haiku devs try to reach out and help newcomers, why not support Haiku and do the same!

My last post on this off-topic nonsense.

Re: Java (OpenJDK)

thatguy wrote:

Whats wrong with c/c++ ? the java interpretters are written in c/c++. My biggest beef is the performance overhead of these languages. Java while better then .net still comes with a heavy performance penalty for anything that requires heavy lifting. Its works great for net applications however.

The problem with C/C++ is they are not "safe" languages: that is for their low level nature you can referring pointer to not reachable memory (and it horribly crashes), bound of array is not checked (and it crash again or worst: undefined behavior), the lack of a real string type (at least in C, I'm not sure the string type is part of the official C++ standard), the GNU C API is error prone (in a lot of functions if you pass a NULL pointer it crash but man says it must set simply errno to EINVAL!)in all this case JAVA returns and exception (C++ maybe but can disabled... BeOS/Haiku seems not to use it, for example) stating clearly what error is... C/C++ crash and leave you alone with GDB :--)))

The other big problem is memory leaks using malloc() o new y ou can fogot to use the free() or delete before exiting from the function... Java use the garbage collector: no memory is lost.

thatguy wrote:

I remeber Java applets, they where horriable, I have used java applications, also horriable performance. Much like I have watched my machine overhead jump dramatically with alot of commercial apps that have moved to .net. Which is insane in reality.

I don't remember JAVA Applets to be too slow... maybe they take more time to start (remember JAVA is in reality a "virtual" computer and must "boot" to start your application) but when started no differences at least if your JVM use jit compilation and not interpretation...

The real problem of JAVA was the anti-concurrency policy of Microsoft that literally hired all Java developers... .NET in in reality a simple clone, but extended (remember the MS motto? "Embrace, extend, extinguish) of Java... as anyone can notate from that time JAVA not evolved much... as .NET done!
The ridiculous thing is that .NET use a virtual machine for not apparent reason as it can works only on Windows (and Windows works only on X86!)... Mono it is not at the level of JAVA on Linux it can't simply run a Windows GUI .NET application... give errors and not else!

thatguy wrote:

Java was a technology looking for a application. At this point mono and .net are taking its place.The only people using it are server operators becuase it offers a short development cycle. Performance isn't much of a concern with the compute power these clusters have.

Java is used in mobile phones (Android is a Linux kernel, in top of it runs a JVM, all Application targeting Android are written in Java not C/C++), Interactive TV uses a Java dialect too (MHP), if you want to write a trigger in Oracle database you can use Java instead of the ugly PL/SQL...

As JAVA is in reality a computer there a bunch of language that run on it, JPithon, JRuby... C too (yes you can use pointers and crash the whole JVM in Java if you wish):

http://en.wikipedia.org/wiki/List_of_JVM_languages

thatguy wrote:

Are there any apps that even run java as a language anymore in a desktop enviroment ? I know theres a bunch of server side stuff.

whats the benefit to haiku as a desktop system to have jdk ? Is the juice worth the squeeze ?

OpenOffice needs Java to be ported... simply for this Java is needed...
I think that more chooses of languages to use can encourage more developers to join haiku...

Re: Java (OpenJDK)

Not to mention that if Haiku devs could do their day time job in Haiku, Haiku would benefit a lot.

And Java applets are mostly slow because all UI interactions are done in a single thread, which leads to latencies, as events gets queued.

But what I am trying to say is that Haiku community should stay away of becoming an elitist community, instead keep on being an open, helpful and supportive one. Some of the comments in this and other threads really makes me fear that we are heading the wrong way if it continues like this.

Re: Java (OpenJDK)

thatguy you are right but come off too strong saying "it should die." Some people get use out of Java but I think Java is unimportant to majority of end users.

1) Haiku's goal is for home user. How many of them use Java applications in Windows or Linux?
2) Java is slow (compared to C & even C++). Lacks performance. Its claim to fame is being portable but you still need the JVM.
http://www.cherrystonesoftware.com/doc/AlgorithmicPerformance.pdf
With Java, one identical statement can turn into 7 instructions versus 3 for C++. One reason why you lose speed.
http://en.wikipedia.org/wiki/Comparison_of_Java_and_C%2B%2B#Performance
3) People today use Java for online gaming mostly. Online games are either Java, Flash, Ajax or Windows client.
4) What are popular Java applications that end users will use? Please list them for us. I can only think of online games like the poster mentioned. ie, I used a Java bittorrent client in 1999 and it ran horrible (hogged CPU + RAM). I then switched to a C++ one and the difference was night & day. From that time on I avoided Java like the plague and only used it a couple times when I had no other choice.
5) OpenOffice still mostly works without Java.
http://wiki.services.openoffice.org/wiki/Java_and_OpenOffice.org
6) Java should really only be used for applications were it makes sense (like online games). Otherwise better to use C or C++.
7) There's a reason why most OSes are developed in C or C++ language. ie, performance

Re: Java (OpenJDK)

Java is a brand name used for several distinct things. In order to have a coherent opinion it's important to know which of those things you're writing about.

The Java language is a standardised C-family member with lots of nice syntactic sugar for writing object-oriented code. You can write software in this language and compile to native code, or as pcode for a virtual machine. The most obvious choice of VM is the Java VM, but Dalvik is also a very likely choice.

The Java Virtual Machine is a stack based virtual machine which executes a standardised byte code. A conformant implementation includes a verifier which ensures that only legal (and thus "safe") byte code is executed. So the example of "crashing the whole VM" can't (shouldn't) happen. Verification ensures that all branches are valid, all references are type safe, visibility rules are obeyed etc.

The Java standard class libraries are roughly analogous to the C standard libraries. They aren't part of the language itself, but programmers of the language will usually rely upon having them (and in addition perhaps other application-specific libraries). Their interface is strictly standardised, but the implementation is usually (for some pieces) native code.

[There are several further things with the Java brand name which are less important or less relevant.]

So for example, in the Android system the Java language is used, and some elements of the Java standard libraries (together with Android-specific libraries of course), but the virtual machine is not used. Instead Android's Dalvik virtual machine is used instead.

Re: Java (OpenJDK)

I am wondering if there has been any talk of GCJ being ported to haiku? Since GCC4 work is already underway why not just port the GCJ frontend? it has support for about 90% of the the java api.

Also as far as all the java hate is concerned, Most of what you hate about java probably has nothing to do with the language itself, but the commercial implementations of it. Java isn't just applets and its unfair to compare it to flash. With java you can create lightweight daemons and command line utilities the same way you can in any other language.

Re: Java (OpenJDK)

xitiomet wrote:

I am wondering if there has been any talk of GCJ being ported to haiku? Since GCC4 work is already underway why not just port the GCJ frontend? it has support for about 90% of the the java api.

90%? Are you sure? I don't think it supports Java GUI application...

xitiomet wrote:

Also as far as all the java hate is concerned, Most of what you hate about java probably has nothing to do with the language itself, but the commercial implementations of it. Java isn't just applets and its unfair to compare it to flash. With java you can create lightweight daemons and command line utilities the same way you can in any other language.

Yes you can write a REAL OS application, too... that resembles native application of the OS in which is running (that is: in Win XP it is a "LUNA" application, in Mac OSX is "AQUA" and in Haiku is... whatever funky name we want to give it...)

Re: Java (OpenJDK)

I'd like to mention the availability of JamVM and GNU Classpath as a basic fallback for OpenJDK. It can run Jetty on Haiku for instance (but not Tomcat or GUI applications).

Re: Java (OpenJDK)

I mentioned in these groups several years ago that trying to port Java to Haiku was putting too much energy into something that wouldn't yield any great long-term benefits. Java may be good for enterprise back-end progrmming but it has a very poor track record for GUI app development. You can see now how this effort is treading water and will likely just fade away.

It makes far more common sense to have a complete Mono port. Someone ported monolite to Haiku about a year ago which was accepted into the main baseline. That's a good start.

Writing C++ programs are so error-prone over writing in C# were you can be at least one order of magnitude more productive in your app creation time plus you get a nice development environment with MonoDevelop for free with a full Mono port. You really do have to consider that C++ was the cutting edge when the BeOS came to market. That time is over. .Net apps can access so many powerful libraries in enough interoperable languages to please virtually anyone.

The core Haiku developers should wake up and realize this:

You will get more application developers targeting Haiku if you A) achieve a full Mono port and B) write a P/Invoke layer over the Haiku core C++ library set. Otherwise, I think all you have is a super nitched hacker's platform which can't attract enough mainstream developers.

P.S. A 2 gig blank virtual disk isn't enough space. This project should offer pre-made 10, 20 and 30 gig downloadable virtual drives. Putting the onus on "drive-by programmers" (such as myself) is a real turn-off. Make it easy and inviting to load up the Alpha release and add an extra drive that's roomy enough to try and port large pre-existing software packages onto.

Re: Java (OpenJDK)

I'm anything but not a java fan. It's true that c++ is not as productive as c# for example, but that's not that much because of c++. You must notice that c++0x has also a lot of features that java also has. I think in most cases c++ is not that productive because we dont have a good IDE. If you take a look at the toolkit "ultimate++", you will notice that with few c++ lines of code you can creat also a lot of things just using c++.

What i like even more than c++ is "d programming language" (version 2.0) , it's like c++ a system language but it has a lot of nice features that make programming much easier and safer.
I read a good part of the book written by Andrei Alexandrescu related to D programming. And I really love it. Alexandrescu is a very famous c++ guru which is/was praised by big names from the c++ area, but he is now actively working on the development of D, because he has a clear vision that D has a great future.

It may be true that Java/c# could bring a lot of programs, but at the moment i dont remember one single program written in java/c# that i would love to have on haiku.

I would like to have Calibre, which is written mostly in python.

Re: Java (OpenJDK)

I was going to resist, but I have to put my 2.04 (adjusted for inflation) cents in. I am a professional software engineer (have been since the early 90s).

Anybody claiming language a is better than language b probably shouldn't be making any claims :) Every language (even java :) ) has its pros and cons. C# may allow rapid prototyping, but is horrid in performance/resource usage and bug tracing. Wrap in native code and you have a disaster. I know this from first hand knowledge as I had to try to fix a project that ported a working C++ app to C# and has gone horribly wrong. It is not that C# is bad, just that it was totally the wrong solution. Now before all the MS guys jump on me, I'll say again that C# has its place - in rapid prototyping and non performance/system related projects. It is great for rapidly trying guis for example.

C++ is much harder to write the same functionality, however it is *much* more robust, significantly faster, and has a smaller footprint. C is even faster/smaller, but at an even longer (read harder) development, because even less is done for you.

Haiku, for me, is all about fast apps with sensible preferences. Compare BeZilla and WebPositive. One native, one ported. The ported one has far more functionality, but is slow and cumbersome in comparison. Java/python/mono etc. would add the ability to run other apps on haiku, however you might as well just use linux, or even worse MS :)

I'd personally prefer to have the OS working 100% rather than a plethora of pretty python/java/mono based config apps which slow the system down. After R1, then sure, lets add more toys.

Last little example - lets build a racing car. We could design it, get every part custom made and individually assembled. Takes a long time, but goes like the clappers. Alternatively, we could pick standard component from a "library" and have a car up and running in no time. Wheels from a mazda, chassis of a range rover, body of a beetle, engine from a ford, gearbox from a merc. I know which I would like to drive :)

Cheers,
Vader
PS. sorry about the long rant.......

Re: Java (OpenJDK)

Long rant, but good rant.

I can't speak for the Haiku team, but it seems they're in the throes of getting out the MVP to rapidly iterate on the road to beta. I don't think anybody is saying Haiku needs to write parts of the core OS in [insert non-C language here], which is silly.

Language bindings and separate runtimes create a few more avenues for developing applications. Should somebody come along and write a better app with (well written) C, C++, Ada, Haskell or assembly, even better! Nonetheless, the main API is still C++, and unless somebody comes along and does a darn good port of the (terrrrrrible) Swing libraries for Java, or the GSoC language bindings port for Perl or Python pans out, the only way to make quality apps that take advantage of the Haiku frameworks and UI will continue to be C++. That won't change, unless the developers decide to go API wrapper-crazy. :)

Though this is an interesting discussion, it takes away from the focus of getting to R1. If the developer who started this topic wants to attempt to work on a port of OpenJDK, I don't see any reason to turn them down. Not because I want to see JVM or even the C# CLR on Haiku right now; if it's a project they'd personally love to work on, hack away!

However, Haiku's #1 priority right now is _shipping_, in a stable state. As fun as it is to talk about new features, if this isn't someone's labor of love that won't get in the way of R1, or a GSoC project, Alpha 3's on the horizon, and there's going to be a series of beta releases before Haiku's ready for everyday usage.

The best contribution any dev can make right now would be to make _sure_ Haiku's foundations are solid. Depending on how my work schedule looks after June, I'll see if I can knock off a few low hanging fruits and lend a hand.

Re: Java (OpenJDK)

Looks like Andrew made a commit to the openjdk repository back in March, so he is still working on it. I would contact him directly. He's a great guy ... helped me and others with the original Java port to BeOS way way way back when.

http://mail.openjdk.java.net/pipermail/haiku-port-dev/2011-March/000085....

Re: Java (OpenJDK)

Wholeheartedly agree. Let's get the stuff that BeOS was going to deliver done right. We're not in a race except to stay relevant. I'm not sure adding Java now will help the relevancy thing, except last I checked it was the most widely used programming language in the world : nothing to sneeze at.

Furthermore, as someone who has an interest in dynamic and functional languages, many of the more compelling implementations that develop rapidly are hosted in the JVM. While many folks here rightfully gripe at Java, the JVM is one of the most compelling places where new languages and features are going right now. The JVM is very, very fast, too. It can allocate memory about 10x faster than C/C++ can with new and delete. You could beat the JVM with your own implementation of memory management in C/C++, but right out of the gate the JVM can beat C++ on many fronts speedwise. It cannot, however, support the kind optimization you can do in C/C++, but getting there is another matter.

Java may be dead, but the JVM is here to stay. It might help Haiku to have a JVM.

Re: Java (OpenJDK)

I know exactly how you feel ti.teg.tnod.I
I've been following the development of Haiku from the beginning with my retail BeOS3-box on my desk :)

The only thing missing for me is also Java (JDK, OpenJDK) so i can try to start doing my normal daily stuff on Haiku (Yes, java development, but java is very much alive - but not on the desktop, with eclipse and netbeans as an exception). So discussing here about "java is bad, good etc.." is not relevant, since the development is not for Haiku, but on Haiku.

The discussion here about Java is more like someone requesting a port of 'The Gimp' and saying he may not use it because there is already 'wonder brush' so he must start learning that instead of using his own old tools.

Re: Java (OpenJDK)

I asked Andrew Bachman about the JDK port:

There are still some hangups to getting the first bootstrap build
going. It would be really helpful if someone could figure out the
issues between haiku and gcc such that gcc could be built with the
java support, so we could use it for bootstrapping.

Andrew

So the first hangup seems to be getting OpenJDK to correctly build on Haiku with GCC. But GCC is newer now, so would someone like to get it compiled?

Re: Java (OpenJDK)

As someone who has worked with, and who continues to work with C, C++, C# and Java, I question the claim that managed languages are slower.

The Hotspot JVM is a compiler. Like every compiler, it has strengths and weaknesses. 100 million JPEG inverse DCTs take 8.5 seconds in optimized GCC, but 18.5 seconds in Java, because GCC makes heavy use of SIMD, while Hotspot currently uses SSE registers only for one value at a time. By comparison, I've seen an audio codec, ported from C to Java, be 3-4 times faster in Java, because Hotspot is brilliant at method inlining and it does inter-procedural optimizations that most C compilers still do not do. Also JVMs can do biased locking, adaptive spinning, escape analysis, and other things that AOT copilers with their statically generated code cannot.

LLVM might be able to eventually bring some of those optimizations to JITed C/C++, but they have it much harder, since pointers make correct compiler optimizations very hard. And just like writing C turned out to mostly outperform hand-written assembly, higher level languages will eventually outperform C - and already are getting competitive.

As for the alleged lack of applications in Java someone mentioned, uhm, it is only the leading language on Sourceforge.

By excluding Java from Haiku, you're not just excluding significant applications and developers, but an entire platform, something a small project really shouldn't be doing.

Re: Java (OpenJDK)

Its a sucky platform :P while execution speed may be comparable for longer running programs java programs lack the responsivness and lightweightness due to the requirement of a usually heavy VM and especially heavy in the case of OpenJDK VM.

That aside who really cares as long as it says merely optional and I am sure it will. Java isn't so bad for some things I actually used it in a digital signal processing class recently oddly enough and it was much better than Matlab for our use case.

I will say one thing though Java is alot more fun if you have a decent autocompleting IDE...and if you are doing graphical programs a layout system like netbeans.

Re: Java (OpenJDK)

Mega-LOL: MATLAB makes heavy use of Java internally :-).