Currently my JAVA_HOME
is set to a JDK that is 1.4.2.
To run Maven 3, I would need 1.5 and above.
Is there any way to instruct my Maven installation to use another JDK that is installed other than changing the JAVA_HOME
environment variable?
Maven always uses the JDK specified by JAVA_HOME , no matter how many JDK installations are available on the system. This allows the user the flexibility to change JDKs as required or based on the project. Hence, it is important to ensure JAVA_HOME is defined.
To set JAVA_HOME, do the following: Right click My Computer and select Properties. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1. 6.0_02.
On Windows:
STEP 1:
Find apache-maven-3.2.1\bin\mvn.bat, then find and replace JAVA_HOME to JAVA_HOME_MVN. Note: Before this, make a backup of mvn.bat
STEP 2:
Create a new environment variable called JAVA_HOME_MVN and point it to the bin of whichever jdk you want to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With