I am working with SSL connections using javax.net.ssl.HttpsURLConnection. I upgraded from java 1.7 to java 1.8. I need to set SNI host names in SSLParameters using javax.net.ssl.SSLParameters.setServerNames(List<SNIServerName> serverNames). But the compiler cannot resolve the class SNIServerName. The compiler displays this error:
unable to resolve class javax.net.ssl.SNIServerName
My java version:
java version "1.8.0_121" Java(TM) SE Runtime
Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM
(build 25.121-b13, mixed mode)
How do I import SNIServerName or SNIHostName? AFAIK they have been introduced in Java 8. Is there an issue with my java version?
Just make sure that your JAVA_HOME is correctly configured. Just follow the steps mentioned below
vim ~/.bashrc
JAVA_HOME = <path to your java8 bin>
PATH = $JAVA_HOME:$PATH
save this and then
source ~/.bashrc
after this just verify by $JAVA_HOME on your terminal.
Related
I recently updated my java version to "Java 8 update 77".
As far as i know, this is the newest version...
My Java Control Panel prints the same information,
but when i switch to terminal to verify the java version:
java -version
it outputs:
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
When i type:
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
it prints correctly:
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
So, did i anything wrong?
Why are there two different versions listed ?
Thanks and Greetings!
When Java is updated, it doesn't override the older version. It keeps the older version and also installs new version.
You have to change your $JAVA_HOME environment variable if you want to use new version.
This Link May help
Open the terminal. Type...
nano ~/.bash_profile
Search for export JAVA_HOME. When you find the line, comment it out by placing a # in front of the line.
Type on the next line...
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
assuming that is where the jdk is. Press ctrl+o, ctrl+x.
Type source ~/.bash_profile. And you should be all set.
The second option that you have written about is where you are checking the java applet plugin version which does not need to be the same as the jdk runtime environment.
To make your .bash_profile future proof, you can try this
export JAVA_HOME="$(/usr/libexec/java_home)"
I setup Java 6 to be used by all other application. Normal setup with JAVA_HOME, JRE_HOME, etc. This is working fine.
I have another application that needs Java 7. I downloaded Java 7.exe and extraced tools.zip from it to a folder. Now I am trying to check the version going to the bin folder. When I type in java -version, I get the following error.
error occurred during initialization of vm
java/lang/noclassdeffounderror java/lang/object
where as java -fullversion shows Java 7. It looks like even though I am in the bin folder where Java.exe exists, it still getting the one from PATH?!?!
How do I use the java.exe from a folder ignoring the one from PATH?
You need much more than java to run java. You need all the rt.jar and lib which come with Java. It sounds like you are missing some part of the JRE or it can't find your JRE.
I suggest you re-install the version you need and run it using the full path name like
c:\>"c:\Program Files\Java\jdk1.7.0_60\bin\java" -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
c:\>"c:\Program Files\Java\jdk1.8.0_45\bin\java" -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
By using the full path name you can use any specific version from any directory.
I'm using Oracle JDK 1.8.0.45 on Kubuntu Linux which I installed following these instructions. I had to do the manual install since the automatic one didn't work.
Even with the Oracle JDK I still can't use javafx without manually setting the classpath. What could cause javafx to not be on the default classpath as it should be in 1.8?
EDIT: Java -version in terminal gives:
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
I am working on using Floodlight Controller for SDN. I used
ant eclipse
to setup the Eclipse files and then changed the Build Configuration as desired in the installation instructions. I am getting the following compilation error in the package net.floodlightcontroller.util.MatchUtils:
The method setMasked(MatchField<F>, Masked<F>) in the type Match.Builder is not applicable for the arguments (MatchField, Masked)
on lines 141 and 148.
Can somebody help me with the issue?
Operating System: Mac OS X 10.10
Java Version:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
As suggested in the comments above, it works with Java SE 1.7. There is also a Github Issue.
I have problem to use maven from ubuntu server 13.10 64bit.
I am getting following error (even when I type mvn -version):
Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/lib/jvm/jdk//bin/java
But when I type java -version I get:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
I have no idea where can be the problem, especially because I have used maven without any problems before I've installed hadoop 2.2.
Thank you in advance for any help.
It appears that the Hadoop instructions and/or start up script modifies the JAVA_HOME environment variable in the shell.
Unless this change is made permanent by changing one of the many configuration files - like $HOME/.profile - it only influences the shell in which you have observed the problem.