Differenet java version than the one i set in environment variable - java

I'm new to all the Java stuff so sorry in advance if i ever mislead.
I have Eclipse Java EE IDE for Web Developers. Version: Juno Service Release 2 and i installed JBoss Hibernate tools extension. And while i was trying to add a configuration as in http://furqanlabs.blogspot.com/2013/01/hibernate-and-oracle-configuration.html this tutorial, i got such an error:
"Project DmisService has higher compiler option than running Eclipse. Hibernate plugins unable to load its classes. Please decrease the compiler option or run the Eclipse with higher JDK level."
So to know which JDK level my eclipse is using i did the followings:
i typed java -version on the comman line and i came up with the following result:
java version "1.8.0_11"
and when i checked my environment variable for JAVA_HOME it is C:\Program Files\Java\jdk1.6.0_30. and the Java Compiler setting is also 1.6 (as jre of the project as i understood) for my project.
So i came up with another questions -> Why command line gives me different java version than environment variable?
and my original question:
what exactly (i am also new the java terms) should i do to fix this problem?
Thank you very much for any suggestion.
edit: i also checked with eclipse: System.out.println(System.getProperty("java.version")); and it gives me 1.6.0_30

Adding Eclipse Java 8 Support helped me to resolve the issue!
Ref : Eclipse + Java 8 support?

Related

Ant in Eclipse wants tools.jar but there's no tools.jar in Java 9/10

I'm trying to build a JavaFX application in e(fx)clipse using the build.fxbuild file. Unfortunately ant complains it can't find tools.jar. But tools.jar was removed starting from Java 9 (I'm actually using Java 10), so I can't add it to the ant classpath in Preferences > Ant > Runtime > Classpath. The actual error message on the console is this:
BUILD FAILED
<project_directory>\build\build.xml:59: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre-10.0.1"
My JAVA_HOME environment variable is also set to point to JDK 10, it's included in PATH as well, so I also don't understand the last line. What can I do in this situation?
TL;DR - update your Eclipse / e(fx)clipse installation.
According1 to this blog posting e(fx)clipse 3.0.0 supports Java 9. (Apparently a lot of changes were required to get rid of dependencies on Oracle implementation classes.)
The Eclipse project page for e(fx)clipse 3.0.0 says that:
it was released in June 2017
it is part of the Oxygen release(s)
There is no specific mention of releases supporting Java 10 or later (yet), but another blog post talks about how e(fx)clipse will have to cope with JavaFX11 being unbundled from the standard Java SE distributions.
1 - I am not in a position to validate this information ...
Are you using an older version of eclipse or is your JAVA_HOME incorrect?
First, download and use java 9 or 10 JDK.
Set your environment variable correctly (don't use JRE location),
Update your path to include the bin folder in your JDK folder
Make sure you have a recent version of eclipse

Can I have two versions of the JDK on my computer?

I'm trying to set the IntelliJ IDEA JDK to version 1.8 (because it's the latest). When I navigate to System/Library/Frameworks/JavaVM.framework IntelliJ IDEA shows 1.6. When I type java -version it shows 1.8. I found that command under "Finding default JDK on OSX" https://www.java.com/en/download/help/version_manual.xml
I'm confused what versions of the JDK I have... and where they are located. Appreciate any help.
Yes, you can. You have JDK 1.6 and 1.8 installed on your computer. According to the Jetbrains website, all their products require Apple JDK 1.6 to be installed in order to run on Mac.
To make IntelliJ IDEA use JDK 1.8, you will need to edit /Applications/<Product>.app/Contents/Info.plist file and change JVMVersion from 1.6* to 1.8* :
<key>JVMVersion</key>
<string>1.8*</string>
To start off java will usually uninstall any version of the JDK when you get an update. Secondly if you want to check to see what version you are running I would go into what ever you are using to program and see what version you are compiling under (For example netbeans or eclipse). If it says 1.8 that is what you are running and same for 1.6. If this is really becoming a super big problem all you have to is uninstall java then re install and it should fix it.
You can have many different versions of Java on your system. In general Java depends on environment variables and the PATH environment variable. Some programs and tools look for tool specific environment variables to allow you to use a specific version of Java for that particular tool.
In the case of IntellJ the link that Eddie B posted in his comment explains how IntellJ determines which "installation" of Java it should use.

Upgrade Java version for Web Application

I have a web Application and i need to upgrade java jre version from 6 to 7 .I am using Eclipse as IDE.I tried to update the Jre from eclipse .I have even updated the JAVA_HOME environment variable but i am getting following error
C:\Program Files\Java\jdk1.7.0_55\jre..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
Thanks
Download java hereand install it as a common application.
Then in Eclipse use Window->Prefrences->Java->Installed JREs
#Roman Bondar I guesss OP wanted to know more than just the setting.
Basically, JREs are meant to be downwards compatible, so that you are able to execute java classes compiled with version 6 with a runtime from java 7.
But as always, there may be special cases when things have to be changed, e.g. container or libraries. I remember a case back when I migrated to java 6 that it required a special version of JBoss.
Check out this Oracle blog as a starting point.

Setting up IntelliJ IDEA with Java 1.8/1.7 and resolve "java: System Java Compiler was not found in classpath"

Let's make the long story short. Here is what happened:
IntelliJ 12 CE downloaded and installed
Latest Java 1.7/1.8 downloaded and installed
JDK was setup to make and run the project
I faced the following strange error:
Error: java: System Java Compiler was not found in classpath
This was despite of the fact that I had Java 1.7/1.8 fully installed and had no problems working with it through the terminal.
The solution that fixed my problem was as follows:
In:
Project Settings > Compiler > Java Compiler
I changed the drop down Use compiler from Javac to Eclipse!
Non of the other solutions I found on the web was helpful. Hope this helps you my unknown fellow reader.
IMPORTANT: THIS HAD NOTHING TO DO WITH MY JAVA_HOME AS IT WAS SET CORRECTLY.
You need to set environment variable JAVA_HOME. The IDE will check that variable on startup.
And enter the path to the home dir of installed JDK. Once it started it should point to the JDK used to run IDE. In this case the new compiler will be available among compilers already configured. You can always configure any new compiler using IDE compiler settings.
i found that if you install vscode java plugin in your mac , IDEA will not work correctly.
so disable the java plugins in vscode.
Every thing gonna be alright

Eclipse Galileo is not running over Java 1.8 machine

I have Eclipse Galileo version with Java 1.8 machine and it's not running.
I also have another newer version which is running well, but I need to use this exact version.
What can I do to fix it?
EDIT 1:
The Java version is 1.7 and not 1.8
Attached the message that I got:
**EDIT 2:
The main reason why I need this exact Eclipse version, it's because that I don't JBoss server in this list:
**
I can see you're using Java 7 to run your eclipse. Noted by this line in your configuration:
-vm C:\Program Files\Java\jdk1.7.0_71\bin\..\jre\bin\server\jvm.dll
^ this points to JDK 1.7
Change it to the place you have installed Java 8. Also, use absolute paths here, avoid using things like ...

Categories

Resources