My thoughts on Slackware, life and everything

OpenJDK replacing Oracle’s binaries

I already wrote about it in an earlier post, that I was working on packages for OpenJDK. OpenJDK is an open-source implementation of the Java Platform, Standard Edition. In 2007, Sun delivered to its earlier promise to make Java open source and released the bulk of its code under a GPL license. Since then, high-profile companies like IBM and Apple have done major contributions to the OpenJDK codebase in order to create an industrial-strength alternative to the binary releases of Java SE..

Oracle assimilated Sun in 2010 and obtained the rights to Java SE.

For Linux distros, not much changed because binary releases of the JDK and JRE were still made available for re-distribution. In 2011 however, Oracle decided that new binary releases of its Java SE (the runtime or JRE as well as the SDK) may no longer be included with Linux distros. They retired the “Operating System Distributor License for Java” (DLJ) and decided that distros should compile their own packages using the Open Source codebase of OpenJDK,.which Oracle itself uses as well for their binary builds.

Of course, you as an “individual user of Java SE” still have the legal right to download and use Oracle’s binaries – you’re just not allowed to re-distribute it. Making a Slackware package out of your Oracle-downloaded binaries is simple – use the jdk.SlackBuild or jre.SlackBuild scripts which are part of Slackware and “wrap” those binaries into a convenient package.

While this is a nice solution for the individual, our own Slackware had to stop updating its Java packages. It now has to solve the question of keeping or removing Java from its distribution. Since Oracle’s binaries can no longer be included, Slackware has to follow the advice and build its own Java from source.

This situation now lasts since august 2011 and it is bothering me. So, in November 2011 I made a promise to Pat Volkerding that I would create a set of Slackware packages for the OpenJDK. Unfortunately that took me longer than expected because a lack of time and because (as outlined in my previous post) I wanted to build them in such a way that I could use the SlackBuild scripts on ARMedslack which still lacks a Java package.

I uploaded the results of my efforts last week but Pat has not responded since, so I am making the packages and sources/scriptes available to a wider audience. Please note that I named the resulting packages “openjdk” and “openjre” but the packages that could get included into Slackware eventually may be named differently (like “openjdk-jdk” and “openjdk-jre”). In any case, I invite you to test them and report your findings.

You can get all of it here: http://connie.slackware.com/~alien/openjdk/ with a mirror here: http://alien.slackbook.org/slackware/openjdk/

For ready-made packages (for Slackware-current !) you can check the two directories “pkg64” (containing 64bit versions) and “pkg” (for the 32bit version of Slackware).  If you want to install my pre-built packages, then all you really need are “rhino” which is the JavaScript engine, “icedtea-web” which is the browser plugin, and one of “openjdk” or “openjre” packages, depending of course on whether you need the full Java compiler suite or only the Java Runtime Environment.

You will also find packages for apache-ant, xalan and xerces.  These are only needed if you want to re-compile OpenJDK yourself. If you want to build your own packages instead of using (or after installing) mine, then follow the instructions in the sources/README.txt file. If you are not running Slackware-current but one of the stable releases, then compiling from source will be your only option.

For you wannabe-compilers, I will repeat part of that README text here. OpenJDK will not compile successfully on Slackware unless you make some modifications to the gcc and seamonkey packages. You can either recompile those using the modified SlackBuild scripts and sources which I also provided in the openjdk sources tree, but you can also choose the less intrusive alternative by running (as root !) two small shell scripts that add the missing functionality to your system: create_gcj_jvm.sh and fix_seamonkey_pkgconfig.sh. These two scripts should work on every Slackware release.

After running the two shell scripts (or after rebuilding gcc and seamonkey) you are ready to (build and) install apache-ant, xalan, xerces and rhino, logout and log back in again to set the ANT_HOME environment variable, and proceed with building OpenJDK and icedtea-web. Good luck!

Any questions or feedback about these scripts and packages? Please post them here and I will follow up.

Cheers, Eric

