My Java Runtime Environment isn't updating - java

I tried updating to the latest version of JRE and I checked my Java Control Panel and it says I have the latest version. But when I go on my terminal and checked by typing
java -version
I'm getting
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
However, when I checked the version by typing
/Library/Internet\
Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
I did get the correct version:
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
What can I do to make sure I am running version 1.8? I need it to run elasticsearch and I've been pulling my hair out over the right version of java on my machine (Mac).

you can try to run this code
System.out.println(System.getProperty("java.version"));

Go to Control Panel\All Control Panel Items\System.
Click on Advance System Settings
Under Advance Tab, click on "Environmental Variables"
Under System Variable section check "path".
check under path what is set for java.

Check your environment variable path, it would be pointing to the earlier version
Update that path and again check. It should work

It looks like I need to download the entire Java Development Kit

Related

how to delete java completely from windows

I have messed up my windows java installation and i want to delete everything and re-install java , all of my java versions have been messed up and I don't know what to do in this situation
when I do:
C:\Users\LENOVO>echo %JAVA_HOME%
C:\Program Files\Java\jdk-17.0.1
C:\Users\LENOVO>javac -version
javac 17.0.1
C:\Users\LENOVO>java -version
java version "1.8.0_311"
Java(TM) SE Runtime Environment (build 1.8.0_311-b11)
Java HotSpot(TM) Client VM (build 25.311-b11, mixed mode, sharing)
Why is java -version showing different things?
I HAVE TRIED CHANGING PATH AND THERE IS NOTHING IN MY PATH RELATED TO JAVA 1.8.0.
I TRIED MANUALLY DELETING JAVA BUT IT ALWAYS SAID IT IS OPEN SOMEWHERE ELSE AND CLOSE THAT BEFORE MAKING ANY CHANGES HERE
first of all you must go environment variables and then delete all Java related paths and after that follow those links and delete them also from your local computer. It's done :)
I'm not sure how to fix the issue regarding it being open elsewhere but I'd recommend trying to open task manager to close Java that way.
As for uninstalling it, you can uninstall it as it is an app. Just open settings, go to apps, search Java, and uninstall it like so.

Different java versions on mac machine?

