how do you determine the update package of your jdk? when i run
javac -version
I get the following 1.7.0
does this mean there have been no updates applied?
should running the update from the java icon in the tray or from control panel update the jDK as well as the JRE or just the JRE
Is there a way to update vs re-install java?
You can use the command line option -fullversion,
java -fullversion
or (as other's have noted),
java -version
or you could use some code
String version = System.getProperty("java.version");
System.out.println(version);
Is there a way to update vs re-install java?
If you use Windows java can check for updates. If you use Linux you can get updates automatically in depend from settings of package manager. More detailed answer depends from your OS.
Related
I am new to mac. Running the javac / java -version command yields negative result. However, I do see java under system preferences. I have not installed JDK/JRE yet. On clicking the java icon, under update, it shows that the system has the recommended version of java. Java 8 update 144. What is the java icon doing under system preferences when I have not installed JDK/JRE.
It is JRE, which comes along with OS by default. I'm not sure, how did you executed java -version command. In my case, I get proper information about installed JRE.
You probably need to check your User and System variable under Java
Also, it is obvious to get error when executing javac without installing JDK.
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.
Still trying to get Eclipse IDE to work and running into Incompatible JVM error. I followed the steps here: I installed Java 7 but Eclipse keep saying that 1.6 is not suitable for this product
But unfortunately to no effect. Running OSX 10.9.5 and uninstalled the out-of-the-box version of Mac. The new version of Java seems to show up in the System Preferences. Please see attached screen capture. I've even done some of the basics like restart my computer, etc. Maybe there are other modifications I need to make to other files. I'm comfortable with Terminal but new to Eclipse and Java.
I have had the same problem as noted above. I could not get Eclipse to install because of Java incompatibilities. The sequence I followed goes like this:
Upgraded to MAC OS Sierra
Downloaded the Eclipse installer but was prompted that I needed to instal a legacy Java.
Installed Java 1.6
Was unable to install Eclipse and was prompted that I needed Java 1.7 or greater. Downloaded and installed Java 1.8
Ran the terminal code 'java -version' // this will check your jre version. This showed returned Java 1.6 despite the fact that I had upgraded to 1.8. The Java version listed in the Java control panel said 1.8
Tried multiple downloads of eclipse and Java and multiple restarts always with the same result.
Visited the Oracle web page noted above:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html I could not find the above reference to 8u73 and 8u74 but I did find and option to download 1.8.0_12. I did this. It installed without difficulty, and then I was able to install Eclipse without difficulty.
This took hours of my time. I hope this proves useful.
OK, so I don't really know what the problem was, but I simply fixed it by navigating to here http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html and installing 8u74 instead of 8u73 which is what I was prompted to do when I would go to "download latest version" in Java. So changing the versions is what did it in the end. Eclipse launched fine, now. Thanks for everyone's help!
edit: Apr 2018- Now is 8u161 and 8u162 (Just need one, I used 8u162 and it worked.)
JRE is a Run-Time Environment for running Java stuffs on your machine. What Eclipse needs is JDK as a Development Kit.
Install the latest JDK (and not JRE) from http://www.oracle.com/technetwork/pt/java/javase/downloads/jdk8-downloads-2133151.html and you should be good on Mac!
Open up terminal and check what java version is currently set in your path variable.
You can do that by typing in your terminal
java -version // this will check your jre version.
javac -version // this will check your compiler version
If this shows incorrect java version but you have installed java 1.8 then you have to set path variable to the newer version of java.
To do that do add the line:
export JAVA_HOME=/path/to/java/jdk1.x
to ~/.bash_profile (same as /Users/username/.bash_profile)
Then do this from the terminal to set the new variable
source ~/.bash_profile
Also what's your eclipse.ini set to ?
-Dosgi.requiredJavaVersion=1.7
EDIT:
Please open up terminal and type
find / -name "java" // This should find all folder named java on your file system.
Also how did you install java in the first place ?
Echoing the answer, above, a full install of the JDK (8u121 at this writing) from here - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html - did the trick. Updating via the Mac OS Control Panel did not update the profile variable. Installing via the full installer, did. Then Eclipse was happy.
Here are steps:
download 1.8 JDK from this site
install it
copy the jre folder & paste it in "C:\Program Files (x86)\EclipseNeon\"
rename the folder to "jre"
start the eclipse again
It should work.
For some weird reason "Java SE Development Kit 8u151" gives this trouble. Just install, "Java SE Development Kit 8u152" from the following link-
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
It should work then.
I'm using latest version of Eclipse Luna on Mac OS X 10.9.4. Whenever I try to open the Eclipse it says "version 1.6.0_65 of the JVM is not suitable for this product, version 1.7 or greater is required". I installed java 7 (JRE, I don't need JDK) but still I'm getting the same error. I tried java -version and the output was "java version 1.6.0_65". I can see the java icon on my system preferences. I also restarted my Mac to see if that works but that doesn't help either. I searched on google and some people suggesting other users to change Eclipse.ini file, the instructions wasn't clear and I'm a java beginner so I've no idea where and what to edit. Any step by step instructions will be appreciated.
I had this same problem with a fresh install of Eclipse Mars on OSX. I had installed the JRE from https://java.com/en/download/ (which is the top google search result for "java download" for me.
This failed for me with the same message "version 1.6.0_65 of the JVM is not suitable for this product, version 1.7 or greater is required"
Then I saw a comment that I should get the JRE/JDK from oracle instead:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
After downloading the most recent JDK from Oracle Eclipse starts fine.
A potential solution to your problem might be to uninstall Java6 (provided by Apple itself) and only have Java7 installed in your system. This only applies in case you have no applications that desperately need the old Java6 version to be installed.
To remove the Apple-like Java6 installation open a Terminal and:
sudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
After this step you should only have Java7 by Oracle installed in your system. To verify, open another terminal and do a:
java -version
It should display something like "java version "1.7.0_XX" where XX is the current update version of the Java7 installation. If not: proceed with the next step.
Redefine the JAVA_HOME variable (to support IDEs like Eclipse and other developer tools...), which helps detecting where the "active" Java installation is situated in your system. Open a terminal and (Note: replace XX first!):
sudo rm /Library/Java/Home
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_XX.jdk/Contents/Home /Library/Java/Home
Afterwards, a fresh installation of Eclipse should detect Java7 in your system and should work with this version out of the box. You can modify an installed Eclipse to use this installation by navigating in Eclipse to:
Preferences -> Java -> Installed JREs. Then remove the old Java6 system entry AND add new path (see above) with the name Java7.
You can modify Info.plist inside Eclipse.app (right clic on Eclipse.app --> show package contents) and specify -vm after <key>Eclipse</key>.
For example :
<key>Eclipse</key>
<array>
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/bin/java</string>
<string>-keyring</string><string>~/.eclipse_keyring</string>
<string>-showlocation</string>
</array>
Ensure you installed the jdk 7 or above. If you have a Mac you most likely have 1.6.0.jdk. To check your java development kit (jdk) version go to the terminal and browse to:
/Library/Java/JavaVirtualMachines
Next, if you see 1.6.0.jdk then you did not install the latest version of the jdk. Go to http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html to install the latest jdk. Next use the browse out to the same file path aforementioned and ensure the latest jdk is in there (i.e. jdk1.8.0_141.jdk).
To specify Java 6 for OS X:
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
For versions of Mac OS X 10.7+ the location has changed to
/Library/Java/JavaVirtualMachines/<''jdk_name_ver''>/Contents/Home/...
eclipse.ini > Specifying the JVM
Try any of these solutions
How do I run Eclipse using Oracle's new 1.7 JDK for the Mac?
Mountain Lion with Java 7 only
Eclipse still using java 6 as jre on Mac OSX
As I found out, we don't need to un-install an existing Java 1.6. Just installing or deploying a newer version 1.7 or 1.8, and setting the JAVA_HOME, along with the below given activities will solve the issue.
Check your c:/Windows/System32 (as I had this issue in windows). You will find junk java processes (java.exe, javaws.exe etc). Delete them all.
Deleting just java.exe will reflect in your PATH but eclipse still picks the javaws from c:/windows/system32. This is because, usually in PATH, you will have C:/Windows/System32 as the first entry. So, this will override any JAVA_HOME entry in the path.
Try starting the eclipse. It should work like charm! Atleast it did for me.
Try this
https://gist.github.com/johan/10590467
You might have to disable SIP and reenable it.
Okay so I have been struggling with this issue for a few days with Eclipse Neon and Oxygen. I was doing the below steps -
Check java -version from Terminal. It showed version as 1.7
Go to System Preferences -> Java -> Update Java version. Version 1.8 was downloaded and updated.
Went to Terminal again to confirm and this time it showed the version as 1.8.
But it still didn't work!! What was I missing now??
Here is what you need to keep in mind -- By default when you type the below command it shows the JRE version.
java -version
You need JDK to start your Eclipse installation. Please go to Java download page
and download the latest JDK version and you should be good to go.
Don't try to remove the Java in /System/Library/ - firstly this will not be allowed (you need to login as root user) and secondly you don't know the dependencies this Java version has on your other applications. Hope this helps!
Check your system variables ($JAVA_HOME specifically). This may be helpful:
http://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/
Install the updated JDK
Update the environment variables: here's how
If still not working uninstall the older JDK
I see that you have installed the Java plugin and not the jdk. You can download the JDK from Oracle Downloads section.
You can remove the Java Plugin and install JDK from oracle downloads to resolve your issue.
I have had the same problem as noted above. I could not get Eclipse to install because of Java incompatibilities. The sequence I followed goes like this:
Upgraded to MAC OS Sierra
Downloaded the Eclipse installer but was prompted that I needed to instal a legacy Java.Installed Java 1.6
Was unable to install Eclipse and was prompted that I needed Java 1.7 or greater. Downloaded and installed Java 1.8
Ran the terminal code 'java -version' // this will check your jre version. This showed returned Java 1.6 despite the fact that I had upgraded to 1.8. The Java version listed in the Java control panel said 1.8
Tried multiple downloads of eclipse and Java and multiple restarts always with the same result.
Visited the Oracle web page. I could not find the above reference to 8u73 and 8u74 but I did find and option to download 1.8.0_12. I did this. It installed without difficulty, and then I was able to install Eclipse without difficulty.
I'm trying to run a parser built in Java, but every time I try to use the class, I get the above error ("Exception in thread "main" java.lang.UnsupportedClassVersionError: danbikel/parser/Trainer (Unsupported major.minor version 50.0)").
From what I've read, this may be a problem with a mismatch between the versions of Java used to compile and run the code; but I've made sure that my JAVA_HOME environment is set to version 1.6, which is the version recommended by the parser's installation guide.
There are older versions of Java installed on the server, but I can't do anything about that. Is there anything else I can do about this error?
Use sudo update-alternatives --config java and set the version you may want to use if you are using a Debian-derived distro (such as Ubuntu).
Aside from setting JAVA_HOME appropriately (which you've done), ensure that you're executing the right version of the java executable. e.g., on Debian or Ubuntu, execute /usr/lib/jvm/java-6-openjdk/jre/bin/java directly, if /usr/bin/java points to the wrong version.
You can use the -version option to verify the version of the launcher you're using. Try java -version and /usr/lib/jvm/java-6-openjdk/jre/bin/java -version and see if the output is any different.
Making sure that JAVA_HOME is set to a particular Java installation is not necessarily enough.
If you have more information on your server and the configuration environment used it would be helpful.
I would make sure that your PATH environment includes ${JAVA_HOME}/bin:${PATH} if you want to make absolutely sure you are using the correct version.
It is likely that your java veriosn is still 1.5 even if you have set JAVA_HOME to 1.6
Type java -version on the console and see what version it prints.
I also had this problem and I resolved it after I found that I had set a custom JAVA_HOME value in my .bash_profile.
I commented this out, loaded a new console and now my project builds.
For me this worked:
1) install JRE 7
2) Install JDK
3) Go to Project Properties>Java Compiler. Set Compiler Compliance level to 1.7.Once you press 'Apply', it would ask you to rebuild the program. For most people that should do it.
For the rest, see a warning section(marked with an yellow '!' mark) appears at the bottom of the Properties window, where it asks to search for the compatible JRE.
Choose either to configure installed JREs or set your environment variable. Once you are done, you are good to go!