2

When I execute java -version, I get this:

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

I followed multiple online guides towards installing java. I followed all the steps but I still get that error. Maybe I did it wrong - I don't know.

Output of: dpkg -l jdk*

dpkg-query: no packages found matching jdk*

Output of: ls -l /usr/bin/java

lrwxrwxrwx 1 root root 22 Nov 16 17:21 /usr/bin/java -> /etc/alternatives/java

Output of: sudo add-apt-repository ppa:webupd8team/java

add-apt-repository: command not found

Output of: file "$(readlink -e "$(type -P java)")"

/usr/local/java/jdk1.7.0_45/bin/java: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, BuildID[sha1]=0x6849323f527575e206a1b6449617e809158e82be, not stripped

Output of ldd "$(readlink -e "$(type -P java)")

not a dynamic executable

Debian version, Ouput of uname -a:

Linux Cyneox 3.7-trunk-amd64 #1 SMP Debian 3.7.2-0+kali8 x86_64 GNU/Linux

@Teresa E Junior

Sorry, I can't comment to these posts for some reason, static linking problem. The python-software-properties returned this error, which is what I get for most of the programs I try to install:

    E: Package 'python-software-properties' has no installation candidate

Also, I ran the command that you stated above, and typing java -version still doesn't do anything.

Joseph R, this was all I typed:

root@Cyneox:/usr/bin# apt-get install ia32-libs ia32-libs:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'ia32-libs' has no installation candidate
E: Unable to locate package ia32-libs

root@Cyneox:/usr/bin# apt-get install openjdk-7-jre
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package openjdk-7-jre is not available, but is referred to by another      package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'openjdk-7-jre' has no installation candidate

But the first 2 lines that you gave me worked.

The output of cat /etc/apt/sources.list /etc/apt/sources.list.d/*:

# 

# deb cdrom:[Debian GNU/Linux 7.0 _Kali_ - Official Snapshot amd64 LIVE/INSTALL Binary 20130905-07:57]/ kali contrib main non-free

#deb cdrom:[Debian GNU/Linux 7.0 _Kali_ - Official Snapshot amd64     LIVE/INSTALL     Binary 20130905-07:57]/ kali contrib main non-free

## Security updates
# Line commented out by installer because it failed to verify:
#deb http://security.kali.org/kali-security kali/updates main contrib non-free
deb http://http.debian.net/debian/ wheezy-backports main contrib
deb http://archive.canonical.com/ lucid partner
cat: /etc/apt/sources.list.d/*: No such file or directory

Joseph, I applied your fix in the update, and everything was going smoothly... until:

Setting up openjdk-7-jre-headless:amd64 (7u25-2.3.10-1~deb7u1) ...
update-alternatives: error: cannot stat file '/etc/alternatives/java': Too many levels of symbolic links
dpkg: error processing openjdk-7-jre-headless:amd64 (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of ca-certificates-java:
 ca-certificates-java depends on openjdk-6-jre-headless (>= 6b16-1.6.1-2) | java6-runtime-headless; however:
  Package openjdk-6-jre-headless is not installed.
  Package java6-runtime-headless is not installed.
  Package openjdk-7-jre-headless:amd64 which provides java6-runtime-headless is not configured yet.

dpkg: error processing ca-certificates-java (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of openjdk-7-jre:amd64:
 openjdk-7-jre:amd64 depends on openjdk-7-jre-headless (= 7u25-2.3.10-1~deb7u1); however:
  Package openjdk-7-jre-headless:amd64 is not configured yet.

dpkg: error processing openjdk-7-jre:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of icedtea-7-jre-jamvm:amd64:
 icedtea-7-jre-jamvm:amd64 depends on openjdk-7-jre-headless (= 7u25-2.3.10-1~deb7u1); however:
  Package openjdk-7-jre-headless:amd64 is not configured yet.

dpkg: error processing icedtea-7-jre-jamvm:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of openjdk-7-jre-lib:
 openjdk-7-jre-lib depends on openjdk-7-jre-headless (>= 7~b130~pre0); however:
  Package openjdk-7-jre-headless:amd64 is not configured yet.

dpkg: error processing openjdk-7-jre-lib (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 openjdk-7-jre-headless:amd64
 ca-certificates-java
 openjdk-7-jre:amd64
 icedtea-7-jre-jamvm:amd64
 openjdk-7-jre-lib
E: Sub-process /usr/bin/dpkg returned an error code (1)

Then I tried apt-get -f install but that still failed...

user
  • 28,901

2 Answers2

2

This sounds to me like the perennial issue of not being able to run a 32-bit application on a 64-bit machine. We discussed this issue many times here (see the References section at the end of my answer for similar questions).

Assuming you're running Debian Wheezy, you need to add the i386 architecture first to download 32-bit libraries:

# dpkg --add-architecture i386
# apt-get update
# apt-get install ia32-libs ia32-libs:i386

However, don't do that. It seems, as Teresa intuited, that your Java installation is from a third party source, which is why it's 32-bit while you have a 64-bit OS. I recommend you install Java from the repos:

# apt-get install openjdk-7-jre

should do the trick.

Update

Based on your additional information, please add the Debian stable repos to your /etc/sources.list:

# echo 'deb http://ftp.debian.org/debian/ stable main contrib non-free' >>/etc/apt/sources.list
# apt-get update # may take a while
# apt-get install openjdk-7-jre

Notes

  • The openjdk-7-jre is meant to install the Java Runtime Environment, version 7, which is the latest (in the Debian stable repos) at the time of writing. For other versions, replace the 7 appropriately.
  • Depending on your convictions regarding software freedom, you may want to remove the contrib and non-free parts of the above command as they enable you to install proprietary, closed-source software.

References

Joseph R.
  • 39,549
1

Actually, you do already have Java installed under /usr/local/java/jdk1.7.0_45/, which is not an official path in Debian, but must be the result of installing it from a third party package (eg. the package from Oracle's website). It is just not linked to /usr/bin. You can either use Java directly by running it from /usr/local/ or link it to /usr/bin:

sudo update-alternatives --install /etc/alternatives/java java /usr/local/java/jdk1.7.0_45/bin/java 1

This should be enough. Try running /usr/bin/java to see if it works.

Now, regardinng the other method you were trying, there is a confusion in your question: you are using Debian and following instructions on how to install Java in Ubuntu. You could also try installing Java from WebUpd8 PPA on Debian, but I can't assure you it would work:

python-software-properties contains the command add-apt-repository:

sudo apt-get install python-software-properties

Then you could continue following Andrew's instructions, as you've been. The worst that would happen is APT refusing to install Java for you.

admirabilis
  • 4,712