apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.6k stars 836 forks source link

macOS installer doesn't recognize SDKMAN installed JDK #3870

Open rokon12 opened 2 years ago

rokon12 commented 2 years ago

Apache NetBeans version

Apache NetBeans 13

What happened

I could not install the latest Netbeans 13 on my MacBook Pro. I used SDKMAN to manage java on my machine. I have java installed on my device, and I have been working with other IDE (such as IntelliJ IDEA). When I tried to install Netbeans, it shows the following message:

image

I tried with homebrew and I got the same message:

installer: Error - NetBeans IDE cannot be installed. This software can be installed with Java 8 or newer. Please download and install the latest update of Java 8 from http://www.oracle.com/technetwork/java/javase/downloads/index.html and restart NetBeans installation.
==> Purging files for version 13 of Cask netbeans
Error: Failure while executing; `/usr/bin/sudo -E -- /usr/bin/env LOGNAME=bazlur.rahman USER=bazlur.rahman USERNAME=bazlur.rahman /usr/sbin/installer -pkg /opt/homebrew/Caskroom/netbeans/13/Apache\ NetBeans\ 13.pkg -target /` exited with 1. Here's the output:
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

installer: Error - NetBeans IDE cannot be installed. This software can be installed with Java 8 or newer. Please download and install the latest update of Java 8 from http://www.oracle.com/technetwork/java/javase/downloads/index.html and restart NetBeans installation.

How to reproduce

Steps:

Did this work correctly in an earlier version?

No

Operating System

macOS Monterey

JDK

Java 18

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

Code of Conduct

Yes

mbien commented 2 years ago

SDKMAN most likely doesn't install the JDK as "runtime", discoverable by other applications (JREs technically don't exist anymore anyway).

I am not a mac user so this is just a guess.

neilcsmith-net commented 2 years ago

See also conversation at the end of the macOS vote thread - https://lists.apache.org/thread/8k4g47n8y7gyfbwhdmbhtryvjx30qdhd

Other option is to use an installer with bundled JDK runtime, under Community Installers at https://netbeans.apache.org/download/nb13/nb13.html Then you can use the SDKMAN managed JDKs for projects.

smithtonson commented 1 year ago

You can also try symlinking any JDKs installed through SDKMAN into the system-wide JVM location: for me it's: ln -s /opt/sdkman/candidates/java/17.0.3.fx-zulu/zulu-17.jdk /Library/Java/JavaVirtualMachines

rajcspsg commented 11 months ago

@smithtonson Thanks it helped

I'm able to successfully install using the below command. But is works with sdkman zulu only though

sudo ln -s ~/.sdkman/candidates/java/20.0.2.fx-zulu/zulu-20.jdk /Library/Java/JavaVirtualMachines
sudo installer -package /Volumes/Apache\ NetBeans\ 18/Apache\ NetBeans\ 18.pkg  -target /