Setting JRE in Netbeans - netbeans

I have JDK 1.6, JRE6 and JRE7 (64-bit & 32-bit) installed in my PC.
I am using Netbeans 7.3 BETA 2 and it is using JDK 6 and JRE 6.
I want to change it to JRE7. How can i achieve this ?
I have checked in Stackoverflow itself and found that we have to change the netbeans.conf file content for the netbeans_jdkhome value to the path of new Java path.
In another stackoverflow question, I found How to specify which JRE to use in Netbeans?.
But, in this also, I am not able to find how to get this resolved. Can anybody help on this ?
My installation path is as follows,
JDK6 path - C:\Program Files (x86)\Java\jdk1.6.0_31
JRE6 path - C:\Program Files (x86)\Java\jre6
JRE7 path - C:\Program Files (x86)\Java\jre7 (32-bit)
JRE7 path - C:\Program Files\Java\jre7 (64-bit)
Thanks in advance.

Goto Tools -> Platforms
Click "Add Platform", browse to the location where the JDK you want to add is installed....
Click on the JDK you want to add and select "Finish"
Updating projects
You can change the platform that projects use, by right clicking the project node and selecting properties and selecting Libraries. Here you change the platform that the project will use to build the classes with.
You can also change the source/binary format (version) which Netbeans is expecting to use. For example, you use JDK 7, but build/develop for Java 6
Changing the JDK that Netbeans itself uses to run
Goto {install/location/of/Netbeans}/etc and open the netbeans.conf.
There is a property called netbeans_jdkhome (it was towards the end of my file). You change this to what ever JDK you want Netbeans to be launched with

Related

Netbeans Installation cannot find JRE

I am trying to install Netbeans 8.2 on my Microsoft surface pro and I am using JDK 10.0.2. When I run the Netbeans installer it is unable to find the JDK. So I used the --javahome command with the correct file destination and I suppose it finds the JDK. But then it throws the same error for the JRE. I do not know why the JRE cannot be found. I have been reading many similar questions and am seeing directions saying to use JAVA_HOME and set the environment variables. I am very unfamiliar with the windows command prompt, so I would appreciate a more specific solution.
As much as I know, JDK doesn't come with JRE, so check in your Java folder if you got JRE installed, if not, try downloading it manually.
Hope that helps
Version 8.2 of NetBeans does not support JDK 10.
However, ownership of NetBeans has recently been moved from Oracle to Apache and you can use JDK 10 with NetBeans 9.0 RC1 (RC = "Release Candidate").
Just download the zip file, unzip it and then locate and run netbeans64.exe (or netbeans.exe for 32-bit) within the unzipped folder. Those steps are the same regardless of operating system.
When NetBeans starts it should automatically locate your installed JDKs, but verify that you have JDK 10 included as a Java Platform from the Tools > Java Platforms screen:
You can explicitly add JDK 10 to NetBeans if necessary:
Tools > Java Platforms
Click Add Platform and complete the wizard to add JDK 10.
Once you have JDK 10 included in Java Platforms you can create a trivial Java 10 project, although the process is not completely intuitive:
File > New Project > Java > Java Application
Accept all the default options. A new project with a name of the form JavaApplication{n} will be created.
In the Projects panel select the project's node, right click and select Properties from the popup menu.
Select Libraries from the list of Categories and set Java Platform to JDK 10.
Select Sources from the list of Categories, set Source/Binary Format to JDK 10 and click OK.
You now have a Java 10 project. To verify that, make sure that the following code compiles as your main() method:
public static void main(String[] args) {
var v = 7;
}

Can't create project on Netbeans 8.2