There is something going wrong with my java configuration and it is really bugging me. I am using IntelliJ IDEA and after downloading and installing java 8 I tried to configure my project to use that SDK but I could only locate version 1.6 under /Library/Java/JavaVirtualMachines/. I am new to OS X and I am really confused with the paths.
Looking on my Java control panel I can see I got installed Java 8 but after running java -version on the terminal I get 1.6.0_65.
And the which java gives back /usr/bin/java.
Please help I am completely lost
Here is an example with several Java versions installed side-by-side ...
ls /Library/Java/JavaVirtualMachines/
jdk1.7.0_25.jdk jdk1.7.0_72.jdk jdk1.8.0_05.jdk jdk1.8.0_25.jdk
User can edit ~/.profile to point explicitly at one
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_72.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
And here is result ...
java -version
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)
Well something was wrong with the installation. I completely removed the other versions (not 1.6) and reinstalled 1.8 using the default path (as there is no option to change it during installation. Now IntelliJ can see JDK 1.8
Thanks for the help anyway

Cannot use Java 7 installation if Java 8 is installed

I normally still use Java 7 for all my coding projects (it's a company "politics" issue), but I installed Java 8 for one third-party project I am contributing to. Now, it seems I cannot have Java 8 installed in Windows 7 x64, and still use Java 7 by default:
C:\>"%JAVA_HOME%\bin\java.exe" -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
C:\>java.exe -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
As you can see, JAVA_HOME is completely ignored.
I also have Java in the path, using "%JAVA_HOME%\bin", which resolve correctly to Java 7 when I check the path in a DOS box, but it still makes no difference.
I checked in the "Java Control Panel" (not sure if this affects the default command-line Java version). Under the "Java" tab, the "View..." button, you get to see "registered" Java versions. I can add all the versions under the "User" tab, but under "System" there is only Java 8, and no way to change it.
Am I missing something, or did Oracle just make it impossible to use Java 7, unless I de-install Java 8? I don't want to have to specify the "source" and "target" everywhere, and I don't even know if it is possible for me to specify it everywhere, where Java is used.
EDIT: What I did is I de-installed all Java. Then installed the latest Java7 (both 86 and x64), and then the latest Java8 (both 86 and x64). After I did that, I noticed that the x64 JDK was gone. It seems Java8 killed it. So I re-installed the JDK 7 x64, after the JDK 8 x64. Still, JDK7 x64 did not seem to "replace" the "java.exe" which is copied into the "Windows" directory itself (I assume THAT is the problem).
When you install jdk8 it adds an entry like this
C:\ProgramData\Oracle\Java\javapath
to beginning of your PATH environment variable, removing this entry should resolve your problem.
You can select the JRE version from the command line with the -version: option.
> java -version:"1.7" MyClass
should select the 1.7 JRE if installed properly.
The list of the properly installed JRE is in the registry, see the key :
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment (32bit)
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment (64bit)
You can set the "CurrentVersion" there if you want a different default version than the latest.
See http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html#options
Don't modify your PATH to point to a particuliar JRE, let the special java.exe in Windows/system32 do the job.
Windows and Unix both find programs using their PATH environment variable. You have an java.exe in your Windows\System32 which is appearing before your "preferred" version of Java.
Change the PATH to be the one you need, or specify the full path when you need a different version.
2 Steps
1
Change registry key **HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion** to point to 1.7
2
Copy java.exe,javaw.exe and javaws.exe from your java 1.7 version to Windows\System32 folder
(Since the corresponding files of java 1.8 are already there, you might have to overwrite with admin permissions)
3
(OOps actually not required 3rd step )
Open a new cmd window and check
java -version
Looks like you have to check where in your PATH is located your JAVA_HOME variable, the PATH is evaluated from left to right. A tip for you is to do all your Java system variables configuration at the beginning of your PATH.
PATH = %M2_HOME%\bin;%JAVA_HOME%\bin;C:\ProgramData\Oracle\Java\javapath;...
Probably that's why after doing this:
- java -version
you are getting this:
- java version "1.8.0_05"
because there are other areas in your PATH that are pointing to other java.exe, for example C:\Windows\System32 or C:\ProgramData\Oracle\Java\javapath etc.
I had to make 2 changes for it to work:
Changed the Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion' to 1.7 from 1.8
The Java 8 installation adds a new entry to the PATH environment variable 'C:\ProgramData\Oracle\Java\javapath'. I removed this entry from the PATH.

Java runtime environment error

This may seem trivial but I haven't been able to find a fix.
I've installed the latest Java runtime environment but when I run java -version on the command line, I still get Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
However, when I test my Java version in browser, it works fine.
How can I get Terminal using the latest java version?
see Installed Java 7 on Mac OS X but Terminal is still using version 6
maybe you need to select the java version you want to see.
I am assuming you are using windows..
from your command line
echo %PATH%
make sure your java PATH is pointing your latest java bin folder.
I am not sure about the Mac but Can you verify if you have symlink setup under /usr/bin?
ex. /usr/bin/java -> java_path
Maybe you can change this symlink to point to the latest java you have installed.

How to uninstall newer version of java and install older version?

java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)
Now I have a Java application which says
A different version of Java Runtime Environment (JRE) is required to use this application.
and it is 1.6.0_17...
What to do?
It's really strange that the software you are trying to run requires a very specific update release (such as Oracle Java 6 update 17). Update releases are compatible and there should not be a need to require a very specific release.
On this page you can download earlier versions of Oracle's Java implementation, including Java 6 update 17.
if you really want to have different version of the application running, then the keyword java needs to be fully provided with a path.
one good way is to export the java_home before you run the application and have the application always read the java home when starting the server.
export JAVA_HOME = c:\jdk7
JAVA_HOME/bin/java -server ...
export JAVA_HOME = c:\jdk6
You have to uninstall your current version of java and install the desired version.
You can found all previous version of java on this (Java Older versions) location.
If you are using windows you can directly uninstall and install the older version.
Note: we can use multiple versions in a system by changing the system or user environment variable to use some version as my current java version make or put the path as followed it should be pasted first in path
C:\Program Files\Java\jdk1.7.0_12\bin;.;
[;.;] this will indicate as current working directory and this version will only take as default version while installing java dependent sofware installations ex:netbeans,tomcat etc

Categories