This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 207968 - Mac OSX 10.7 Lion Java Preferences ignored [patch, workaround]
Summary: Mac OSX 10.7 Lion Java Preferences ignored [patch, workaround]
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Launchers&CLI (show other bugs)
Version: 7.1
Hardware: PC Mac OS X
: P2 normal (vote)
Assignee: Jiri Rechtacek
URL: http://bugs.sun.com/bugdatabase/view_...
Keywords: JDK_SPECIFIC
Depends on:
Blocks:
 
Reported: 2012-02-01 04:24 UTC by msouth
Modified: 2012-07-17 15:22 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description msouth 2012-02-01 04:24:23 UTC
NB 7.1 ignores anything specified in OSX Lion's "Java Preferences"; if "--jdkhome" is not set then NetBeans hard-codes for Java 1.6.0. (Lion provides a new utility to retrieve the user's preference.)


Problems:

- Prevents loading some plugins which require JDK 1.7 (such as Output Handler)

- Requires that JDK 1.6.0 is installed

- Makes the wrong JDK the project default


Workarounds:

- Run NetBeans from the command line:

   $ /Applications/NetBeans/NetBeans\ 7.1.app/Contents/MacOS/netbeans \
        --jdkhome `/usr/libexec/java_home`

- Or, modify the file 

   /Applications/NetBeans/NetBeans\
       7.1.app/Contents/Resources/NetBeans/platform/lib/nbexec

  as noted in patch.

- (Don't bother with JDK_HOME or JAVA_HOME; NetBeans doesn't reference them.)


Patch:

--- o.n.bootstrap/launcher/unix/nbexec	2011-12-07 15:51:36.000000000 -0500
+++ nbexec.new	2012-01-31 22:38:20.000000000 -0500
@@ -151,7 +151,9 @@
 
     case "`uname`" in
         Darwin*)
-        if [ -f "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java" ] ; then
+        if [ -x "/usr/libexec/java_home" ]; then
+            jdkhome=`/usr/libexec/java_home`
+        elif [ -f "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java" ] ; then
             jdkhome="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"
         elif [ -f "/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java" ] ; then
             jdkhome="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"
Comment 1 ttokoly 2012-02-10 16:38:12 UTC
Product Version: NetBeans IDE 7.1.1 (Build 201202092200)
JDK 7 build 228 (Developer Preview)
System: Mac OS X version 10.7.3 running on x86_64; MacRoman; en_US (nb)

Works same for me as described.  Even with this newer JDK and NB build. After install of JKD 7, JDK 6 is still default (doesn't matter if NB is installed before or after JDK 7).
Comment 2 Jiri Rechtacek 2012-02-16 16:57:19 UTC
Assigned to new owner.
Comment 3 Jiri Rechtacek 2012-02-22 15:56:12 UTC
(In reply to comment #0)
> NB 7.1 ignores anything specified in OSX Lion's "Java Preferences"; if
> "--jdkhome" is not set then NetBeans hard-codes for Java 1.6.0. (Lion provides
> a new utility to retrieve the user's preference.)
> 
> 
> Problems:
> 
> - Prevents loading some plugins which require JDK 1.7 (such as Output Handler)
> 
> - Requires that JDK 1.6.0 is installed
> 
> - Makes the wrong JDK the project default
> 
> 
> Workarounds:
Or simple modify your netbeans.conf in <ide-install-root>/etc/
Comment 4 Jiri Rechtacek 2012-02-22 15:57:06 UTC
(In reply to comment #0)
> Patch:
> 
> --- o.n.bootstrap/launcher/unix/nbexec    2011-12-07 15:51:36.000000000 -0500
> +++ nbexec.new    2012-01-31 22:38:20.000000000 -0500
> @@ -151,7 +151,9 @@
> 
>      case "`uname`" in
>          Darwin*)
> -        if [ -f
> "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java" ] ;
> then
> +        if [ -x "/usr/libexec/java_home" ]; then
> +            jdkhome=`/usr/libexec/java_home`
> +        elif [ -f
> "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java" ] ;
> then
>             
> jdkhome="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"
>          elif [ -f
> "/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java" ] ;
> then
>             
> jdkhome="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"

Thanks for the hint.
Comment 5 Tomas Danek 2012-03-19 12:40:09 UTC
Marking 71patch2-candidate, but up to discussion, since this fix is in launcher, which is not distributed with AU.
Comment 6 Marian Mirilovic 2012-03-21 16:39:58 UTC
Ok, agreed for sure to fix it in launcher.

Also agreed to report bug against JDK 7 installer (Tonda please do so and escalate!): change "Java Preferences" and point to JDK 7 installation.
Comment 7 Jiri Rechtacek 2012-03-22 09:39:23 UTC
core-main/rev/4c3683e74d8d
Comment 8 Antonin Nebuzelsky 2012-03-22 11:32:36 UTC
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7155939
Comment 9 Quality Engineering 2012-03-24 11:03:13 UTC
Integrated into 'main-golden', will be available in build *201203240400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/4c3683e74d8d
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #207968: Mac OSX 10.7 Lion Java Preferences ignored
Comment 10 Tomas Danek 2012-03-27 14:25:51 UTC
verified in 20120325. Please proceed with integration to 7.1.2.
Comment 11 Marian Mirilovic 2012-03-29 08:31:35 UTC
Jirka, 
please proceed with integration into release71_fixes branch and follow
http://wiki.netbeans.org/NetBeansPatchesProcess . Thanks in advance.
Comment 12 Jiri Rechtacek 2012-03-29 08:38:21 UTC
(In reply to comment #11)
> Jirka, 
> please proceed with integration into release71_fixes branch and follow
> http://wiki.netbeans.org/NetBeansPatchesProcess . Thanks in advance.

http://hg.netbeans.org/releases/rev/9195c06df513
Comment 13 Quality Engineering 2012-03-29 11:58:59 UTC
Integrated into 'releases', will be available in build *201203291150* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/9195c06df513
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #207968: Mac OSX 10.7 Lion Java Preferences ignored
(transplanted from 4c3683e74d8db6c7baf79c43fe0d0d5fbb2996b9)
Comment 14 Tomas Danek 2012-04-11 09:21:48 UTC
verified in 7.1.2, java preferences are respected.

Product Version: NetBeans IDE 7.1.2 (Build 201204101705)
Java: 1.7.0_04-ea; Java HotSpot(TM) 64-Bit Server VM 23.0-b20
System: Mac OS X version 10.7.3 running on amd64; US-ASCII; en_US (nb)
User directory: /Users/tomas/.netbeans/7.1.2
Cache directory: /Users/tomas/.netbeans/7.1.2/var/cache