When I execute "mvn --version" I get this error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:144)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Maven version I installed is maven 3.3.3
My java version is:
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
echo $PATH returns:
/Library/Maven/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
How to solve the problem of Maven?
$JAVA_HOME should be pointing to 1.8.0_65 as in your case.
If you want it to permanently change the value of JAVA_HOME, you will have to add the command to your ~/.profile file. Below are instructions on how to accomplish this instead:
Open up Terminal.app (Applications → Utilities → Terminal)
Type:
emacs .profile
Add this to the end of the .profile file:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
export JAVA_HOME;
Note that JAVA_HOME should be the path of your JDK directory.
Save and exit emacs (ctrl-x, ctrl-s; ctrl-x, ctrl-c)
Open a new Terminal window (cmd-n) and type:
$JAVA_HOME/bin/java -version
Related
When trying to run namenode -format, I am getting below error. Can anyone please suggest how to resolve it? ( On mac os x 10.9.4 version. Hadoop 2.7.1 version)
Pro:hadoop-2.7.1 hadoop$ bin/hdfs namenode -format
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/hadoop/hdfs/server/namenode/NameNode : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Java Version is as below...
Pro:hadoop-2.7.1 hadoop$ java -version
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)
In hadoop-env.sh path given as
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
51 Major version of Java class file format conforms to Java 7.
The Hadoop library in your version require Java 7, but you try to run it on Java 6 runtime which will not work.
i have added the ojdbc6.jar and the ojdbc6_g.jar file in the .bashrc but i keep getting the driver error:
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at jdbcdisplay.main(jdbcdisplay.java:17)
I have added the following Classpath to the .bashrc file for the ojdbc6.jar file:
export CLASSPATH=".:/home/shawnreese/Downloads/ojdbc6.jar:/home/shawnreese/Downloads/ojdbc6_g(1).jar"
The jar files are not even detected.They just keep showing the same error.On performing echo ${CLASSPATH} i get the jar file of opencsv.jar added in .bashrc.
.:/home/shawnreese/Downloads/opencsv-2.3/deploy/opencsv-2.3.jar
I am using java version:
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
and Oracle 11g Release 2.
I have a problem with compiling this java project https://github.com/nkitsul/pdfformfiller2
mkdir PdfFormFiller
cd PdfFormFiller/
git clone https://github.com/nkitsul/pdfformfiller2.git .
cd lib/
wget https://github.com/itext/itextpdf/releases/download/5.5.0/itext-5.5.0.zip
unzip itext-5.5.0.zip
cd ..
mkdir bin
javac -cp lib/itextpdf-5.5.0.jar PdfFormFiller.java -d bin/
java -cp ./bin PdfFormFiller.PdfFormFiller
After that I get this:
Exception in thread "main" java.lang.NoClassDefFoundError: com/itextpdf/text/DocumentException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getMethod0(Class.java:2774)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: com.itextpdf.text.DocumentException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
What am I doing wrong?
My OS - Debian wheezy java version "1.7.0_55" OpenJDK Runtime
Environment (IcedTea 2.4.7) (7u55-2.4.7-1~deb7u1) OpenJDK 64-Bit
Server VM (build 24.51-b03, mixed mode)
javac 1.7.0_55
Add the iText JAR file to the runtime classpath
java -cp ./bin:lib/itextpdf-5.5.0.jar PdfFormFiller.PdfFormFiller
Folks, trying to automatically generate UML diagrams from code to speed up the discovery process. I've come across a project that does exactly what we need, http://www.umlgraph.org/doc/indexw.html
After the installation, I get the following:
umlgraph test png
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/umlgraph/doclet/UmlGraph : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.umlgraph.doclet.UmlGraph. Program will exit.
Java version on the system:
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.11.90) (rhel-1.62.1.11.11.90.el6_4-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
Can someone please point me in the correct direction? Does anyone use a similar project? Thanks!
It looks like umlgraph 5.6_6.1-SNAPSHOT was compiled for Java 7 only. Here's a snapshot from it's build.xml:
<javac srcdir="${src}" destdir="${build}" debug="true" deprecation="true" >
<compilerarg value="-Xlint"/>
</javac>
No "target" attribute set explicitly, so platform java version is used. And from JAR manifest it's obvoius, that it was compiled on java 1.7
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.7.0_21-b11 (Oracle Corporation)
So you can either install Java 7 to run umlgraph, or use the older version of ulmgraph, which was compiled to be compartible with Java 6.
I'm trying to install Jigsaw on Linux. I have installed on my machine JDK.here is the message of java -version:
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
I followed your instructions but when I execute install.sh I receive:
./install.sh: 5: cd: can't cd to Jigsaw
Errore: impossibile trovare o caricare la classe principale Install
So I choose the manual way exporting CLASSPATH but when I execute java Install here it is the message
Jigsaw/2.2.6 setup.
updating /home/mazzy/Scaricati/Jigsaw/Jigsaw/config/http-server.props ... Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/jigsaw/http/httpd
at Install.install(Install.java:134)
at Install.main(Install.java:210)
Caused by: java.lang.ClassNotFoundException: org.w3c.jigsaw.http.httpd
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 2 more