some dirty notes from walking through a better blog posting at http://www.javacodegeeks.com/2013/03/setup-your-java-development-environment-in-windows-7.html
- latest JDK versions is JDK 7u17 (update 17 that is)
- get "Java SE Development Kit 7" at http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html and install it
- Java ends up at 'C:\Program Files\Java\jdk7_17' and the JRE (java run time) is at 'C:\Program Files\Java\jre7'
- https://docs.oracle.com/javase/7/docs/ appears at the end of the install
- type "java -version" at a command prompt to confirm it is installed
- we need to set the JAVA_HOME variable
- Type "View Advanced System Settings" at the search in Windows Server 2012 R2 to bring up the "System Properties" dialog box with the "Advanced" tab up. Then click on "Environment Variables..."
- Add a "JAVA_HOME" variable and map it to C:\Program Files\Java\jdk7_17
- test by opening a command prompt and typing "echo %JAVA_HOME%" (I had to close out the "System Properties" dialog box and reopen the command prompt to get this to work/stick)
- next is to set up Apache Ant 1.9.4 and ANT_HOME (a variable like JAVA_HOME)
- get Apache Ant at http://ant.apache.org/bindownload.cgi and unzip to C:\ant194\ then make an ANT_HOME environment variable just as was made the JAVA_HOME environment variable and map it to C:\ant194\
- Environment Variables will also have "System variables" and one of these will be called "Path" and if you edit this variable you will see something like this inside: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
- We need another semicolon separated value here. Add, in editing: %ANT_HOME%\bin
- Run "ant -version" at the command prompt to be sure you are not told "huh? what?" or a similar error message
- "Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre7\lib\tools.jar" is an error message I saw when I attempted this. After some digging I realized that this file really lives at C:\Program Files\Java\jdk1.7.0_71\lib\tools.jar and if I just copied it (made a duplicate outright) to location expected the error message would go away.
- alright, next is Apache Maven (a build tool and a dependency management tool as well which may be found at http://maven.apache.org/download.cgi) and MAVEN_HOME
- download Maven 3.2.3 (Source zip) then unzip it to C:\maven323\bin\ and finally map the MAVEN_HOME variable to C:\maven232\apache-maven\src and also jam %MAVEN_HOME%\bin into the Path variable
- in attempting to test with "mvn -version" I got... Error: JAVA_HOME is set to an invalid directory. JAVA_HOME = "C:\Program Files\Java\jdk7_17" Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
- I then realized that I had JAVA_HOME mapped to C:\Program Files\Java\jdk7_17 when it should instead be mapped to C:\Program Files\Java\jdk1.7.0_71
- After some investigation I realized that fixing the path is also the fix for the first error I ecountered with Ant.
- On the other side of this error I find a different error claiming "Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher"
- The cure: since writing the above I have realized I should "Maven 3.2.3 (Binary zip)" from C:\maven232\apache-maven\src and not "Maven 3.2.3 (Source zip)" ...and I've changed MAVEN_HOME to M2_HOME and I have it mapped to C:\maven232
No comments:
Post a Comment