0

I need help setting up Java Development Kit (JDK) on Mac 10.6.8. I'm trying to take the following online self-paced course: http://www.andrew.cmu.edu/course/95-815/.

I've managed to install "OpenJDK 7 version 1.7.0" by using "Pacifist" and momentarily altering my

"/System/Library/CoreServices/SystemVersion.plist"

file as directed in this post: How to install java jdk 7 on Snow Leopard. I've also moved "OpenJDK 7 version 1.7.0" to the top priority in Java Preferences. However, upon entering java -version in Terminal, I receive the output

-bash: java: command not found.

On the other hand, when I enter /usr/bin/java -version, I receive the following output:

openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-b00)
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)

I suspect that my issue has to do with establishing the correct PATH, however, I have no idea how to do this and all the guides I find are too cryptic for me to understand. Thank you for any assistance!

Community
  • 1
  • 1
Jon S
  • 23
  • 10
  • enter `javac` for java compiler, java is for the run time and yes you need to set the `JAVA_HOME`variable I suspect like you do on a Linux system. – jgr208 Dec 23 '14 at 17:05
  • @jgr208, When I enter: `Jons-MacBook:~ dreadnought74$ javac Users/dreadnought74/Desktop/JavaCMU/MyFirstJavaPgm.java` Terminal returns the following: `-bash: javac: command not found` – Jon S Dec 23 '14 at 17:25
  • http://java.dzone.com/articles/installing-openjdk-7-os-x – jgr208 Dec 23 '14 at 17:28
  • @jgr208, I appreciate your help. I'm beyond frustrated at this point. Is it possible the code from the referenced thread is the issue?: `echo 'export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home' >> ~/.profile` In trying to follow your "dzone" guide, I'm assuming I can ignore the 'David Blevin's handy setjdk script' since my `Java Preferences` allows me to move JDK 1.7.0 to the top priority. However, running `sudo ln -s /Library/Java/JavaVirtualMachines/1.7.0.jdk` results in another `command not found` error. – Jon S Dec 23 '14 at 17:51
  • hmmm that is a softlink, but maybe its best at this time to uninstall and do a fresh install? – jgr208 Dec 23 '14 at 17:53
  • You mean simply deleting the `Java` folder and reinstalling? I've tried that as well. I'll continue troubleshooting and report back if I find anything else. – Jon S Dec 23 '14 at 18:18
  • doing however mac does uninstalling of packages – jgr208 Dec 23 '14 at 18:25
  • OK, seem to have made some progress resetting my path with this http://apple.stackexchange.com/questions/22859/uh-oh-bash-ls-command-not-found '"PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin You can reset the path by typing the above into a shell window, and then typing export PATH"' – Jon S Dec 23 '14 at 18:42

0 Answers0