Friday, May 3, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 4698  / 1 Year ago, mon, march 6, 2023, 11:55:57

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.


More From » software-installation

 Answers
6

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.


[#27662] Tuesday, March 7, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hamostic

Total Points: 403
Total Questions: 142
Total Answers: 112

Location: Iceland
Member since Sat, Sep 17, 2022
2 Years ago
;