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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s pretty much the way to do it. I assume you mean you don’t want to change your global JAVA_HOME. That’s fine. You just need to set a different JAVA_HOME for Maven. You can easily do that by creating a file at
/etc/mavenrcor~/.mavenrc(Linux) or%HOME%\mavenrc_pre.bat(Windows) with the appropriate JAVA_HOME defined in it. Maven executes those on startup if they exist unless you’ve defined a variable namedMAVEN_SKIP_RC. You could also modify the Maven startup scripts directly, but there’s no good reason for that since it gives you these nice hooks.