Sorry that I have to ask this quite easy question. I am using OSX with Java 8 installed and maven. But I can't mvn install a code using string in case. Can you point out what's wrong?
mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /usr/local/apache-maven-3.3.9
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
Default locale: zh_TW, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.2", arch: "x86_64", family: "mac"
Code error msg
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/Briancheung/Documents/projects/webcompiler/dev/parser/src/main/java/project/Preference.java:[40,23]
strings in switch are not supported in -source 1.5
(use -source 7 or higher to enable strings in switch)
[INFO] 1 error
It seems that maven is not using Java 8 JDK I have installed. Thank you for any response.
java -version
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)
javac -version
javac 1.8.0_45
Related
I'm using WSL (Ubuntu shell) in Windows. I installed Java and Maven and once I run Maven from Ubuntu shell I get:
$ mvn
[ERROR] Error executing Maven.
[ERROR] java.lang.IllegalStateException: Unable to load cache item
[ERROR] Caused by: Unable to load cache item
[ERROR] Caused by: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper
Of course it doesn't happen once I run Maven from the "regular" Windows shell.
Do you know what I can do to resolve it?
Edit:
$ echo $JAVA_HOME
/usr/lib/jvm/java-17-openjdk-amd64
$ java -version
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, sharing)
$ mvn -version
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 17.0.2, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.10.16.3-microsoft-standard-wsl2", arch: "amd64", family: "unix"
Thanks to #Turing85 for referring me to the bug.
I stayed with Java 17, but I downloaded Maven version 3.8.5.
You can see an explanation here how to do it:
https://websiteforstudents.com/how-to-install-apache-maven-on-ubuntu-linux/
Immediately after I upgraded my Mac from maven 3.6.0 to 3.6.3 with homebrew, I was no longer able to build my maven project. I've been through torrents of version dependency problems, etc, but I'm hoping to avoid stepping through any more of that stuff than I need to. And before I continue, I wanted to bounce this off of you guys to see if it indicates anything ominous, or if it's ops normal (since I've never paid too much attention to it in the past.) In question is the variance in java version numbers between mvn --version and java -version, i.e., 1.8.0_191 vs 14.0.1:
$ java -version java version "1.8.0_191" Java(TM) SE Runtime
Environment (build 1.8.0_191-b12) Java HotSpot(TM) 64-Bit Server VM
(build 25.191-b12, mixed mode)
mvn --version Apache Maven 3.6.3
(cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home:
/usr/local/Cellar/maven/3.6.3_1/libexec Java version: 14.0.1, vendor:
N/A, runtime:
/usr/local/Cellar/openjdk/14.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x",
version: "10.15.6", arch: "x86_64", family: "mac"
Thanks in advance!
Turns out my JAVA_HOME variable somehow evaporated in the homebrew upgrade. Once I set that, all 12 million problems disappeared instantly. Thanks for the comment khmarbaise!
~$ java -version
java version "1.8.0_212"
Java(TM) SE Runtime Environment (build 1.8.0_212-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.212-b10, mixed mode)
~$ mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:47+05:30)
Maven home: /opt/maven
Java version: 1.8.0_212, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "4.13.0-37-generic", arch: "amd64", family: "unix"
apache tika 1.23
apache ctakes 3.2.2
ubuntu 16.04 LTS
I have followed the steps on the official site.
while the step
java -classpath $HOME/src/ctakes-config:${TIKA_HOME}/tika-app/target/tika-app-X.Y-SNAPSHOT.jar:${CTAKES_HOME}/desc:${CTAKES_HOME}/resources:${CTAKES_HOME}/lib/\* org.apache.tika.cli.TikaCLI --config=$HOME/src/ctakes-config/tika-config.xml -m Vose-2013-American_Journal_of_Hematology.pdf
I am getting this error:
Error: Could not find or load main class org.apache.tika.cli.TikaCLI
please help
Probably you did not set the variables TIKA_HOME and/or CTAKES_HOME in the environment you want to run the command.
Uninstalled all version of java from my machine and reinstalled the version 7 of Oracle:
$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
$ mvn -v
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: pt_BR, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-61-generic", arch: "amd64", family: "unix"
why when using the foreman start the application works locally and when I do the build by Jenkins and implant in heroku the application launches java.lang.UnsupportedClassVersionError exception and Unsupported major.minor version 51.0? I'm using the wrong dependence? Where am I wrong?
I'm not getting solve this problem.
Any help will be very welcome!
Given the following:
> mvn clean compile
...
[ERROR] Failure executing javac, but could not parse the error:
/bin/sh: c:/progra~1/java/jdk1.6.0_24/bin/javac: No such file or directory
checked that my mvn and java versions were correct:
$mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T07:57:37-04:00)
Maven home: /Users/kevin/Downloads/apache-maven-3.3.3
Java version: 1.8.0_51, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.4", arch: "x86_64", family: "mac"
$java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
Unsure of a problem with my brew-installed mvn, I removed it and downloaded mvn-...bin.zip from Apache. Then I set my PATH, verified that mvn -version and java -version spit out the same versions. But, I'm still having the same problem.
I looked at the top 3 (from search) StackOverflow results, but have not gotten any further:
Maven compilation error. Failure executing javac, but could not parse the error:javac: invalid flag: -s
Maven, Failure executing javac: Compilation failure
Compilation error: Failure executing javac, but could not parse the error
You should check your JAVA_HOME variable or pom.xml for this Windows-specific path: c:/progra~1/java/jdk1.6.0_24/bin/javac and change it to your real JDK installation path (/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre?).
I ran into similar issue when i started using a newer version of java.
In your case Maven is using java 6. Try setting JAVA_HOME environment variable to correct JDK version. I guess JAVA_HOME is pointing to jdk 1.6.