The JDK is missing and is required to run some NetBeans modules - netbeans

Complete error message:
The JDK is missing and is required to run some NetBeans modules
Please use the --jdkhome command line option to specify a JDK installation or see http://wiki.netbeans.org/FaqRunningOnJre for more information.
Some details: I just installed Netbeans on Linux mint for the first time and when I start it when its turning on modules this error message appears. But I do have jdk installed.
$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
$ javac -version
javac 1.8.0_66

Find the file [netbeans installation directory]/etc/netbeans.conf
Luckily, Linux has a find helper like
find /home/ -name "netbeans.conf,
in which you can change the /home/ to a location where you want to search.
I found it at /usr/local/netbeans-8.1/etc/netbeans.conf
Once, you found the file, the following property needs to be set:
netbeans_jdkhome="[jdk_path]"
where you can find the jdk_path using:
update-alternatives --config java
In my case, I found it at /opt/java/jdk1.8.0_191

[Solved] For Mac OSX 10.11 (El Capitan).
Solution may be similar for other Unix-based systems.
The problem may have occurred because I inadvertently installed the jre
prior to installing the jdk. I uninstalled the jre, installed the jdk
and reinstalled NetBeans but the problem (popup window) remained.
However, the fix was fairly simple.
1. Make sure NetBeans is not running.
2. Make sure the jdk is installed.
3. Determine the location of the jdk:
The jdk location can be determined by entering the following (in Terminal):
$ /usr/libexec/java_home
For my system, the output was:
/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
4. Edit the NetBeans configuration file to indicate the location of the jdk.
Near the bottom of this Netbeans configuration file (or equivalent for your NetBeans version):
/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
Comment out the following line (insert a # before the first character):
#netbeans_jdkhome="/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/bin/jre"
Then, add the following line (or equivalent for your jdk version):
netbeans_jkdhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home"
Then, save and exit the editor.
5. Start NetBeans (no more popup window indicating that the jdk is missing).

When netbeans has problems trying to find the path of the jdk, it's mainly because the version of the jdk does not match. Open the file C:\Program Files\NetBeans 8.2\etc\netbeans.conf, and verify that netbeans_jdkhome = "C:\Program Files\Java\jdk1.8.0_111".

Open netbeans.conf
sudo nano "/usr/lib/jvm/java-8-oracle/netbeans.conf"
Set proper sdk path:
netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"
Exit Ctrl + X and to save changes Ctrl + T

This error showed up when I updated the Mac to Mojave. To fix, I edited the netbeans.conf file with the current jdk by using Terminal to find the correct jdk. Type
/usr/libexec/java_home -V
Here was my output.
Matching Java Virtual Machines (4):
1.8.311.11 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_131 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
1.8.0_25 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
1.7.0_79 (x86_64) "Oracle Corporation" - "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
Entering the first jdk listed did not work.
I edited the conf file with the second one listed:
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home"
Restarted Netbeans. That fixed it.

This worked for me
1. install full JDK
2. either edit <netbeans-IDE-installation>/etc/netbeans.conf
2.1 unmark netbeans_jdkhome
2.2 link to JDK location e.g. /usr/local/share/java/jdk1.6.0_07/
3. or use --jdkhome command-line option e.g. ./bin/netbeans --jdkhome /usr/local/share/java/jdk1.6.0_07/
take care with the "/" at the end
More info in http://wiki.netbeans.org/FaqRunningOnJre

Ubuntu 16.04 LTS:
Uninstall the netbeans you have.
Delete .cache/netbeans folder
Download http://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-142931.html
Install your download

I have this problem to. But now i resolove this problem with edit one line.
Find and open this file /etc/netbeans.conf
If you see netbeans_jdkhome="C:\Program Files\Java\jre1.8.0_151" replace netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_131"
Save as adminstrator
Problem reseloved

In mid April 2019, Oracle has changed the JDK's licence. However, I was still able to solve this issue with NetBeans 11 and the JDK 12's open source build on my Windows machine. Just downloaded the open source JDK from https://jdk.java.net/ and extracted it. Then, in my NetBeans config file, I typed in the path to the extracted directory (NOT the "bin" folder!).

I resolved this problem by changing default version of JRE and JDK that I'm using to 11.x.x with following commands:
sudo update-alternatives --config java
sudo update-alternatives --config javac

Related

Cannot launch CDT: java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter

I am trying to use Eclipse CDT under Ubuntu 18.04 LTS.
I get the same error as many others, but I could not find a solution in what I read.
I try to launch with
$ eclipse &
OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
and I get
/home/user1/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1551271296090.log
When checking /usr/lib/eclipse/configuration/config.ini (as per this) I found the following lines (among others)
osgi.framework=file\:plugins/org.eclipse.osgi_3.8.1.dist.jar
osgi.bundles=reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.301.dist.jar#1\:start
org.eclipse.equinox.simpleconfigurator.configUrl=file\:org.eclipse.equinox.simpleconfigurator/bundles.info
As for the first two lines, I have files
$ locate eclipse.osgi_
/usr/share/java/org.eclipse.osgi_3.8.1.dist.jar
$ locate simpleconfigurator_1
/usr/lib/eclipse/plugins/org.eclipse.equinox.simpleconfigurator_1.0.301.dist.jar
Nevertheless:
/usr/share/java/org.eclipse.osgi_3.8.1.dist.jar seems to belong to no package (a remnant of some old package?), since
$ apt-file search /usr/share/java/org.eclipse.osgi_3.8.1.dist.jar
gives no results.
I have ver 3.9.1
$ dpkg -l | grep libequinox-osgi-java
ii libequinox-osgi-java 3.9.1-1 all Equinox OSGi framework
$ dpkg -L libequinox-osgi-java
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libequinox-osgi-java
/usr/share/doc/libequinox-osgi-java/changelog.Debian.gz
/usr/share/doc/libequinox-osgi-java/copyright
/usr/share/java
/usr/share/java/org.eclipse.osgi-3.9.1.jar
/usr/share/maven-repo
/usr/share/maven-repo/org
/usr/share/maven-repo/org/eclipse
/usr/share/maven-repo/org/eclipse/osgi
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/3.9.1
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/3.9.1/org.eclipse.osgi-3.9.1.pom
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/debian
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/debian/org.eclipse.osgi-debian.pom
/usr/share/java/org.eclipse.osgi.jar
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/3.9.1/org.eclipse.osgi-3.9.1.jar
/usr/share/maven-repo/org/eclipse/osgi/org.eclipse.osgi/debian/org.eclipse.osgi-debian.jar
So I do not know if the problem is here.
How can I solve this?
Could not find an answer here
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=891956
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=898086
https://bugs.launchpad.net/ubuntu/+source/eclipse/+bug/1754886
https://ubuntu.pkgs.org/16.04/ubuntu-universe-i386/libequinox-osgi-java_3.8.1-8_all.deb.html
https://askubuntu.com/questions/1031171/eclipse-doesnt-start-on-ubuntu-18-04
You are probably using an older Eclipse version that does not work with Java 9 or higher:
If using Java 9 or newer please use Eclipse 4.7.1a or newer as it contains fixes in Eclipse launcher to add all JVM modules.
Do one of the following to solve the problem:
Use Java 8 to run Eclipse (a JRE/JDK can be put in the subfolder jre of your Eclipse installation or be specified in the eclipse.ini file)
Upgrade Eclipse (recommended).

Eclipse scala-ide won't start after installing Mac OS X Sierra (Mac OS 10.12)

Eclipse quit Unexpectedly error is showing up.
Process: eclipse [1612] Path:
/Applications/Eclipse.app/Contents/MacOS/eclipse Identifier:
scalaide.product.id Version: 1.0.0 (1.0.0.201605041117)
Code Type: X86-64 (Native) Parent Process: ??? [1]
Responsible: eclipse [1612] User ID: 501
Date/Time: 2016-11-05 08:25:36.767 +0530 OS Version:
Mac OS X 10.12 (16A323) Report Version: 12 Anonymous UUID:
756B4B0B-5772-3B0B-F072-86AA384C8784
Sleep/Wake UUID: 9458E0FB-8ADB-4FF1-AF46-A0CE9A6FC72D
Time Awake Since Boot: 6100 seconds Time Since Wake: 3100
seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes:
KERN_INVALID_ADDRESS at 0x000000000000003c Exception Note:
EXC_CORPSE_NOTIFY
I installed the new Mac Sierra & installed the latest scala-ide (scala-SDK-4.4.1-vfinal-2.11-macosx.cocoa.x86_64.zip) but its showing above error on opening the application.
I also faced the same issue in sierra.
There seems to be some issue with unzipping in sierra.
Both double click as well as unzip command.
I ended up using windows (i had windows VM in VMFusion) and used 7zip to uncompress the zip. After that, it open properly in Mac.
I have a workaround if you find interesting:
brew install Caskroom/cask/scala-ide
It worked for me and installed the version 4.4.1 on macOS Sierra 10.12.1.
Note: You will need to have brew installed so for instructions on that check this url: http://brew.sh .
I didn't dig deep into this, but it looks like it may be an error of the Mac OS X utility that automatically compresses files.
I have downloaded the zip, uncompressed it via unzip, and it worked (launched via command line).
I was having same issue with Eclipse Kepler when double clicking to unzip a .tar.gz file. The above reference about using Terminal worked for me.
Instead of double clicking to unsip a .zip or a .tar.gz file, try using Terminal to cd to the same directory as the downloaded file, and run command
For a .zip file:
unzip -a foo.zip
For a .tar.gz file:
gunzip -c foo.tar.gz | tar xopf -
while replacing 'foo' with name of your downloaded file.
I was also required to download and install legacy Java 6 runtime.
Reference:
http://magma.maths.usyd.edu.au/magma/faq/extract
Scala IDE is not compatible with Java SE 9 and higher versions. You might need to downgrade or install Java SE 8 in order to fix the issue.
Lets go through each step how you can fix it.
Step 1. Check what version of Java you have installed on your machine.
Run this command in your terminal: /usr/libexec/java_home --verbose
As you can see I have three different versions of java running on my machine.
Step 2: Install Java SE 8 (jdk1.8) if you don't find it in your list. Refer this blog for java installation steps.
Step 3: Now open your .bashrc file (run command: vi ~/.bashrc) and copy-paste below line in your bashrc file.
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Step 4: Save the file (:wq!) and reload your profile (source ~/.bashrc)
Step 5: Now you need to define eclipse.ini arguments in order to use Java 1.8 version.
On a Mac OS X system, you can find eclipse.ini by right-clicking (or Ctrl+click) on the Scala IDE executable in Finder, choose Show Package Contents, and then locate eclipse.ini in the Eclipse folder under Contents.
The path is often /Applications/Scala IDE.app/Contents/Eclipse/eclipse.ini
Step 6: Open it with text editor and copy-paste below line in eclipse.ini file. Change the version (if needed) according to your java version. Mine is 1.8.0_171.
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin
Step 7: Save the file and exit.
Step 8: Run the Scala IDE application now and it should run:
Reference: Website
Facing the same error using macOS 10.12.5. Tried using different unzipped and home-brew.
Finally made it:
Installed it using brew cask install scala-ide. Changed the default workspace to "workspace_new" when getting asked at the first start.

Eclipse 4.4 on Ubuntu 14.04 - "no such file" error

I am working on Ubuntu 14.04 LTS and I would like to install eclipse 4.4. I did everything step by step with this site:
http://tutorialforlinux.com/2014/03/13/how-to-install-eclipse-4-3-kepler-standard-on-ubuntu-12-04-precise-lts-3264bit-linux-easy-visual-guide/
Now it is what I got after step 6 when I try to start eclipse:
zaba#zaba:~$ ls /opt/eclipse/
about_files configuration eclipse.ini icon.xpm
plugins about.html dropins
epl-v10.html notice.html readme artifacts.xml
eclipse features p2
zaba#zaba:~$ ls /usr/local/bin/
eclipse
zaba#zaba:~$ eclipse
bash: /usr/local/bin/eclipse: no such file or directory
zaba#zaba:~$
As you can see teoretically everything is on its place: 'eclipse' file in /opt/eclipse and its link in /usr/local/bin - I made it as in tutorial, by:
ln -s /opt/eclipse/eclipse /usr/local/bin/eclipse
But it does not work. Can anyone help, please?
since "A third-party application in /opt is supposed to be self-contained"
it should run through
/opt/eclipse/eclipse
if it does not, there is a problem either with your user or the executable, try just copying it to ~/bin
You might have a mismatch on 64-bit and 32-bit in your operating system and eclipse version.

Install New Software on Eclipse not working on Mac

I have downloaded eclipse classic x86_64 3.7 cocoa on my Mac Intel Core 2 Duo with snow leopard 10.6.8
I have extracted and copied the eclipse directory to Applications folder. When run,
I get following errors
System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences
Unexpected error loading extension: org.eclipse.equinox.p2.metadata.repository.simpleRepository
java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.httpclient.HttpClient at org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientBrowseFileTransferFactory$1.sendBrowseRequest(HttpClientBrowseFileTransferFactory.java:53)
Error while reading from repository: http://download.eclipse.org/releases/indigo/site.xml.
I have following java version
java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
I have tried with eclipse classic 32 and 64 bit versions, with both i have the same problem .
I have also tried tweaking around priority of java version (32 or 64) under Java preferences.
Deleting /Library/Java/Extensions/log4j-1.2.15.jar resolved the issue.
Incase you are using ubuntu instead and had this problem, just go
cd /usr/java/packages/lib/ext/
sudo rm log4j-1.2.15.jar
sudo rm slf4j-*
I also had this problem and had nothing under /Library/Java/Extensions
You can notice that Eclipse reports: "The value will be overwritten using values from the preferences". So what you can do - visit Preferences > Network Connections and under 'Proxy Bypass' add Host: *
This has resolved the issue for me.
I set this to solve the problem:
http.sslVerify false in the egit config file.

Why System.getProperty("java.home") works different for Eclipse 3.4, 3.5, 3.6?

I develop plugins (to be honest I started not so long time ago) and test my plugins on different Eclipses. I have Eclipse 3.4, 3.5, 3.6 installed.
in C:\Program Files\Java there are:
jdk1.5.0_22
jdk1.6.0_21
jre1.5.0_22
jre6
for all versions of Eclipses, in here (Windows -> Preferences -> Installed JREs) there is "jdk1.5.0_22" with the path "C:\Program Files\Java\jdk1.5.0_22"
So, can not figure out why for Eclipse 3.5 and 3.6 this
System.getProperty("java.home")
prints
C:\Program Files\Java\jdk1.5.0_22\jre
but in Eclipse 3.4 it prints
C:\Program Files\Java\jre6
Could anyone give me a glue which value is used by System.getProperty("java.home")?
You can check your Project Build Path:
Example:
The java.home property returns the Java installation directory. In Windows, this is set either with the JAVA_HOME environmental variable or in the eclipse.ini file. It could be also given as a command parameter in the eclipse.exe.
You can read some instructions about running eclipse here.
Here, there is explanation how to solve similar problem
http://tech.karolzielinski.com/m2eclipse-eclipse-is-running-in-a-jre-but-a-jdk-is-required
In my case it was enough to add -vm option to eclipse.ini file for Eclipse 3.4.
-vm
C:\Progra~1\Java\jdk1.5.0_22\jre\bin\javaw
Thanks everyone!