0

Several months ago I downloaded NetBeans 7.0 with All Supported technologies from this page.

I find myself on TextMate more often instead of NB when experimenting Java codes, I open NB maybe once in every 2 weeks or a month, but I open TextMate everyday, anyway. One feature that I love from TextMate is command r to compile and run.

But the thing is it's using java version "1.5.0_28". Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_28-b04-382-9M3326). Java HotSpot(TM) Client VM (build 1.5.0_28-157, mixed mode, sharing) from my Mac OS X 10.5.8

How can I make TextMate running Java from NB 7.0 instead?

I asked a question on Unix SE regarding the complete NB's Java path but I still don't get the executable Java I'm looking for. Does anyone familiar with Java and NetBeans have any ideas?

Update 2: Thanks for the awesome comments, guys!

For @romainl, now how can I add this Java SE 6 to my path $JAVA_HOME at my .profile when I don't know where its path is being located? My Java Preferences is this

My Java Preferences

For @slhck, now how can I know Java SE 6 path from my Activity Monitor? hmm this app is like UNIX top, eh?

My Activity Monitor

10
  • 1
    NB doesn't use its own runtime. Did you use /Applications/Utilities/Java Preferences.app? It will show what versions of Java are available and active. NB 7.0 doesn't work with Java SE 5, it needs 6 so if it is running fine you'll probably have both in the list. If yes you may uncheck 5 and see what happens. Depending how the Java runtime is called from TextMate's Java bundle you will probably need to add/edit the $JAVA_HOME environment variable in your ~/.bashrc or ~/.profile. It's possible that the runtime's path is hardcoded in the bundle (a few bundles do that), did you take a look?
    – romainl
    Jul 25, 2011 at 8:18
  • 1
    In the 1st screen it's written "Drag to change the preferred order". You should reverse the order of the 2 first items or, if you are positive there will be no side effect, uncheck the two SE 5. After it's done, java -version in a new terminal window should show that you run Java SE 6. After relaunching TextMate, do Cmd-r. Did it work? If not, the problem may come from the Java bundle and you'll have to search for some hardlinked or hardcoded reference to the old Java SE.
    – romainl
    Jul 26, 2011 at 6:57
  • 1
    About Activity Monitor, you can hit the "Inspect" button to see what files are used by the selected app.
    – romainl
    Jul 26, 2011 at 6:59
  • 1
    The /usr/bin/java returned by which java is an alias to /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java. Look around for the correct path to Java SE 6, but I suspect you won't need it.
    – romainl
    Jul 26, 2011 at 7:03
  • 1
    I think I just discovered how to game stackoverflow: you just have to goof around in the comments and, once the solution is found, you post the answer. I'm such a winner !!!! OK, seriously I didn't know EXACTLY how to solve your problem. I'll post the answer anyway.
    – romainl
    Jul 26, 2011 at 15:21

1 Answer 1

1

(note: the solution was found in the question's comments, this is an edited version and probably not a "real" answer by SU's standards)

NetBeans doesn't use its own runtime, instead it uses the runtime currently active on your machine.

NetBeans 7.0 doesn't work with Java SE 5, it needs Java SE 6. If NetBeans works it means that you have Java SE 6 installed on your Mac.

Since java -version says that the default Java SE is Java SE 5 you'll have to launch /Applications/Utilities/Java Preferences.app, it shows what versions of Java are available and active.

There is a little note under the list of available runtimes that says "Drag to change the preferred order". You should reverse the order of the two first items or, if you are positive there will be no side effect, uncheck the two Java SE 5.

After it's done, typing java -version in a new terminal window should show that you run Java SE 6. After relaunching TextMate, does R work?

If not, the problem may come from the Java bundle and you'll have to search for some hardlinked or hardcoded reference to the old Java SE.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .