When I download and install Java 8 (JRE) from: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
I can see the folowing registry key:
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
"CurrentVersion"="1.8"
However if I download and install Java 8 (JRE) from:
https://www.java.com/en/download/
I got the following registry key:
[HKEY_CURRENT_USER\Software\JavaSoft\DeploymentProperties]
I need to detect if Java 8 (JRE) is installed, should I check them both? Are there other registry location I need to check?
What’s are the differences between the two installers? Are they both providing the same Java JRE or there are any differences?
Thanks
Maybe I would try different approach, try look for java(w).exe on system variable PATH. It should point to latest installation of JRE - assuming latest directory entry in PATH.
Also if your application require specific JVM then its also possible to include JRE with your application. Just pack it inside and make sure your JRE is started. Many companies doing it for very good reason.
You should consider 32bit installations on a 64 bit machine as well.
In Microsoft's techNet site I found a vbs script to be used to determine the java version. Hope it helps. TechNet article on determining the version of java on windows
Related
I understand that the Oracle Java Development Kit 11 (JDK) does no longer include a public JRE (Java Runtime Environment). However the documentation says it includes a private one (I actually don't understand what that means).
I installed the JDK 11 on Windows 10 64x according to the documentation and set the path system variable accordingly. When I type
java -version
at the command line I get informed that there is indeed a runtime environment in place.
However, when I now try to install e.g. a Plugin (Zotero) for LibreOffice that needs a JRE, it is NOT recognized ...
Why does this happen? Do I really need to install the separate JRE from Oracle to get it work?
I read the manual and the migration guide - sorry if this is a stupid question, but I'm stuck.
Thank you!
Andi
I have 3 installed versions of java (1.6,1.7,1.8) in my machine. Java alternatives has been configured to Java 1.8. So whenever i type java -version it is picking up from alternatives and showing java 1.8.
Here now i want to use other version of java (1.6 or 1.7), for that i have tried updating the .bashrc with other java paths. But still it is showing alternatives version (1.8)
Is there any way to override alternatives java from user level.
Here is a blogpost explaining how to change jdk version in a *nix environment from terminal:
https://www.jayway.com/2014/01/15/how-to-switch-jdk-version-on-mac-os-x-maverick/
There is no need to change your environment to switch Java version.
You can simply qualify the version you want to use. Alternatively, just make sure the version you want is first on the PATH, not last.
See my old answer for examples. It's for Windows, but it should work similarly for Linux.
https://stackoverflow.com/a/32365879/5221149
Found the fix
I did like below
export PATH:new_java_path:$PATH. Now it started working for the current session.
When the JDK already includes JRE for the execution of code, why do I have to download JRE separately to execute my java code is the doubt that's bothering me
As far as I remember this depends on your OS, browser and JDK version.
Eg. if you're using a 64-bit OS and installed a 64-bit JDK, but are using a 32-bit browser, then you might have to install a 32-bit JRE if you need Java support in the browser.
Otherwise a separate JRE installation should not be required, since the JDK installation also installs the JRE.
JRE: Java Runtime Environment. It is basically the Java Virtual Machine where your Java programs run on.
JDK: It is a group of utilities one needs to develop programs in Java including JRE, and the compilers and tools (like JavaDoc, and Java Debugger) to convert the source code into bytecode.
Refer: http://javarevisited.blogspot.de/2011/12/jre-jvm-jdk-jit-in-java-programming.html
Similar, post is there on below link as well.
What is the difference between JDK and JRE?
So I'm trying to get the latest version of Java. When I run:
java -version
I get:
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
When I run:
javac -version
I get:
javac 1.6.0_65
Now I've just downloaded and installed JDK 8. When I go into System Preferences --> Java --> Update, I see:
Your system has the recommended vesion of Java.
Java 8 Update 05.
I guess I have a few questions:
1) Don't I want the JDK and my version of Java to match up?
2) Why does my Java Control Panel claim I have Java 8, but my work in the terminal (when checking my Java version) says otherwise?
Thanks for the help,
Mariogs
The probably "simple" answer is you have two versions of java installed. On the command line you currently use 1.6. Thus the old one is active. In system preferences you see the version of java 8.
Windows:
You can change the version of the command line to java 8. Set PATH environment variable and JAVA_HOME or via windows preferences. I recommend the first one.
Mac: /usr/libexec/java_home is the starting point for switching java versions on the command line. Check out this post to understand how to handle different java versions on the Mac. IMHO this answer is a good solution.
The Java Platform offers both the JRE and the JDK in order for users to run Java programs. The JRE stands for the Java Runtime Environment, and the JDK stands for the Java Development Kit.
The JDK is meant for Java developers - that is, those who build applications/write programs in Java. It contains tools that are needed for Java coding, including -javac to compile programs.
The JRE is meant for regular users - those who only need to run Java programs on their computer and are not interested in development.
The reason for the discrepancy in your case is because you're looking at the JRE and JDK and trying to compare the two. The current JDK that you have is Java 8, whereas the current JRE that you have is 1.6.0_65. It is problematic that your JRE version does not match your JDK version, but without your PATH variable or other information about your install, we can't help you fix your installation.
1) Yes, if you use the JDK at all, you want the JRE (runtime environment) to come from the JDK (development environment) (a JDK necessarily includes a JRE).
2) Likely your path variable is set so that you invoke Java from your Java 6 installation; you need to find the equivalent for your Java 8 installation and set the path for that. Without information about your operating system, we can't help you do that.
We should know the reason for this
Our OS comes with a predefined (built-in)set of tools and utilities. When we try to execute the command e.g. cls in the Windows command line then it is already present in system path variable and os will refer the corresponding binary of cls to execute the command.
However, when we install any third party tool/software then path variable is not updated accordingly.
When we install different versions of java on your system then installations go to different directories. E.g. JDK installation directory for Windows will be
C:\Program Files\Java\jdk1.8.0_161
Similarly, JRE installation directory for Windows will be JDK installation directory for Windows will be
C:\Program Files\Java\jre1.8.0_161
We need to update the path variable of OS to point to the appropriate directory. If we set the path of JDK then it will execute a binary from JDK bin directory.
Solution
we need to update JDK or JRE version specific directory location into PATH Environment variable.
Let me see if I can clear it up for you.
1)Yes, arguably you nearly want this to be true.
2)It could be few things, but most likely that a previous instillation was not properly removed. So one gets called instead of the other.
How to check, is Java is installed on Windows systems ?
You can read this out of the registry. Look in this key:
HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment
and read the string value named:
CurrentVersion
This setting lives in the 32 bit view of the registry, so if you ever build 64 bit code make sure you include the KEY_WOW64_32KEY flag.
Visit the officail website http://www.java.com/en/download/testjava.jsp and click "test currently installed version of java"
Some information which might be helpful:
a Java run time environment (JRE) can be installed by simply copying it to the computer (no Windows system entries are required)
there can be many different JRE versions on the computer at the same time (many commercial apps are bundled with their own JRE)
your Delphi app could check whether there is a java.exe in the system path (and so avoid scanning all folders)
the JAVA_HOME environment variable normally indicates the location of the Java Development Kit (JDK), but in a typical installation the JDK directory also contains a JRE folder
For my Inno Setup I check this key :
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\javaw.exe
If I remove JAVA the key doesn't exist anymore.