Does Maven need JDK - maven

I am new to Maven, Java ...when I do a mvn clean package on a Java project, it does create the JAR file for me.
But still how can I know if I have JDK or is it still JRE?
I am on OSX 10.8

Maven needs a JDK, and not a JRE.
Do this for more information on which version of Java you have installed:
echo $JAVA_HOME
echo $PATH
which java
java -version
mvn --version

Maven requires JDK for compilation.
To check if you have JDK compiler you can type: javac in terminal.

Related

Is javassist version 3.24.0.GA compatible with java 8?

I am currently on JDK 1.8. I am using javassist-3.18.1.GA.jar and I want to upgrade to 3.24.0.GA. I would like to know if javassist-3.24.0.GA is compatible with JDK 1.8 or not.
If not, then which version of javassist can be used that is compatible to JDK 1.8?
Thanks in advance
If you have already downloaded the javaassist-3.24.0.GA.zip then check the Readme.html file inside.
It has instructions on how to compile and run test classes(ex:- sample/Test.java) using your JDK.
You just have to run the below commands in command-line to compile and run Test class to check compatibility to JDK 1.8 when you are in the folder where Readme.html is located.
>javac -cp .;javassist.jar sample/Test.java
>java -cp .;javassist.jar sample.Test
There are multiple test classes available in sample folder for you to test javassist features.

Hi, i have installed JDK 16.0.1 version and in eclipse i have created a maven project and i want to add cucumber dependencies

have installed JDK 16.0.1 version and in eclipse have created a maven project and want to add cucumber dependencies, please help. have tried to copy the build and properties from others but version of java is different but changed to 16.0.1 but still not seeing the cucumber dependencies added
I wasn’t aware that maven ran with jdk 16.0.1. What version of maven are you running?

Maven UnsupportedClassVersionError Unsupported major.minor version 51.0

So I recently installed maven using homebrew. Seemed to be working fine. I got this error. I tried uninstalling then reinstalling maven. Now I can't even type mvn --version without getting this error.
I've double checked using
javac -version
and java -version.
I'm using 1.8.0_51.
That isn't the problem.
Any ideas?
Maven doesn't use the javac on the path, but is uses the JAVA_HOME. Execute mvn -v to see which Java version is actually used by Maven.

set mac jdk version to 1.8

I have searched several ways to change JDK version on mac.
$/usr/libexec/java_home
And I got
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
I tried
$export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
also tried
/usr/libexec/java_home 1.8.0_31 --exec javac -version
then I run
$echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
then I re-check java -version
$java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
How I can really change java -version on my mac.
To set Java to 1.8 for your shell environment, put this in your ~/.bash_profile:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
Solution without 3rd party tools:
leave all JDKs at their default location, under /Library/Java/JavaVirtualMachines. The system will pick the highest version by default.
To exclude a JDK from being picked by default, rename its Contents/Info.plist to Info.plist.disabled. That JDK can still be used when $JAVA_HOME points to it, or explicitly referenced in a script or configuration. It will simply be ignored by system's java command.
System launcher will use the JDK with highest version among those that have an Info.plist file.
When working in a shell with alternate JDK, pick your method among existing answers (jenv, or custom aliases/scripts around /usr/libexec/java_home, etc).

eclipse m2eclipse not working

the m2eclipse plugin is latest
the eclipse is the latest
the JDK is jdk7
the eclipse uses embedded maven version 3.xxx
I am keep getting this error “Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher”
It seems that there are some problems running the embedded Maven.
Try installing a fresh Maven version, then click Preferences , Maven, Installationsand set the directory where you have installed Maven.
my envirement
eclipse version : 4.3 kepler
maven version : 3.2.x
OS : windows 7
m2e plugin version : 1.5
the problem caused by combination of things, e.g mismatch between maven installation and setting.xml is one, but mainly the problem was:
solution for my problem was to run the eclipse in administrator mode.
you can run maven embedded (comes with eclipse) or external installation
just to make sure they are pointing to the right setting.xml file
somehow the embedded disappears sometimes, just restart eclipse it will appear again
finally I can confirm the latest m2e 1.5 or above supports maven 3.
Note: set JAVA_HOME is a must, because maven uses it to look up java which runs maven itself
set non-embeded maven installation location in the windows path is needed
set M2_HOME was NOT needed in my case, thus to get m2e working in eclipse or interact maven though command line, M2_HOME is not needed

Resources