How does Eclipse differentiate JDK and JRE for the "Installed JREs"? - java

I have a jdk1.8.0_92 installed, which is also added to the Java/Installed JREs in Eclipse Neon. The "bin" subfolder containing the java compiler and all other components of a standard JDK is there. Still, when I try to assign this JRE as a "Server Runtime Environment" of a GlassFish server, Eclipse complains it needs a JDK and not a JRE. An older jdk1.7.0_55 folder does not produce this problem, it is considered to be a JDK by Eclipse, and not a JRE. What may be missing from the 1.8 installation, by which Eclipse categorizes it as a JRE? Image of the error message :

Okey, check this
glassfish\config\asenv.bat
where java path is configured
REM set AS_JAVA=C:\Program Files\Java\jdk1.8.0_92\jre/..
set AS_JAVA=C:\Program Files\Java\jdk1.8.0_92

Related

No JREs found in C:\\Program Files\java in Eclipse Scala IDE

JDK 1.8 is already installed in Windows 10 64 bit system. I am trying to create a scala project in Eclipse Scala IDE. Is says "Unbound classpath container: JRE System Library [JavaSE-1.8] in project.
While checking the Java build path-- Libraries-- JRE is coming outbound.
When I click to add JRE library, it has workspace default JRE (unbound)
While searching through preferences-- installed JRE--search. It gives no JREs.
If I try to add -- standard vm--directory ( JDK dir home). Ideally it should populate or detect all the jars but it doesn't detect.
I Tried running the application as 'Administrator' and it ran successfully.
Select your project and right click--> Build Path --> Configure Build Path -->Select Libraries--> Add Library-->JRE System Library--> Add the installed JRE here.
And if the JRE library is not getting selected, check the environment variables- JAVA_HOME and Path.
And to see if the java is correctly installed, try hitting this from CMD
java -version

Netbeans would not find compatible jdk while installation

Netbeans would not find compatible jdk while installation while JDKs are located at C:Java and the files are:
jdk-8u73-windows-i586
jdk-8u73-windows-x64
jdk-8u141-windows-i586
From NetBeans Installation Instructions
The default location in Windows is C:\Program Files\Java\jdk1.7.0_10 or similar.
If your JDK is at C:\Java you just have to:
re-install the JDK under the default Netbeans location, or
specify your custom location during the installation wizard
Since I've run into this problem and this Q/A came up in my search, here is the solution that I found worked for me on the Windows platform.
I had to set up an system environmental variable named JAVA_HOME that pointed to the JDK directory.
JAVA_HOME=D:\Program Files\Java\jdk1.8.0_144
Even after this change, I still ran into the "An unknown error occured while validating path."
Right-click on the NetBeans install software and select "Run as Administrator...". It looks like running the installer under your normal account, even though it may have admin rights, is not enough to scan the "\Program Files" folder and find the JDK.
*Delete your old java files.
*Download jdk file from.
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
*install new jdk version.
*Then install NetBeans //Now it will automatically identify your jdk and no need for manual selection...

Get JRE version from System Property

It's not a duplicate. I would like to get current JRE version while program is executing.
To test result I've installed JDK 8.91 (without JRE 8.91 installation) and JRE 8.77. Also I've created JRE_HOME, JAVA_HOME variables, excluded Path variable with JDK folder.
My Tomcat uses JRE so I would like to get current JRE version before I will launch it. I found solution like:
System.getProperty("java.version")
After executing
System.out.println(System.getProperty("java.version"))
I get result 1.8.0_91 Instead of 1.8.0_77, which I wanted to get.
However, Oracle documentation gives the definition that this is JRE version.
Link:http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html#getProperty%28java.lang.String%29
How can I fix it?
When you run a Java program, it always runs on a JRE (Java Runtime Environment). You cannot run a program on the JDK directly.
When you install Oracle's JDK, a JRE is included, you can find it in the jre directory in the JDK installation directory.
When you install Oracle's JDK, you get an option to install a "public JRE". This is a JRE that is installed separately from the JDK itself, and is used by browser plug-ins. You need this only if you want to be able to run Java applets in your browser.

Change The default settings of projects in NetBeans

I have netBeans 7.4 with openJDK 7 running on Ubuntu 14.04 x64 System.
I want to change the default "Source/Binary format" in java project setting to JDK 6 (I DO NOT WANT TO INSTALL OpenJDK 6 because I have openJDK 7 which is compatable).
Also in C++ Project, I want to change the default "Console Type" in the "Run" section of project settings from "Internal" which causes some problems to "Standard Output".
From the NetBeans doc:
Note: If a compatible JDK installation cannot be found, you might need to manually add a path to the JDK installation directory by doing the following:
Open the netbeans.conf file located in the netbeans/etc directory in a text editor.
Enter the location of a compatible JDK installation for the netbeans_jdkhome option. The default location in Windows is C:\Program Files\Java\jdk1.7.0_67 or similar.
Save the netbeans.conf file and run the executable file in the netbeans/bin directory.
https://netbeans.org/community/releases/80/install.html
Find the spot that needs changing by ctl-F JDK and tab down until you see where it is specifying the path. Hopefully your new JDK is located in the same folder and you only have to change the version number.
You should save a copy of the conf file as confold or something in case something goes wrong.

Android - Eclipse JRE not found

I have downloaded Android ADT Bundle and trying to create hello world android app.
I am following Setting up ADT Bundle which says just extract the zip file and launch the Eclipse.
I am getting following error
"A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations: C:\adt\adt-bundle-windows-x86_64-20131030\eclipse\jre\bin\javaw.exe ..."
I know I can install JRE (with or without JDK), and set up javaw.exe dir in path ENV and the problem will go away.
But I think i ADT bundle should be self sufficient and should not require any additional download. Peculiar thing is that I cannot find jre dir inside eclipse.
Am I missing some additional steps? if yes, what steps?
Not sure this the best way to do but if copy paste the JRE folder inside the ecplise folder it works.
But I think i ADT bundle should be self sufficient and should not require any additional download. Peculiar thing is that I cannot find jre dir inside eclipse.
I don't think so eclipse folder will be having JRE folder you have to specify the path JDK path in ENV.
Check Windows -> Preferences -> Compiler and Windows -> Preferences -> Installed JREs.
If not configure them. If you have not installed JDK(It has JRE in it) then install it first.
To verify type java -version in your command line.
You should get output like
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)
(Java 7 is latest but you can use any version that suits your requirement)
You should Install JDK and set class path. Because for compilation you need JDK not just JRE and JDK internally contain JRE.Therefore no need of installing JRE separately.

Categories

Resources