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 159846

Summary: Use system Java as platform
Product: installer Reporter: fommil <fommil>
Component: Mac NativeAssignee: Yulia Novozhilova <ynov>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: Macintosh (x86)   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 162518    
Bug Blocks:    

Description fommil 2009-03-07 11:53:58 UTC
The default NetBeans OS X config file uses

netbeans_jdkhome=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home

but it should really check what the system default is and use that. For my setup, that would be

netbeans_jdkhome=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home

It is possible to do this manually with every new install of NetBeans, but this should be automated.
Comment 1 fommil 2009-03-12 12:02:03 UTC
The easiest way to perform this fix would be to use the following line in the conf file rather than the current 1.5 specific line

netbeans_jdkhome=/System/Library/Frameworks/JavaVM.framework/Home
Comment 2 fommil 2009-03-22 20:27:51 UTC
ignore the previous suggested fix... it doesn't work, the /usr/bin/java doesn't always point to the /System/Library/Frameworks/JavaVM.framework/Home 
folder, you'll have to do resolution of links.
Comment 3 Yulia Novozhilova 2009-04-09 15:55:02 UTC
Hello,

Could you please clarify what problem you have? I don't see any difference between default netbeans_jdkhome and your
setup. Could you also run "/usr/bin/java -fullversion" and attach the result here, please. 
Comment 4 fommil 2009-04-09 19:49:58 UTC
java full version "1.6.0_07-b06-153"

Note that NetBeans uses Java 1.5 by default (hard coded) on Mac, regardless of /usr/bin/java
Comment 5 Yulia Novozhilova 2009-04-10 17:31:36 UTC
Hello,

Actually installer sets "netbeans_jdkhome" correctly from some point of view:) It is not hard coded.
As you know Mac native installer requires that you enter admin password to start the installation. So all scripts are
run with admin privileges since NetBeans is installed for every user on this machine.
The script that set up "netbeans_jdkhome" uses "/usr/bin/java -fullversion". So the java it gets is the same as you get
from "sudo /usr/bin/java -fullversion". Try it. I'm sure you'll get 1.5.0*
So, you can run Java Preferences under sudo and set up jdk 6.0 to be default. 
I agree it is incorrect behaviour but unfortunately I can't do anything in installer to fix it since I cant predict
which java the user has. I'll file a bug on ide and ask them to adjust nbexec script to choose correct Java on Mac OS.

Thanks.
Comment 6 fommil 2009-04-10 17:39:46 UTC
Incredible! I never would have guessed this was what was happening.
Comment 7 fommil 2009-04-10 17:41:50 UTC
When running Java Preferences as sudo, I'm seeing Java 6 as the JRE... so unable to change. User option in "Advanced" or similar would be a good workaround.
Comment 8 Yulia Novozhilova 2009-04-10 17:53:44 UTC
hmmm... and what does "sudo /usr/bin/java -fullversion" return?
Comment 9 fommil 2009-04-10 17:54:34 UTC
java full version "1.5.0_16-b06-284"

It's all very odd.
Comment 10 Yulia Novozhilova 2009-04-28 14:26:29 UTC
Fixed: http://hg.netbeans.org/main/rev/c119dd1848e2
Comment 11 Yulia Novozhilova 2009-04-28 14:32:30 UTC
reopen for reassiging.
Comment 12 Yulia Novozhilova 2009-04-28 14:35:15 UTC
-> fixed
Comment 13 dlipin 2009-04-30 07:28:19 UTC
*** Issue 164133 has been marked as a duplicate of this issue. ***