title: Configuring Maven with two versions of Java
body: <p>I need two versions of Java ie. Java5 and Java6 on the same machine, as some of my projects support Java6 and some supports Java5. So I made it by putting the path of Java6 in JAVA_HOME and Java5 in JAVA5_HOME. I added both the JAVA_HOMEs in the PATH variable.</p>
  
  <p>But when I do java -version, then by default I am getting the following result</p>
  
  <p><code>java version "1.6.0"
  Java(TM) SE Runtime Environment (build 1.6.0-b105)
  Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
  </code></p>
  
  <p>Is it possible to get Java5 also along with Java6??</p>
  
  <p>Also I would like to know that, is it possible to configure maven2 with two versions of Java (Java1.6 &amp; Java1.5) and use the required version for building the project in the run time?</p>