4

I'm trying to install Oracle JRE/JDK using the instructions given here Install Oracle Java JRE on Ubuntu

I need it as Android Studio recommends it.

Anyway, when I type in file /sbin/init in the terminal, it just displays

/sbin/init: symbolic link to /lib/systemd/systemd 

while the above link says that it should display the bit version of my OS.

Could someone tell me how to rectify this issue?

  • When I try the command you specified (the first one), it's working for me (Ubuntu Server 14.04). Are you using Ubuntu? – grooveplex Aug 19 '16 at 5:52
  • Yes, but the version 16.04 LTS – Harsha Aug 19 '16 at 5:59
  • 1
    that's because 14.04 doesn't use systemd as init @grooveplex (afaik this is still the case anyway) – Zanna Aug 19 '16 at 6:08
7

You executed the command successfully, and it gave you accurate information.

$ file /sbin/init
/sbin/init: symbolic link to /lib/systemd/systemd

The tutorial advises you simply to find the ELF type of a binary file, one that must represent your system's architecture. Systemd is Ubuntu 16.04's init system. You can find the architecture of the regular file pointed to by the symlink with this command (thanks to muru for pointing out the -L flag which causes file to follow symlinks):

file -L /sbin/init

for me outputs:

/lib/systemd/systemd: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=dfc32dfa86e4694a0408bd227e8f91d2acbbc11a, stripped

Ah!

You can also get your system's bitwidth with this command, for example (there are many other ways, for example uname -i):

$ getconf LONG_BIT
64

another nice clean way suggested by @Serg:

$ dpkg --print-architecture
amd64

As requested, here's how I install Oracle Java when I really need to use it instead of the much preferable OpenJDK:

sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer
  • 1
    Instead of file $(readlink ...), do file -L: "option causes symlinks to be followed". – muru Jan 9 '18 at 5:31
3

The commandline from the site you linked is showing you how to determine your OS type, 64bit or 32bit. Check your OS type with this cli:

$ cat /etc/lsb-release

By the way, I get a required argument missing error when I type the /sbin/init command.

You don't need those steps on that page to install Android Studio from Google on your system. The Android studio is a tar file you download. You open the root folder of the tar and just run the studio.sh from the bin folder of the archive.

There's nothing to install.

You can install an alternate JDK with:

(https://launchpad.net/~webupd8team/+archive/ubuntu/java)

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
  • I did all that already and android studio is installed. And after I opened it, I got a message saying that it works the best with Oracle JDK. So I'm doing all this. – Harsha Aug 19 '16 at 6:09
  • You don't have to remove your current java installation to install a different one. You can just install an alternate one and use the cli: sudo update-alternatives --config java to chose the one you want to use by default. I'll add formatted steps for installing the Oracle JDK package to my answer. – L. D. James Aug 19 '16 at 6:13
  • Thanks, that would be great:) Right now, this is what I get when I type in that command. s4.postimg.org/txhtb5nr1/… – Harsha Aug 19 '16 at 6:16
  • Apparently you have the oracle jdk installed. Choose option # 1 at the command prompt in your picture. – L. D. James Aug 19 '16 at 6:24
  • What's the difference between option 0 and option 2? Here's a better screenshot. s4.postimg.org/j738ngrhp/image.png – Harsha Aug 19 '16 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.