Thursday, November 12, 2009

Missing rt.jar Mac OS X using ProGuard with NetBeans

When you are using ProGuard for obfuscation of some of your NetBeans module code on a Mac running OS X and you will most likely refer to rt.jar in your build.xml and get and error about missing rt.jar.

One quick fix solving this could be the following which helped me.

On your Mac open a terminal and change directory to

/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib


now just softlink to classes.jar via

me$ sudo ln -s ../../Classes/classes.jar rt.jar

10 comments:

  1. Brilliant! Thanks both...google and you!

    ReplyDelete
  2. Hi,

    I have this with the Lion 10.7.3 jdk 1.6.0

    $pwd
    /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib
    $ls -l rt.jar
    lrwxr-xr-x 1 root wheel 25B Mar 14 23:18 rt.jar -> ../../Classes/classes.jar
    $pwd
    /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/jre/lib
    $ls -l
    total 8
    lrwxr-xr-x 1 root wheel 16B Mar 14 23:20 rt.jar -> ../../lib/rt.jar


    Thanks again for this nice post....

    ReplyDelete
    Replies
    1. Thanx. Do I read this that you simply created 2 softlinks on 10.7.3 with jdk 1.6.0 to support both jdk and jre consumption ?

      Delete
  3. Hi,
    Thanks for this workaround! I'm using:
    Darwin ArjonesBook.local 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr 9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64

    And besides the SYMLINK you described, on my env I had to create a ref. to jre. see commands below.

    Hope it can be useful!

    cd /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    sudo ln -s /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar rt.jar

    # ALSO NECESSSARY
    cd /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    sudo ln -s . jre

    ReplyDelete
  4. What version of ProGuard are you guy's using ? I am planning to upgrade to 4.9 as I switch to Java 7.

    ReplyDelete
  5. nice solution. thanks.

    ReplyDelete
  6. wow. thanks for the solution :).

    ReplyDelete
  7. Interesting to get comments on this blog even 6 years after I wrote it. Happy that this helped so many of you and thanx for the nice words.

    ReplyDelete