Can't access mvn command from command line? - maven

I've tried to access mvn from command line.
Installation path
C:\Program Files\Apache Software Foundation\apache-maven-3.1.1
User variables
M2 = %M2_HOME%\bin
M2_HOME = C:\Program Files\Apache Software Foundation\apache-maven-3.1.1
JAVA_HOME = C:\Archivos de programa\Java\jdk1.7.0_25
System variables
Path = %M2%;%JAVA_HOME%/bin; and others...
I try to se if Maven is well configured through mvn --version as the manual says but this is the result:
C:\>mvn --version
"mvn" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
C:\Program Files\Apache Software Foundation\apache-maven-3.1.1\bin>mvn --version
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 17:22:22+0200)
Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.1.1
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Archivos de programa\Java\jdk1.7.0_25\jre
Default locale: es_ES, platform encoding: Cp1252
OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"
What could it be this? Should I export the variables every time I need them?

Path = %M2%;%JAVA_HOME%/bin; and others...
If you change %M2% to %M2_HOME%\bin it'll work.
To be precise: if you execute 'set Path' it must contain the path to the bin directory of Maven.

In my past I was the same (Windows 7) and I solved it by running the cmd as administrator. Click Start - Accessories - click Command System right click Run as Administrator

export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
mvn --version
Note: Set Java path if not available

Related

I can't install weblogic 12c on Mac M1

I bought my mac m1, but I could not install weblogic 12c, I installed java 8 and when I run the following code in the terminal with rosetta
java -jar fmw_12.1.3.0.0_wls.jar
I get the following error
The initiator log file is /private/var/folders/km/tqp3cxcs3jg03bf9c3vgwcjh0000gn/T/OraInstall2021-12-01_01-10-06PM/launcher2021-12-01_01-10-06PM.log.
Extracting files .....
This Installer must be run using a Java Development Kit (JDK) pero /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home it is not a valid JDK.
Please help me, what am I doing wrong?
to install weblogic, you need to export your variables before Run the jar file, at least the Java_home
export JAVA_HOME
export MW_HOME
export USER_MEM_ARGS

maven ignores maven.compiler.source

I have
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
in my pom.xml.
If I run mvn clean install then I can't run the compiled classes with Java 1.8 (I get crashes with errors like java.lang.NoClassDefFoundError: Could not initialize class when I try to).
I am forced to run
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home mvn clean install
if I want it to be able to run the built jar with java 8 without crashes.
How can I make it actually use the correct JDK that I want?
Here is how my machine seems to be set up by default
$ mvn -version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T19:41:47+01:00)
Maven home: /usr/local/Cellar/maven/3.6.0/libexec
Java version: 11.0.1, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/openjdk-11.0.1.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.2", arch: "x86_64", family: "mac"
$ java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
$ echo $JAVA_HOME
$

Not able to open iReport Designer in mac

I'm new to Jasper reports and Mac. I have downloaded iReport-5.6.0.dmg. It got saved in downloads. Later I moved to applications. The .dmg didnt install and when I just open the .dmg and right click to open for Jaspersoft report designer, it didnt open.
I just saw some questions, but nothing helped.
I'm using mac os Sierra 10.12.2
My java version is
Alis-MacBook-Air:~ Shah$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Alis-MacBook-Air:~ Shah$
JDK location
Alis-MacBook-Air:~ Shah$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
1.8.0_101, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
1.7.0_79, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
iReport.conf
# ${HOME} will be replaced by user home directory according to platform
default_userdir="${HOME}/.${APPNAME}/5.6.0"
default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}/5.6.0"
# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="-J-Xms256m -J-Xmx512m -J-Dorg.netbeans.ProxyClassLoader.level=1000 -J-XX:MaxPermSize=512m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dnetbeans.exception.report.min.level=99999 "
# for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea
# default location of JDK/JRE, can be overridden by using --jdkhome <dir> switch
#jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home"
# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)
#extra_clusters=
You should setup JDK 1.7s as JAVA_HOME otherwise you'll see like this error
"The current path is: C: \ Java \ jdk1.8.0The current path is: C: \ Java \ jdk1.8.0Java HotSpot (TM) 64-Bit Server VM warning: ignoring option MaxPermSize = 512m; support was removed in 8.0" and you can setup jaspersoft studio community its working.
Issue was with the JDK version.
If the JDK version is 1.8, Jasperstudio has to be installed. It worked fine.

