Support Questions

Find answers, ask questions, and share your expertise

Cannot see Javac after successfully installing OpenJDK 1.7. (-bash: javac: command not found error)

avatar
Expert Contributor

I have HDP 2.4. I have installed OpenJDK 1.7 as mentioned in the following link. The installation happens without any error. Step 5 in this link mentions the line 'ln -s /usr/hdp/current/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64 /usr/java/default'. I do not see any folder called JVM under /usr/hdp/current. I also executed java -version, but I still see Java RE, but no JDK. What am I doing wrong?. Also, when I execute javac, i get the error -bash: javac: command not found

https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.3/bk_installing_manually_book/content/meet-mi...

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Pradeep kumar

Are you sure that you added "$JAVA_HOME/bin" to your PATH variable?

export JAVA_HOME=/usr/hdp/current/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64
export PATH=$JAVA_HOME/bin:$PATH

.

Now you shoudl be able to run "javac" and "java --version"

View solution in original post

5 REPLIES 5

avatar
Master Mentor

@Pradeep kumar

Are you sure that you added "$JAVA_HOME/bin" to your PATH variable?

export JAVA_HOME=/usr/hdp/current/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64
export PATH=$JAVA_HOME/bin:$PATH

.

Now you shoudl be able to run "javac" and "java --version"

avatar
Expert Contributor

If you read my post again you will see that I had mentioned that I do not see "jvm" folder under /usr/hdp/current. So there is no folder called /usr/hdp/current/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64 in my system.

avatar
Master Mentor

@Pradeep kumar

If you have installed JDK using yum then you should check the directory:

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64

.

The inside the $JAVA_HOME/bin you should find the "javac" and "java" executables.

avatar
Expert Contributor

the folder that I see in my machine is /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64, which I set it in the export JAVA_HOME command, but i still get the same error,i.e, it cannot find javac

avatar
Expert Contributor

Okay. I have fixed it. I have executed the above two commands, but gave /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64 for the openJDK path. Thanks for your help 🙂