2

I feel like this should just naturally work, but for some reason it isn't. I've gone through the following guide How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE? And it seems that all the help isn't working.

I'm trying to get oracle's 64-bit java to work.

I already installed java using the ppa:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

But then, it downloaded the 32-bit version for some reason:

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) Server VM (build 25.45-b02, mixed mode)
$ java -d64
Error: This Java instance does not support a 64-bit JVM.
Please install the desired version.

So I decided to do a manual download. I downloaded the tar.gz file from oracle directly:

jdk-7u79-linux-x64.tar.gz

and was able to extract everything, but for some reason when I try to run java, I get an error.

~/jdk1.7.0_79/bin$ ./java
-bash: ./java: No such file or directory
~/jdk1.7.0_79/bin$ file java
java: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, BuildID[sha1]=0x68582ab83ddaf6429310a6f841f0adda165ce880, not stripped

So as you see, the file is there, but also not there at the same time. Which is hyper confusing. I next thought that maybe I didn't actually have a 64-bit version of Ubuntu, but I checked and (if I'm reading everything correctly) it looks like I do have 64-bit ubuntu:

$ uname -a
Linux random 4.0.4-x86_64-linode57 #1 SMP Thu May 21 11:01:47 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

Also, I tried the same thing with version 7, and openjdk uses version 7 as well. Both of them did the 32-bit version. You can see all my versions of java here:

$ update-alternatives --config java
There are 4 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                           Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-8-oracle/jre/bin/java         1053      auto mode
  1            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1051      manual mode
  2            /usr/lib/jvm/java-7-oracle/jre/bin/java         1052      manual mode
  3            /usr/lib/jvm/java-8-oracle/jre/bin/java         1053      manual mode
  4            /usr/lib/jvm/jdk1.8.0_05/bin/java               1         manual mode

Any help would be beneficial in order to get 64 bit working on ubuntu. Thanks in advance.

EDIT Turns out uname is not as accurate as I thought. Turns out I am on a 32-bit machine:

$dpkg --print-architecture
i386
$ file /sbin/init
/sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x07075fcb55b05aeb6286efabba63534fa6ecd213, stripped
4
  • 1
    Is your system actually 64bit? Please check dpkg --print-architecture and file /sbin/init.
    – s3lph
    May 31, 2015 at 13:28
  • @the_Seppi Those two come back as 32-bit, so I assume that I am actually running a 32-bit machine. I guess uname doesn't give as accurate results as I had hoped. Thanks May 31, 2015 at 13:31
  • You can have a 64bit kernel, despite the rest of your system being 32bit. uname returns kernel info. As you are running Linux 4.0, I assume you installed it manually and picked the wrong one, if you took a precompiled version.
    – s3lph
    May 31, 2015 at 20:10
  • Yeah, that's exactly what happened. Turns out the VPS I requested gave me a 64-bit kernel, but a 32-bit OS.... No idea why when I requested 64-bit everything. I'm going to instantiate a new one with a 64-bit OS. Did you want to answer the question so that I can give you the accepted answer? Jun 1, 2015 at 16:19

1 Answer 1

0

You are running a 32bit system, as the output of your dpkg --print-architecture and file /sbin/init suggests.

The other command, uname, is in fact reliable: You are running a 64bit Linux 4.0.4 kernel.

The face that Linux 4.0 is not yet shipped with Ubuntu suggests that you manually upgraded to the newest kernel (or somebody else did it for you), in which the wrong architecture was chosen.

You may be surprised, but it is indeed possible to use a 64bit kernel with a system that is elsewise 32bit, as long as a minimum of dependencies are also installed in 64bit.

The fact that your Java is being installed as 32bit is due to the fact that the package manager, dpkg, sees i386 as the native architecture and hence installes the corresponding package.


You can, however, force the installation of 64bit Java. The base requirement, a 64bit kernel, is already given. So you only need to tell dpkg to allow 64bit installations:

sudo dpkg --add-architecture amd64

Then you should be able to force a desired foreign architecture on future package installations:

sudo apt-get install oracle-java8-installer:amd64

Now, this may install a hell lot of packages, namely all dependencies for Java and their dependencies recursively, all in 64bit, even if you already have them in a 32bit version.

Such a hybrid system can, however, be unstable, so you may want to choose to reinstall the system.

(There are ways of turning your system into 64bit, but this is higher necromancy most people on here would never even think of, and I will certainly not link anything of this dark magic here.)

You must log in to answer this question.

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