Atlassian SDK + Win10 => -Dmaven.multiModuleProjectDirectory system property is not set

I am trying to use Atlassian SDK 6.2.9. on my laptop with Win10, but there is a maven problem.
Java:1.8.0_101
Mvn: 3.3.9 (M2_HOME)
CMD full stack says more:
c:\>atlas-version
ATLAS Version: 6.2.9
ATLAS Home: C:\ProgramData\Atlassian\atlassian-plugin-sdk-6.2.9
ATLAS Scripts: C:\ProgramData\Atlassian\atlassian-plugin-sdk-6.2.9\bin
ATLAS Maven Home: C:\ProgramData\Atlassian\atlassian-plugin-sdk-6.2.9\apache-maven-3.2.1
AMPS Version: 6.2.6
--------
Executing: "C:\ProgramData\Atlassian\atlassian-plugin-sdk-6.2.9\apache-maven-3.2.1\bin\mvn.bat" --version -gs C:\ProgramData\Atlassian\atlassian-plugin-sdk-6.2.9\apache-maven-3.2.1/conf/settings.xml
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
-Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match.c:\>
My question is how can I figure this mvn problem out?
Thanks a lot

Error: JAVA_HOME is not defined correctly, when installing Maven on Mac

It is suppose to be easy, but I'm having great difficulty installing Maven on to my mac 10.11.4.
I have created M2_HOME and PATH for Maven, but when I type in mvn --version, the terminal tell me
/Users/justin/apache-maven-3.3.9/bin/mvn: line 53: uname: command not found
/Users/justin/apache-maven-3.3.9/bin/mvn: line 143: which: command not found
/Users/justin/apache-maven-3.3.9/bin/mvn: line 171: which: command not found
Error: JAVA_HOME is not defined correctly.
We cannot execute
Why is this happening?
You need JAVA_HOME to be defined, as covered in installation guide.
Check out this answer for additional details for MacOS.
For macOs Ventura 13.1
If you installed java openJdk version 11 using Homebrew:
brew install java11
Then, your java is installed on:
/opt/homebrew/Cellar/openjdk#11/11.0.17/libexec/openjdk.jdk/Contents/Home
So, you must understand that this is you JAVA_HOME environment variable.
You need to add the java '/bin' folder to your PATH environment variable in order to have it working on your terminal. Also, you need to create the JAVA_HOME environment variable in order to maven to know about your java.
Therefore, you must open:
/Users/<yourUser>/.zshrc
Add
export JAVA_HOME="/opt/homebrew/Cellar/openjdk#11/11.0.17/libexec/openjdk.jdk/Contents/Home"
export PATH="/opt/homebrew/opt/openjdk#11/bin:$PATH"
Save your changes, close the file. Now you can open your terminal and type:
java -version
and then,
mvn -version
and this is what you should get:
example#example441 ~ % java -version
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment Homebrew (build 11.0.17+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.17+0, mixed mode)
example#example441 ~ % mvn -version
Apache Maven 3.8.7 (xxxxxxxxxxxxxxxxxxxxxxxxxxx)
Maven home: /opt/homebrew/Cellar/maven/3.8.7/libexec
Java version: 11.0.17, vendor: Homebrew, runtime:
opt/homebrew/Cellar/openjdk#11/11.0.17/libexec/openjdk.jdk/Contents/Home
Default locale: pt_BR, platform encoding: UTF-8
OS name: "mac os x", version: "13.1", arch: "aarch64", family: "mac"

Resources