0

I'm trying to configure a single node Hadoop environment on my iMac 10.9.5. This has been a much larger pain than I anticipated and I have Java to thank for a lot of that. I've spent the past two hours dealing with this issue.

Error: Could not find or load main class com.sun.tools.javac.Main

I've looked at the JDK8 docs and a ton of forums searching for the reason and have narrowed it down to two.

  1. When I installed JDK8, something went wrong and it wasn't included in the install.
  2. For whatever reason, tools.jar isn't in reaching distance of JAVA_HOME. This will require to find out the path for tools.jar in Java8 and link to JAVA_HOME, which I haven't been able to find.

I would really like a better understand of what is going wrong and why. Also, the path to tools.jar would be really useful!

Thanks!

Austin A
  • 2,990
  • 6
  • 27
  • 42
  • 1
    You should be aware that tools.jar is _going away_ in Java 9. So if you've got code that depends on knowing its location, that code is going to have to change. – Brian Goetz Mar 01 '15 at 16:29
  • The longevity of this code isn't too important to me. It's for a class so once I turn it in, I probably won't come back to it except for syntax reminders. That's really good to know though. It will be interesting to see how Hadoop changes with that. – Austin A Mar 01 '15 at 16:34

1 Answers1

1

So here's the deal, I'm an idiot. Through my freaking out (I'm stressed because I'm on a pretty tight deadline), I had over looked some pretty fundamental information. One was the JAVA_HOME environment variable. For me, this was /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home, which I added to my .bash_profile. While I had this set correctly before I wrote this question, I hadn't made the connection when looking over this question. Artur clearly states that tools.jar is in your JAVA_HOME/lib directory. After reading this forum, which explicitly states that tools.jar was at the path below.

/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre/lib/

Or if you're looking for tools.jar for Java 8, then it will be in...

/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home/lib/

Ok, so I've found tools.jar, but now I need to know where to put because Java isn't seeing it. This question also explicitly states that tools.jar needs to be in ~/Library/Java/Extensions. What do you know, I copy it over, Bob's your uncle, and everything works as it should. Only wish I had a post like this to guide me at noon today instead 9:45pm.

Hopefully this saves someone else in the future!

Community
  • 1
  • 1
Austin A
  • 2,990
  • 6
  • 27
  • 42