I have windows 10 OS, I just downloaded JDK 9, and Netbeans 8.2 version with All features. When I want to create (Java) project, it just can't do it. Doesn't give me an error or something, just this blank screen.
What could be problem here, so I can't create any project ?
EDIT:
The solution is to install JDK 8, as JDK 9 and beyond are currently not supported.
If however, you already have installed JDK 8, then kindly follow the steps outlined below.
The reason is that there is a conflict with the base JDK that NetBeans starts with. You have to set it to a lower version.
Go to the folder "C:\Program Files\NetBeans 8.2\etc", or wherever NetBeans is installed.
Open the netbeans.conf file.
Locate netbeans_jdkhome and replace the JDK path there with "C:\Program Files\Java\jdk1.8.0_152", or wherever your JDK is installed. Be sure to use the right path, or you will run into problems. Here, JDK 1.8.0_152 is installed.
Save the file, and restart NetBeans. It worked for me, should do for you too.
You can solve your problem by deleting folder JDK-9.
Restart Netbeans.
It will give you a message if you want to use the default version of JDK.
Press yes or ok.
Or you can remove JDK-9 from your pc and install JDK-8.
As the other people said, NetBeans is always going to use the latest version of JDK installed (currently JDK9) which is not working with NetBeans 8.2 and is causing problems as you guys mentioned.
You can solve this problem by forcing NetBeans to use JDK8 instead of deleting JDK9!
You just have to edit netbeans.conf file:
MacOS /Applications/NetBeans/NetBeans8.2.app/Contents/Resources/NetBeans/etc
Windows C:\Program Files\NetBeans 8.2\etc\
Open netbeans.conf with your favourite editor and find this line: netbeans_jdkhome="/path/to/jdk"
Remove # sign in front of it and modify it by typing your desired JDK version (JDK8) home location.
Im not sure why is JDK9 not working with NetBeans8.2, but if I found out I will write it here...
Default JDK locations:
Mac OS ↴
/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home
Windows ↴
C:\Program Files\Java\jdk1.8.0_152
I've used jdk1.8.0_152 as example
I had the same problem I installed NetBeans 8.2 on macOS High Sierra, and by default settings, NetBeans will work with the latest JDK release (currently JDK 9).
What I did was forcing NetBeans to use JDK 8, you must config your netbeans.conf file, you can find it on:
/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
You need to uncomment and update your path to JDK, you will find yours at:
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Just save it, restart NetBeans and you are done!
If you run in linux, open file netbeans.conf using nano or anything else.
nano netbeans-8.2/etc/netbeans.conf
and edit jdkhome or directory for jdk
netbeans_jdkhome="/usr/lib/jvm/java-1.8.0-openjdk-amd64"
you can check your jdk version with
java -version
or
ls /usr/lib/jvm
Java SE Development Kit 9 is not compatible with the Netbeans IDE 8.2.
My Solution:
Delete the current JDK 9
Install this previous trust version of JDK: JDK 8
Modify the following file: \Program Files\NetBeans
8.2\etc\netbeans.conf to the given folder path of the newly installed JDK 8: netbeans_jdkhome="C:\Program
Files\Java\jdk1.8.0_151" (example)
Faced same issue with jdk 10. While installing netbeans prompted for jdk default location was taken as jdk 10. This was the issue, it should be jdk8 (1.8).
Close Netbeans
Open below file
C:\Program Files\NetBeans 8.2\etc\netbeans.conf
Comment jdkhome line jdk9 or jdk10 with # sign:
# netbeans_jdkhome="C:\Program Files\Java\jdk-10.0.1"
Add new jdkhome line for jdk8:
netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_171"
Start Netbeans
Note: If the above .conf file is not editable, then use Administrator mode. I use Notepad++, it prompted for restarting Notepad++ in Administrator mode, then save worked fine.
I had the same issue,
Quit Netbeans.
Delete the JDK9 file in : /Library/Java/JavaVirtualMachines
Install the JDK8 : Download link
Good luck :)
#ubuntu 18.04
sudo apt install openjdk-8-jdk
then
sudo update-alternatives --config java
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
* 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number:
choose java 8 then restart netbeans
Done
Yes it s working: remove the path of jdk 9.0 and uninstall this from Cantroll panel instead install jdk 8version and set it's path, it is working easily with netbean 8.2.
I tried setting netbeans_jdkhome="/path/to/jdk-9.0.4" in netbeans.config of "C:\Program Files\NetBeans8.2\etc" in Windows 10. It shows a notification "Unexpected Exception".
For anyone that wants to download jdk 8 without an oracle account: https://download.oracle.com/otn-pub/java/jdk/8u271-b09/61ae65e088624f5aaa0b1d2d801acb16/jdk-8u271-windows-x64.exe copy and paste the link. Jdk 15 didn't work for me so i tried using jdk 8 and it worked.
Open notepad as administrator(right click on it then click run as administrator)
Open the following document from Netbeans directory via Notepad file->open. Make sure where it was installed.
C:\Program Files\NetBeans 8.2\etc\netbeans.conf
Add the following path;
netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_171"
Save it as netbeans.conf in the same place.
Now open the Netbeans.. Everything will work properly but you will be notified regarding jdk path in the beginning..
This is how it worked for me :
Open Netbeans - A start page will be opened automatically.
On start page you can see a tab named 'Activate Features', click on it.
Select
all plugins that are installed and appeared there.
Click on
'Activate' button. Restart the IDE. You are good to go.

