22

I'm trying to re-install Oracle JDK 7 32 bit to 64 bit Ubuntu (previously 64 bit JDK was installed). JDK is currently present at /usr/lib/jvm/jdk1.7.0. I invoke

sudo update-alternatives --remove "java" "/usr/lib/jvm/jdk1.7.0/bin/java"
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1

And then:

/usr/lib/jvm/jdk1.7.0/bin$ java
bash: /usr/bin/java: No such file or directory

Why java can't be invoked?

Tim
  • 32,861
  • 27
  • 118
  • 178
Andrei Botalov
  • 842
  • 2
  • 8
  • 21

3 Answers3

34

This message is shown because some 32 bit libraries are absent in Ubuntu 64 bit. Run:

apt-get install libc6-i386

See Java is installed, in listing, but execution produces “./java: No such file or directory” for more details

Andrei Botalov
  • 842
  • 2
  • 8
  • 21
1

I was helping a friend with their RiotBoard running Linaro-Ubuntu to set it up as a minecraft server. We got the same error. The problem I found was that Java was referencing /lib/ld-linux-armhf.so.3 which does not exist on the system. When you look at /lib the only load file is /lib/ld-linux.so.3 so I just soft link them and it works. Below is how I worked it out and what I did to fix it.

root@linaro-ubuntu-desktop:/opt/java/jdk1.8.0_06/bin# java
-su: /usr/bin/java: No such file or directory

root@linaro-ubuntu-desktop:/opt/java/jdk1.8.0_06/bin# strings java

/lib/ld-linux-armhf.so.3
qwwBI
libpthread.so.0
_Jv_RegisterClasses
libjli.so
_ITM_deregisterTMCloneTable
JLI_Launch
__gmon_start__
_ITM_registerTMCloneTable
libdl.so.2
libc.so.6
abort
__libc_start_main
lib.so
$ORIGIN/../lib/arm/jli:$ORIGIN/../lib/arm
SUNWprivate_1.1
GLIBC_2.4
1.8.0_06-b23
java

root@linaro-ubuntu-desktop:/opt/java/jdk1.8.0_06/bin# ls /lib/ld*

/lib/ld-linux.so.3

root@linaro-ubuntu-desktop:/opt/java/jdk1.8.0_06/bin# ln -s /lib/ld-linux.so.3 /lib/ld-linux-armhf.so.3

root@linaro-ubuntu-desktop:/opt/java/jdk1.8.0_06/bin# ls /lib/ld*

/lib/ld-linux-armhf.so.3  /lib/ld-linux.so.3


root@linaro-ubuntu-desktop:/opt/java/jdk1.8.0_06/bin# java -version

java version "1.8.0_06"

Java(TM) SE Runtime Environment (build 1.8.0_06-b23)
Java HotSpot(TM) Client VM (build 25.6-b23, mixed mode)
root@linaro-ubuntu-desktop:/opt/java/jdk1.8.0_06/bin#
αғsнιη
  • 35,660
0

what u are doing is trying to execute binary file without telling its path,
for executing java binary try "./java" in bin folder else include its whole path and for installation you may try this :- http://www.devsniper.com/ubuntu-12-04-install-sun-jdk-6-7/

r4jiv007
  • 163