1

I am new to Ubuntu and am trying to set up Java to run and compile programs. As I am very fresh, I am not sure how to tell which version I am using but file /sbin/init returns:

    ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x7aa29ded613e503fb09fb75d94026f3256f01e7a, stripped

The problem I have is when it comes to running the Java programs. Although the programs compile they don't seem to run. I used this guide: http://www.wikihow.com/Install-Oracle-Java-on-Ubuntu-Linux

And everything seems fine until I go to run the program I get this error message:

    bash: /usr/bin/java: No such file or directory

Java is supposed to be run from /usr/local/java and the /etc/profile has:

    JAVA_HOME=/usr/local/java/jdk1.7.0_45
    PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
    JRE_HOME=/usr/local/java/jre1.7.0_45
    PATH=$PATH:$HOME/bin:$JRE_HOME/bin
    export JAVA_HOME
    export JRE_HOME
    export PATH

I'm sure I'm missing something really simple. Thanks in advance.

2 Answers 2

1

After recently installing Oracle Java following the same instructions, I ran into a similar error. The link to the java executable appears to be missing in your /usr/bin. To resolve this, I would manually create the link:

$ sudo ln -s /etc/alternatives/java /usr/bin/java

You may have to change /etc/alternatives/java to point to the correct location, but this is the default based on the instructions you followed.

0

sudo ln -s /usr/lib/jvm/java-7-openjdk/bin/javac /usr/bin/javac

That line of code fixed the problem for me, replace java-7-openjdk with java 6 if you are not running 7.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .