Slashdot Mirror


Building the JDK on Debian GNU/Linux

Ivan Tarasov writes "Ever wanted to hack the JDK sources to get rid of some nasty bug which bothered you for so long, but was embarrassed by the complexity of the JDK build process? Now you have a good tutorial on how to do it on Debian GNU/Linux: last night I posted a blog entry on how to build the JDK 6 (sources of which are available at the Peabody site). This entry describes in detail which packages you need installed, how do you tweak the sources to make them buildable and how to proceed with the build. The build process for other Linux distributions must be very similar, so don't turn away if you don't use Debian. There is also a nice blog entry by Cay Horstmann "Honey, I built the JDK! (on Ubuntu)"."

21 of 27 comments (clear)

  1. That's all well and good, but ... by Jtoxification · · Score: 1

    When the code gets complex to a high degree, how can you ever be sure it's a bug in the JDK versus a bug in your code?

    --
    --I gots 99 problems but a new machine ain't one!
    AMD! Asus! Whoot! 6 years!
    1. Re:That's all well and good, but ... by Doctor+Memory · · Score: 3, Funny

      Well, duh. You've got the source, debug it!

      Kids these days...

      --
      Just junk food for thought...
    2. Re:That's all well and good, but ... by CastrTroy · · Score: 1

      And if it is a bug in the JDK, then submit a bug report to Sun, and get them to fix it, so you don't have to keep on patching all the future versions of the JDK you happen to want to use.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    3. Re:That's all well and good, but ... by Yuioup · · Score: 1

      Well, it's as easy as 1+1=3

    4. Re:That's all well and good, but ... by ximenes · · Score: 3, Funny

      I just hold the hard drive up to my ear to figure out JDK problems.

  2. Honestly? by zBoD · · Score: 4, Funny

    > "Ever wanted to hack the JDK sources to get rid of some nasty bug which bothered you for so long, but was embarrassed by the complexity of the JDK build process?"

    => no.

    --
    BoD
  3. GCJ by legoburner · · Score: 2, Interesting

    Just want to mention GCJ, the java native compiler, part of the GNU tools. It still has quite a way to go, but for some standalone applications it is getting quite nifty. I am not sure what niche it fills yet but linking a native binary built from java source code feels strange.

    1. Re:GCJ by Golthar · · Score: 1

      What about JSP's?

      Because the classes are generated at runtime, GCJ forces you to run these at interpreted speed and can't compare with the current hotspot VM's
      Any big webapplication would be doomed unless you precompile the whole thing into a .so (yuck?)
      The biggest advantage of using GCJ would probably be in the fact that you don't need to lug a whole JVM (which is around 10 Mb) for a simple application.

    2. Re:GCJ by kwark · · Score: 2, Informative

      Once I thought that using gcj might be fine for running cli java programs but I found that gcj had the following problems:
      -the ahead of time compiling requires ALL sources to be compiled even though they are not needed at runtime. eg commons-cli.jar depends on commons-lang.jar in gcj as opposed to use in the Sun JVM.
      -it is very slow in some areas (about 3 times slower during disk IO and md5 checksumming)
      -I couldn't get it to create static binaries (dev. on Debian/unstable to run on Debian/stable), but this could be my fault.

      The only good thing was the slightly faster launch times (about 0.2ms on a process that runs 1.2ms total) compared to the Sun JVM. But since the program is only launched about 5 times per hour why bother.

      This was with gcj-4.0 some months ago.

    3. Re:GCJ by larry+bagina · · Score: 1

      Amen. MS = bad for having java with extensions.

      GNU = good for having java with extensions.

      If it's good for the goose, it's good for the gander.

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

  4. License? by SanityInAnarchy · · Score: 1

    I've heard Java is to be open sourced, but what is the JDK license at the moment? To what extent can I modify and redistribute?

    --
    Don't thank God, thank a doctor!
    1. Re:License? by ForumTroll · · Score: 2, Informative

      IIRC you can modify it as much as you like for your own personal use but you can't redistribute it.

      --
      "A Lisp programmer knows the value of everything, but the cost of nothing." - Alan Perlis
    2. Re:License? by ForumTroll · · Score: 1

      In all honesty, I'm not sure if distributing patches would be acceptable, I do have my doubts about that though. You'd have to really study the entire license to be sure of that, and unfortunately due to the way the license is written it would probably be best to check directly with Sun or a lawyer who handles software licenses regularly to be sure.

      Hopefully, Sun will choose an open source license which resolves most of these uncertainties.

      --
      "A Lisp programmer knows the value of everything, but the cost of nothing." - Alan Perlis
    3. Re:License? by SanityInAnarchy · · Score: 1

      Hopefully, yes. But how do you legally prevent distributing patches? I'm sure patches can be done in such a way that they don't expose any of the original code, although it does make them more likely to fail when files change.

      --
      Don't thank God, thank a doctor!
    4. Re:License? by LizardKing · · Score: 1

      Ah, ok. Can I distribute patches?

      Yes, that's exactly how you get the patchsets that enable JDK builds on FreeBSD and NetBSD.

  5. Re:Not the real problem by kwark · · Score: 2, Funny

    "I eventually solved this by using dpkg to build a one-on-one package from the JDK binary tree and told it to provide "java-virtual-machine, java2-runtime" and to make it conflict with: "kaffe, java1-runtime, java-compiler, fastjar, libjessie-java, java-common, gcj-4.0, ecj, ecj-bootstrap-gcj" after which I finally managed to get rid of the open source abominations once and for all."

    Why do it the easy way with make-jpkg and the alternatives system when you can do above :)

  6. Re:Not the real problem by kwark · · Score: 1

    I don't get your problem, if you don't want any of the OS java environments: uninstall them. Any java package that depends on any specific OS JVM is either not a java package or has a broken dependency (it should depend on java2-runtime)

    But to be honest: I don't use any java packages in any distro. Since client projects tend to be a mix and match of different versions of applications and JVMs I just install them all by hand in /usr/local and adjust $JAVA_HOME or symlinks when needed.

  7. Re:Not the real problem by BigFootApe · · Score: 3, Informative
    Are you thinking that Sun JDK will conflict with, say, SableVM? Milarky! You just use update-alternatives to point javac, java, javaw, etc. at Sun JDK as the primary provider of said facility.

    e.g.
    update-alternatives --config java
     
    There are 4 alternatives which provide `java'.
     
    Selection Alternative
      1 /usr/bin/gij-wrapper-4.0
    *2 /usr/lib/j2sdk1.5-sun/bin/java
    +3 /usr/lib/jvm/java-gcj/jre/bin/java
      4 /usr/bin/gij-wrapper-4.1
     
    Press enter to keep the default[*], or type selection number: 2
    Using `/usr/lib/j2sdk1.5-sun/bin/java' to provide `java'.
    Simple, no?

    Sorry, it would look nicer if slashdot accepted preformatted text :(
  8. Re:Not the real problem by MemoryDragon · · Score: 1

    which is still too much for the average end user who just wants to run azureus... I hope the gcj based compiles are replaced by the native sun jdk in the next version now the license issues are cleaned up, as good as gcj is, the native java is almost twice as fast....

  9. Re:Not the real problem by kevlarman · · Score: 1

    the average end user who just wants to run azureus can find sun's java in synaptic just fine, though some way to ask if you want sun's java to be the default when you install it would be nice (not sure how to do this though, changing things without asking is always a bad idea, and asking for user input is not an option with dpkg)

    --
    A mouse is a device used to point to the xterm you want to type in
  10. Amusing troll by Anonymous Coward · · Score: 1

    http://blogs.sun.com/navi/entry/try_this_at_home_b uilding

    "Does java still take an hour and a half to compile 'hello troll!' on my 486?

    Posted by trolly troller on August 26, 2006 at 05:12 PM PDT "