42 Comments

  1. Daniel

    probably a stupid question…but, do i need to remove the existing JRE package first?

  2. alienbob

    Slackware’s upgradepkg is able to upgrade to a package with a different name.
    For instance, if you are on 32bit Slackware and downloaded the openjre package, you would run:

    # upgradepkg jre%openjre-7_b147-i486-1.txz

    Eric

  3. Mikko

    Any experience on Android SDK and openjdk?

    Officially Android SDK does not support it, as far as I know.

  4. John

    Hey Eric
    I have been compiling your LibreOffice packages for some time now. You probably remember some of the humps you helped me over.
    Would you suggest to re-compile LibreOffice after compiling the JDK as some of it depends on the JDK?
    Special thanks on the section for “For you wannabe-compilers,” as I am sure I will need it.

    Thanks
    john
    AlleyTrotter

  5. Martinus Ady H

    Thx Eric, 🙂 Love this package 😀 Btw why Slackware not including *update-alternatives* app like ubuntu/debian based ? With this, we can switch easily from jdk to openjdk 🙂

  6. alienbob

    Hi Martinus

    Slackware does not always do things the way other distros do it. Introducing the “alternatives” program would make many SlackBuild scripts a whole lot more complex.

    Instead, Slackware’s package manager does not know about dependencies, so “upgradepkg openjre%jre-6u27-x86_64-1.txz” works fast and with the same end result as running the update-alternatives command…

    Eric

  7. manciuleas

    Hi Eric,
    Thanks for the package. Unfortunately it seems not functional, jvf.cfg and and java.policy are missing from /etc/java and therefore the binary returns an error when I’m trying to run it:
    Error: could not open /usr/lib64/java/lib/amd64/jvm.cfg’

  8. manciuleas

    Hi Eric,
    Thanks for the package. Unfortunately it seems not functional, jvm.cfg and and java.policy are missing from /etc/java and therefore the binary returns an error when I’m trying to run it:
    Error: could not open /usr/lib64/java/lib/amd64/jvm.cfg’

  9. amigib

    @manciuleas

    Those missing files are in openjdk package.

  10. powtrix

    Hi Eric.
    testing with http://javatester.org/version.html it says in Firefox “Browser has Java disabled” and in Chrome it says that the plugin is missing. Should I link it manually?

  11. alienbob

    amigib, manciuleas –

    Amigib is right. I will have to fix up my openjre package and add the missing .cfg files. Hope to find the time somewhere later this week.

    In the meantime, install openjdk as a workaround.

    Eric

  12. alienbob

    @powtrix –

    You did install the icedtea-web package did you? What version/architecture of Slackware are you running?

    Eric

  13. powtrix

    oops, icedtea is the needed package, solved.
    I’m running slackware64-current.
    thanks!

  14. escaflown

    openjre working well here so far. Thanks Eric!

  15. bratpit

    Hi

    I have problem with run java jnlp file /link below/ on default 6u24 .
    Permission error but run it from root causing the same error permission ??????

    S? I install your openjre and……

    javaws http://makler.bmbgz.pl/sidoma8inter/sidoma_kl.jnlp

    returns error .”could not parse jnlp file”.

    It is bad because on Centos on VM it runs like charm. Any ideas?

    Best regards

  16. alienbob

    Well, what does your CentOS use? Oracle JRE or OpenJRE? A question like yours can not really be answered since I do not run CentOS anywhere.
    Also you should consider that the open source web plugin “icedtea-web” is not based at all on the plugin code from Sun because that was not open-sourced. Instead iceddtea-web is based on an earlier open-source effort, the NetX project: http://jnlp.sourceforge.net/netx/ . Their JNLP parser is not as mature as Sun’s. I found web pages too where the Icedtea-web plugin would throw a parser error.

    You may tell me how to fix my SlackBuild so that the resulting package works like CentOS.

    Eric

  17. bratpit

    Thank you for response.

    I use Slackware 13.27.
    And Suns jre from ages 🙂
    Java instalation works OK in browser plugin but lately my broker give me start aplication over jnlp file, and Slackware instalation failed to run that way.I checked on various sun java 1.5 and 1.6. And on slack based distribution Salix.
    Always the same error.”Can not run /usr/lib/java”

    And finally broker email me and send picture from Centos.
    I instaled it on virtual machine and aplication from the same jnlp runs like hell on the same Sun java.
    On Centos Java installs from rpm and simply copy files from rpm to /usr/java/java_ver/ and then symlink java and javaws to /usr/bin and works .

    Next I instaled Openjre from your package but it not worked like I wrote before.

    Thats all.There is some bug.

    I’ll try extract from Sun’s rpm and do package for Slackware by hand like in rpm .May be it will start working.

    Thanks again.

  18. amigib

    I discovered another problem. When i tried install/update Minecraft game i get error like:

    java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

    I found solution here
    http://stackoverflow.com/questions/4764611/java-security-invalidalgorithmparameterexception-the-trustanchors-parameter-mus

    Just copied ‘cacerts’ file from windows to linux, but i’m wondering why this file on linux is empty.

  19. alienbob

    FYI,

    BratPit documented the solution to the problem he described in his above comment, here:

    http://www.linuxquestions.org/questions/slackware-14/sun-java-not-run-some-jnlp-file-923587/#post4573790

    The JRE package sets a wrong JAVA_HOME environment variable.

    Eric

  20. alienbob

    Hi Amigib

    You mean, Minecraft works for you now? I will have a look at how to deal with the cacerts file.
    Thanks,

    Eric

  21. alienbob

    Amigb,

    Initially I was unable to run Minecraft because it reported a library issue, but I tried some more and I found that I can successfully run it when I add “LD_LIBRARY_PATH=/usr/lib64/java/jre/lib/amd64” to the commandline.

    I wonder, how do you start?

    Eric

  22. amigib

    It was working earlier, problem appear when i tried update game to 1.1 and it was related with cacerts file.

    I’m not playing in browser and using standard commands:

    java -jar minecraft.jar

  23. alienbob

    I created a wrapper script that I put in /usr/bin/minecraft , this is what it contains – Minecraft runs perfectly:

    #!/bin/sh

    # A wrapper script to start MineCraft.
    # It should work with the Sun JRE/JDK as well as with the OpenJRE/JDK.

    # If your computer has less than 2 GB of RAM you may have to set
    # a lower value here (value is in MB):
    MAXMEM=1024

    # Fix for users of special IM modules
    unset XMODIFIERS GTK_IM_MODULE QT_IM_MODULE

    LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:$JAVA_HOME/lib/amd64/:$JAVA_HOME/lib/i386/:$JAVA_HOME/jre/lib/amd64/:$JAVA_HOME/jre/lib/i386/” exec java -Xmx${MAXMEM}M -Xms$(($MAXMEM/2))M -cp /usr/share/minecraft/minecraft.jar net.minecraft.LauncherFrame “$@”

  24. moldavia

    I’m upgrading to openJDK just because I was getting random lockups trying to run Minecraft on Slack-current. I was happy to find some Minecraft specific info here. I am having a different problem now. It seems to be a path related problem. When trying to run using my script, or the one you posted here, the launcher will show, but when I try to log in, I get a UnsatisifiedLinkError.

    Exception in thread “Minecraft main thread” java.lang.UnsatisfiedLinkError: /home/moldavia/.minecraft/bin/natives/liblwjgl.so: libjawt.so: cannot open shared object file: No such file or directory

    As far as I can tell, the paths are correct, and libjawt.so is in /usr/lib/java/jre/lib/i386…

    Any ideas?

  25. moldavia

    Never mind. I installed the Minecraft package you released, and now it runs without error. Thank you very much.

  26. alienbob

    I will be posting updated openjdk and openjre packages soon, which fix all kinds of issues.
    For instance, the java web start (javaws) will not work with just openjre installed; the openjre pakage misses two important configfiles which makes it unusable, and the CA certificates file is empty in both JDK and JRE packages…

    Eric

  27. dolphin77

    Hi, Erik.

    Thanks for you work on openjre|jdk.

    After installing your packages I have double entry to java bin files in $PATH. Is this mistake, or should it be like this?

    vladimir@darkstar:~$ cat /etc/profile.d/openjdk.sh
    #!/bin/sh
    export JAVA_HOME=/usr/lib64/java
    export MANPATH=”${MANPATH}:${JAVA_HOME}/man”
    export PATH=”${PATH}:${JAVA_HOME}/bin:${JAVA_HOME}/bin”

    vladimir@darkstar:~$ echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/kde4/libexec:/usr/lib64/java/bin:/usr/lib64/java/bin:/usr/lib64/qt/bin:/usr/share/texmf/bin:.

  28. alienbob

    Hm, looks like I was a bit sloppy in updating the profile scripts for the JRE package. It should be:

    export PATH=”${PATH}:${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin”

    for the JDK package, and

    export PATH=”${PATH}:${JAVA_HOME}/bin”

    for the JRE package. I’ll have to come up with a better sed command.

    Eric

  29. Ivan

    Hi Erik! I like your effort to bring OpenJDK framework to Slackware. But, I have some serious problems when running java programs with swing guis, to be precise Jmol and Toxtree, which are standard tools in mine research projects for years, and worked fine on Java VM from /extra. I’m running Slackware64-current, freshly installed maybe two weeks ago.

    Ivan

  30. alienbob

    Ivan

    Without commenting on the nature of your issues I can not really answer you. I know nothing of Jmol or Toxtree.
    Also, you can still use Oracle’s binary distribution of Java if you want. Using the SlackBuild script you can package any new release into a proper package. Distros are no longer allowed to distribute those binaries, but individual users can use it without restriction.

    Eric

  31. Ivan

    Sorry, I apologize, because my former post says nothing about real problem. The problems are swing gui elements, everything was disturbed, menu bar gone, and other program couldn’t load any images for tool palette… I’m really confused, because I cannot sense what’s the cause of the swing problems with OpenJDK. Maybe this snapshot of Jmol main window self explains: http://i44.tinypic.com/ib9wrl.jpg.

    Ivan

  32. alienbob

    Ivan

    I downloaded and ran Jmol on my laptop with OpenJDK installed.
    This is a screenshot of what I see: http://alien.slackbook.org/blog/openjdk-replacing-oracles-binaries/jmol_openjdk7/
    I do not seem to have issues with it. What version of Slackware are you using? What Window manager?

    Eric

  33. Ivan

    Now I’m confused even more… Yes, yours Jmol works perfectly! My installation is Slackware64-current, fresh and (still) clean copy, without multilib, only fewer extra packages, yours LibreOffice, VLC and OpenJDK and some academic packages from SlackBuilds.org, but nothing that can suggest that I messed some system library or have mixed versions. I’m using Xfce, but I tried under KDE a moment ago, and same problem was with gui. I’m not Java developer, but I know the language from my masters bioinformatics course, and I think that Swing classes was designed to be quite independent from OS-specific code, and relies on very basic graphics procedures. From that fact, I can only conclude that my problem is connected with some serious OpenJDK bug, but I have no idea why it manifests only on my system.

    Thank you for your time Erik, I really appreciate your work in Slackware community.

    Ivan

  34. alienbob

    I am running slackware64-current too, but with some newer packages than are available to the public. However I do not think that that is the reason it works for me.

    I changed one thing to the openjdk installation which made some other Java software work; and I intended to add it to my openjdk.SlackBuild

    Can you try the following command as root (using the “lib64” since you say you are running 64-bit Slackware)?

    ( cd /usr/lib64/java ; mkdir jre ; ln -s ../lib jre/lib ; ln -s ../bin jre/bin )

    And then check again if Jmol works for you.

    Eric

  35. Ivan

    When change directory to /usr/lib64/java there exists jre with lib and bin branches, so mkdir jre is unnecessary, and returns “mkdir: cannot create directory jre’: File exists”. Still, I have done linking with ln -s as you suggested, but nothing has changed then, Jmol still has stuck gui.

    Ivan

  36. alienbob

    OK, so you have installed the openjre package. Can you try installing the openjdk package instead and see if that works better?

    Eric

  37. Ivan

    OK, I have removed openjre and, for just in case, reinstalled openjdk, and now Jmol even cannot create main window. When started from terminal, Jmol returned many java exceptions to stderr… It is quite distracting problem, and probably has simple solution, but for now I’m not enough skilled to figure it out, I’ll leave it for tomorrow. 🙂

  38. donito

    Eric, I apologize for posting something off-topic but wasn’t sure where else to ask. I’ve noticed there haven’t been any updates to either current or stable for two months now, including security updates. Are you aware of any problems that Patrick is having? Maybe health related? It’s just not like him to go this long without any updates. I’m starting to fear the worst that maybe he has decided to move on. Any info would be helpful. And thanks again for all your contributions.

    Don

  39. alienbob

    I guess you do not surf the internet too often? I have explained on several occasions, in several forums, and in another blog post on my own site as well, that Pat needs time to tend to his family and other matters. In the meantime, I keep you busy with my KDE, OpenJDK, LibreOffice, VLC and other packages 🙂

    My most recent comment was http://www.linuxquestions.org/questions/slackware-14/new-distro-time-926188/page4.html#post4588775

    Eric

  40. donito

    Apparently we don’t surf the same websites. lol. I certainly don’t blame Patrick for wanting to take care of the important things in life. He definitely deserves a much needed break. Perhaps a small note in the changelog would have made it less confusing for a lot of us wondering what was going on. Thank you for clearing this up.

  41. Mário Antunes

    Hi I found out that the version of openJDK was a know bug (https://netbeans.org/bugzilla/show_bug.cgi?id=205348) that is resolved in newer version of openJDK.

    Is it possible to build new packages with the new version?

  42. alienbob

    Hi Mário

    I am already looking at a new package build, using icedtea 2.1 (my current openjdk package is based on icedtea 2.0).
    Who knows, I will have new packages soon, it depends on my family’s health (the rest of the family is ill and I hope I do not catvh whatever they have).

    Eric

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2024 Alien Pastures

Theme by Anders NorenUp ↑