Wednesday, November 19, 2014

prep Java?

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

  1. latest JDK versions is JDK 7u17 (update 17 that is)
  2. get "Java SE Development Kit 7" at http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html and install it
  3. Java ends up at 'C:\Program Files\Java\jdk7_17' and the JRE (java run time) is at 'C:\Program Files\Java\jre7'
  4. https://docs.oracle.com/javase/7/docs/ appears at the end of the install
  5. type "java -version" at a command prompt to confirm it is installed
  6. we need to set the JAVA_HOME variable
  7. 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..."
  8. Add a "JAVA_HOME" variable and map it to C:\Program Files\Java\jdk7_17
  9. 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)
  10. next is to set up Apache Ant 1.9.4 and ANT_HOME (a variable like JAVA_HOME)
  11. 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\
  12. 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\
  13. We need another semicolon separated value here. Add, in editing: %ANT_HOME%\bin
  14. Run "ant -version" at the command prompt to be sure you are not told "huh? what?" or a similar error message
  15. "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.
  16. 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
  17. 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
  18. 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.
  19. 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
  20. After some investigation I realized that fixing the path is also the fix for the first error I ecountered with Ant.
  21. 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"
  22. 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