I have the older NetBeans 6.7, NetBeans 6.9, and NetBeans 7.0, which used to run on jdk1.6.0_21 and jdk1.6.0_25. Now I've removed those JDKs and only have jdk1.6.0_26 and jdk1.7.0 left, but I still want to keep the older versions of NetBeans, but now when I run them, I get this message:
"Cannot locate java installation in specified jdkhome C:\Program Files (x86)\Java\jdk1.6.0_25
Do you want to try to use default version?"
I tried to find where it's looking for the "jdk1.6.0_25", and updated a few configuration files in "C:\Program Files (x86)\NetBeans 6.7" and "C:\Users\USER.nbi\registry.xml", and yet the message keeps coming. Where and what do I need to change to point it to C:\Program Files (x86)\Java\jdk1.6.0_26?
Thanks to Kasun Gajasinghe's tip, I found the solution in the "suggested" link. Update the following file (replace 7.x with your NetBeans version):
C:\Program Files\NetBeans 7.x\etc\netbeans.conf
Change the following line to point it where your Java installation is:
netbeans_jdkhome="C:\Program Files\Java\jdk1.7xxxxx"
You may need administrator privileges to edit netbeans.conf.
Go to Tools* → Java Platforms. There, click on Add Platform and point it to C:\Program Files (x86)\Java\jdk1.6.0_25. You can either set the another JDK version or remove existing versions.
Another solution suggested on the Oracle (Sun) site is,
netbeans.exe --jdkhome "C:\Program Files\jdk1.6.0_20"
I tried this on 6.9.1. You may change the JDK per project as well. You need to set the available JDKs via the Java Platforms dialog. Then, go to Run → Set Project Configuration → Customize.
After that, in the opened dialog box, go to menu Build → Compile. Set the version.
For those not using Windows, the file to change is netbeans-8.0/etc/netbeans.conf.
And the line(s) to change is:
netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"
Comment out the old value and insert the new value.
As a further useful solution for those of you on Windows 7 and above - if you use
cd "C:\Program Files\Java"
mklink /D jdk8 jdk1.8.0_25
you get a symbolic link folder that can be adjusted whenever a new JDK comes out.
All you need to do then is set your
netbeans_jdkhome="C:\Program Files\Java\jdk8"
(in both locations for NetBeans 8) and you never have to edit the configuration again. Just tweak the symlink each time your JDK is updated.
I had this message too because today I decided to relocate my different JDK in the same directory. I have decided to uninstall all through the program manager of Windows. After that, of course I had the message below.
"Cannot locate java installation in specified jdkhome C:\Program Files (x86)\Java\jdk1.7.0_60. Do you want to try to use the default version?"
A new install of the JDK does not resolve the problem. OK, you can configure that in menu Tools → Java platforms, but in my case I had to fix my netbeans.conf file.
I had the line below:
netbeans_jdkhome="C:\Program Files\Java\jdk1.7.0_60"
And I replaced it by:
netbeans_jdkhome="C:\devtools\Java\jdk1.8.0_25"
It does not exactly answer your question, but to get around the problem,
you can either create a .cmd file with following content:
start netbeans --jdkhome c:\path\to\jdk
or in the shortcut of Netbeans set the above option.
Where you already have a project in NetBeans and you wish to change the compiler (e.g. from 1.7 to 1.) then you would need to also change the Java source compiler for that project.
Right-click on the project and choose Properties as outlined below:
Then check that the project has the necessary source circled below:
Then check that the Java compiler is correct for the project:
All the other answers have described how to explicitly specify the location of the Java platform, which is fine if you really want to use a specific version of Java. However, if you just want to use the most up-to-date version of the JDK, and you have that installed in a "normal" place for your operating system, then the best solution is to not specify a JDK location. Instead, let the NetBeans launcher search for the JDK every time you start it up.
To do this, do not specify jdkhome on the command line, and comment out the line setting netbeans_jdkhome variable in any netbeans.conf files. (See other answers for where to look for these files.)
If you do this, when you install a new version of Java, your NetBeans installation will automagically use it. In most cases, that's probably exactly what you want.
In Windows, open cmd.
Go to the directory where your NetBeans file downloaded.
Then run the below command. The JDK path may be different from the path I mentioned.
netbeans-8.2-windows.exe --javahome "C:\Program Files\Java\jdk-9.0.1"
Related
I have the older NetBeans 6.7, NetBeans 6.9, and NetBeans 7.0, which used to run on jdk1.6.0_21 and jdk1.6.0_25. Now I've removed those JDKs and only have jdk1.6.0_26 and jdk1.7.0 left, but I still want to keep the older versions of NetBeans, but now when I run them, I get this message:
"Cannot locate java installation in specified jdkhome C:\Program Files (x86)\Java\jdk1.6.0_25
Do you want to try to use default version?"
I tried to find where it's looking for the "jdk1.6.0_25", and updated a few configuration files in "C:\Program Files (x86)\NetBeans 6.7" and "C:\Users\USER.nbi\registry.xml", and yet the message keeps coming. Where and what do I need to change to point it to C:\Program Files (x86)\Java\jdk1.6.0_26?
Thanks to Kasun Gajasinghe's tip, I found the solution in the "suggested" link. Update the following file (replace 7.x with your NetBeans version):
C:\Program Files\NetBeans 7.x\etc\netbeans.conf
Change the following line to point it where your Java installation is:
netbeans_jdkhome="C:\Program Files\Java\jdk1.7xxxxx"
You may need administrator privileges to edit netbeans.conf.
Go to Tools* → Java Platforms. There, click on Add Platform and point it to C:\Program Files (x86)\Java\jdk1.6.0_25. You can either set the another JDK version or remove existing versions.
Another solution suggested on the Oracle (Sun) site is,
netbeans.exe --jdkhome "C:\Program Files\jdk1.6.0_20"
I tried this on 6.9.1. You may change the JDK per project as well. You need to set the available JDKs via the Java Platforms dialog. Then, go to Run → Set Project Configuration → Customize.
After that, in the opened dialog box, go to menu Build → Compile. Set the version.
For those not using Windows, the file to change is netbeans-8.0/etc/netbeans.conf.
And the line(s) to change is:
netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"
Comment out the old value and insert the new value.
As a further useful solution for those of you on Windows 7 and above - if you use
cd "C:\Program Files\Java"
mklink /D jdk8 jdk1.8.0_25
you get a symbolic link folder that can be adjusted whenever a new JDK comes out.
All you need to do then is set your
netbeans_jdkhome="C:\Program Files\Java\jdk8"
(in both locations for NetBeans 8) and you never have to edit the configuration again. Just tweak the symlink each time your JDK is updated.
I had this message too because today I decided to relocate my different JDK in the same directory. I have decided to uninstall all through the program manager of Windows. After that, of course I had the message below.
"Cannot locate java installation in specified jdkhome C:\Program Files (x86)\Java\jdk1.7.0_60. Do you want to try to use the default version?"
A new install of the JDK does not resolve the problem. OK, you can configure that in menu Tools → Java platforms, but in my case I had to fix my netbeans.conf file.
I had the line below:
netbeans_jdkhome="C:\Program Files\Java\jdk1.7.0_60"
And I replaced it by:
netbeans_jdkhome="C:\devtools\Java\jdk1.8.0_25"
It does not exactly answer your question, but to get around the problem,
you can either create a .cmd file with following content:
start netbeans --jdkhome c:\path\to\jdk
or in the shortcut of Netbeans set the above option.
Where you already have a project in NetBeans and you wish to change the compiler (e.g. from 1.7 to 1.) then you would need to also change the Java source compiler for that project.
Right-click on the project and choose Properties as outlined below:
Then check that the project has the necessary source circled below:
Then check that the Java compiler is correct for the project:
All the other answers have described how to explicitly specify the location of the Java platform, which is fine if you really want to use a specific version of Java. However, if you just want to use the most up-to-date version of the JDK, and you have that installed in a "normal" place for your operating system, then the best solution is to not specify a JDK location. Instead, let the NetBeans launcher search for the JDK every time you start it up.
To do this, do not specify jdkhome on the command line, and comment out the line setting netbeans_jdkhome variable in any netbeans.conf files. (See other answers for where to look for these files.)
If you do this, when you install a new version of Java, your NetBeans installation will automagically use it. In most cases, that's probably exactly what you want.
In Windows, open cmd.
Go to the directory where your NetBeans file downloaded.
Then run the below command. The JDK path may be different from the path I mentioned.
netbeans-8.2-windows.exe --javahome "C:\Program Files\Java\jdk-9.0.1"
I'm using Eclipse Luna to develop java maven applications.
I am, or was, but am again now, using jdk1.7 as my default installed JRE.
After an update from SVN that I made, I started getting this error on my pom.xml files:
You need to run build with JDK or have tools.jar on the classpath.
If this occures during eclipse build make sure you run eclipse under JDK as well
(com.mysema.maven:apt-maven-plugin:1.0.6:process:default:generate-sources)
I noticed that my jdk1.7 installation was GONE from eclipse somehow.
I've tried all the options that I've found here on stackoverflow about re-adding that jdk1.7 and setting it as my project's JRE library and even adding the tools.jar to the jdk1.7 library on eclipse, but I'm still getting the error, which makes very little sense now.
Try setting this to your eclipse.ini file and restarting eclipse to make sure that it's also using your JDK:
-vm
C:\jdk1.7\bin\javaw.exe
Cautions:
this must go just above -vmargs
you're full path to your VM maybe different than the one above
See this as reference.
By default, eclipse will uses the "C:\Program Files\Java\jre7".
Change it, to use "C:\Program Files\Java\jdk1.7.0_xx".
I did it finally! I've tried so many option like this and this, but no luck. Then I read this comment that saved my life, really, thank you! I follow this solution and its working suddenly! should be accepted answer in my case.
I copied tools.jar from C:\Program Files\Java\jdk1.8.0_151\lib to C:\Program Files\Java\jre1.8.0_151\lib, after i execute mvn clean install – #julio mulcue burbano
This small trick worked for me.
I tried creating a shortcut of eclipse on desktop. Right click -> properties -> Target
edit the target path as follows.
After .exe append the following
-vm "C:\Program Files\Java\jdk1.8.0_201\bin"
this should look something like this(I was using sts)
C:\Users\User\Downloads\sts-bundle\sts-3.9.7.RELEASE\STS.exe -vm "C:\Program Files\Java\jdk1.8.0_201\bin"
Click apply
Open the eclipse from shortcut and try.
I had to remove JRE from my installed JREs to make it work. Go to perefrences>Java>Installed JREs, remove jre and select jdk.
I'm trying to run eclipse on my Mac OS X. I've been doing some Android programming on Eclipse lately, and today wanted to do some development on Java. However, to my surprise, Eclipse says there's no JRE/JDK installed. I don't know how this is possible, since my android projects have worked very well so far, and even now. I've tried the following items:
Checking java version through the Mac terminal. It says java version "1.8.0_20" is installed. Here's the screenshot.
I've checked the Java version through the Java Control Panel in System Preferences. Again, same thing:
I know that when there's no JRE visible in Eclipse, it can be manually entered through the "add" option under preferences > Java > Installed JREs in Eclipse. But although I can find the Contents folder in this path: /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/home/contents, when I attempt to manually add this in Eclipse, the Java folder under users/library just doesn't show up. I have no idea why this is happening. Here are some screenshots, just in case:
As you can see, the Java folder just doesn't show up under Library in the above screenshot.
Lastly, I've also tried to hit "Search" in Eclipse (same place as "Add" in one of the screenshots above), but "Search" doesn't find anything at all.
I've gone through existing answers on SO which deal with similar problems. The only thing which I haven't done seems to be about setting a path variable, but they were all in Windows OS, so not sure if it applies in my situation.
I'd really appreciate any help on this.
Update 1: According to what has been pointed out so far, I tried copy-pasting the suggested path. But the error I get is: The home directory does not exist.
Here's the screenshot:
You are trying to find the JRE in a wrong Library directory as Library directory maybe present in more than one place. Just copy paste the jre path in 'jre home' input as
/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/home/contents/Home/jre/
EDIT: To find where is your java installed on Mac, run the following command:
echo $(/usr/libexec/java_home)
it should return something like this:
/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home
append jre to the end of this path to build JRE home path:
/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre
I want to create a Java application. I'm using Netbeans 7.1 and JDK 1.7.
When I go to File -> New Project, there is no JAVA node in categories pane. Only a standard option for creating java free form project.
What can be done?
Go to Tools-> Java Platforms, and see if your JDK has been registered there. It could be that you have only the JRE installed (not likely unless you downloaded the OS-Independent zip), or your PATH variable does not include the JDK's bin directory. In either case, just type 'javac' into the command prompt (Start->Run->'cmd.exe'). If you get an error, but are sure you have the JDK, check Oracle's website on configuring the PATH variable.
I've got a curious problem. After installing java jdk 6u25 I tested the installation by typing java in the command prompt. Everything worked fine , the console displayed the usage options as expected. This was about 3 weeks ago - I recently reinstalled windows 7 on my machine- Now I would like to get started with the play framework and followed a tutorial. I got a new application with play new but couldn't use play run because of this:
play! 1.2.3, http://www.playframework.org
Ctrl+C to stop
Could not execute the java executable, please make sure the JAVA_HOME environment variable is set properly .
The funny thing is that typing java in the console still displays usage options and neither eclipse or netbeans complained about a missing jdk. Nevertheless I checked my environment variables and was surprised to find:
No reference to java at all.
Seriously I got no idea how the console, eclipse and netbeans found my java. As a first countermeasure I once again reinstalled java hoping that the installer might set the path correctly. It didn't. Now I would like your advise: Should I just create the JAVA_HOME variable ? If I do, will further versions of the jdk override the variable to point to the new version or will I have to change the variable manually everytime? What about eclipse and netbeans. I would guess that they have been downloaded with their "own" jdk. If I want to update java on my machine, will it update their versions, too ?
Update:
I set the environment variable manually and restarted the pc. Now everything works fine but I would like to know what symbolic link is. Could you just give me a link in a comment or explain briefly ?
Eclipse and netbeans use a different way of finding your java installation than command line tools likes play, ant, maven, gradle etc.
IDEs may search your registry, guess default locations, or even have the JRE prepackaged with the installation.
Command-line tools usually rely on JAVA_HOME variable. And you have to set that manually.
Should I just create the JAVA_HOME variable ?
There are several tools that use that environment variable, so I'd recommend creating it.
If I do, will further versions of the jdk override the variable to point to the new version or will I have to change the variable manually everytime?
If you install your new Java version into the same folder (or if you create symbolic links), then no.
What about eclipse and netbeans. I would guess that they have been downloaded with their "own" jdk. If I want to update java on my machine, will it update their versions, too ?
That depends on whether the JDK is prebundled and how the configuration is done. I can't speak for Netbeans but in Eclipse, you could add this to your eclipse.ini:
-vm
C:/Java/jre/bin
Note that this is an example path to the bin folder. If you don't add versions there or use symbolic links (see above) then you'd not have to update the path when installing a new version.
It is possible that you have a (older?) java.exe in C:\windows or other common directory.
Make sure that the java you get on the command line is the one you think it is:
java -version