Change enviornment to JDK in Eclipse Luna

I am using Eclipse Luna (Java EE IDE). I need to add jdk because my project is been converted to maven. Whenever , I install maven console gives an error
No compiler is provided in this environment. Perhaps you are running
on a JRE rather than a JDK?
So i used Preference>installed jre's. However , when i am trying to change JRE to JDK by using Search button in Installed jre's. It shows me only JRE not JDK. Although , i am providing JDK path.
In short , I need to change my environment to JDK.
Thanks. Please help me out
In the preferences screen, remove the JRE listed there.
Add > Standard VM + Next > Directory + navigate to the jre directory inside jdk folder and Finish
If done right then JRE Home should look like "C:\Program Files\Java\jdk1.8.0_05\jre", NOT "C:\Program Files\Java\jre8"
Next, make sure you have the new JRE System Library listed under the Libraries tab in Java build path and in the Java Compiler (right click on project > properties) you define enable project specifics and set Compiler compliance level to the version you want.
Hope it helps.
Just open: Window-> Preferences ->Installed JREs and press SEARCH. Chose a folder and eclips find all avaliable jre and sdk.

How Do I make the Install4j IDE to upgrade to Java7 instead of Java6

I have upgraded to Java7 recently.
I had my install4j Project file in Java6.
Now in the Install4j IDE, I go to Media wizard and download 1.7 JRE's and select them for Windows. (I have window 7 64 bit.)
But When I go the Installer tab in IDE , where for some of the screens I have my custom code which is compiled in Java7.
It gives an error for the IDE java version lower than the compiled version(for those class files).
The Common Location where is the JRE for 1.6 was downloaded C:\Program Files\Common Files\i4j_jres
But the JREs for 1.7 somehow are never downloaded in the common location.
How Do I make the Install4j IDE to upgrade to Java7 instead of Java6.
Thanks
Sony
We had the same problem as you, so we just swapped out install4j's built-in JRE with the one we used to compile our custom code.
i.e. - replace "C:\Program Files\install4j5\jre" with the jre you use to build your custom actions.
Under General Settings->Java version, change the minimum version to 1.7

Point eclipse IDE to use another JRE / JDK other than one specified in JAVA_HOME

I am having two JRE / SDK in my development environment, however it was necessary in my situation to set JAVA_HOME to 1.4.2, this is causing my eclipse IDE to stop running as it required 1.6 and above.
May i know how i can modify eclipse ini or environment home to use my other 1.6 installation?
Please try the eclipse.ini entry above the varargs (the following two lines must be two lines in the eclipse.ini file)
-vm
C:\Java\JDK\1.5\bin\javaw.exe
Find the JVM
Right click the project in Package Explorer -> Configure Build Path
Add Library -> JRE System Library
Set JRE system library to JDK
Verify JDK is the reference library
From the menu in the top.. Proceed as follows--
Project-->Properties--> Java Build Path--> Libraries--> JRE System Library.
Now click Edit . Select Alternate JRE. Click Installed JRE. Provide path to your other JDK. Then FINISH.
That's it.