EzDevInfo.com

openjdk interview questions

Top openjdk frequently asked interview questions

How to completely uninstall Java?

How can I completely remove all traces of Java on my system?

I already know how to install it in case I need it again.


Source: (StackOverflow)

How to install OpenJDK 8 on 14.04 LTS?

As of 2016-04-23 Ubuntu 16.04 has ben released, with both OpenJDK 8 and 9 in the official repositories. I would recommend upgrading to that.


As of 2016-01-11 OpenJDK 8 is still not available in an official backport for 14.04. It is, however, available in 14.10 and forwards.

IMPORTANT: If you need this backported to 14.04, vote for this bug by logging in and clicking "Does it affect you" at the top: https://bugs.launchpad.net/ubuntu/+source/openjdk-8/+bug/1368094


Java 8 is now available according to http://openjdk.java.net/projects/jdk8/, but http://openjdk.java.net/install/ does not yet mention how to install OpenJDK 8 (not Oracle Java) on Ubuntu 14.04 Long Term Support. (For 14.10 and later just run apt-get install openjdk-8-jdk)

How and when can this be done?

(For now we will use Oracle Java - the optimal solution for me is, however, OpenJDK from the Ubuntu repositories, until Oracle Java is available directly and effortless from the Ubuntu repositories)



Source: (StackOverflow)

Advertisements

How do I install Java?

How do I install Java, including in my browser, so websites with Java work?


Source: (StackOverflow)

Problems with Eclipse and Android SDK

I installed Eclipse, openjdk6 and downloaded and extracted the sdk manager file.

Now, When I created an Android project I got the following error:

2012-06-06 18:44:40 - contactManager] /home/catia/android-sdks/platform-tools/aapt: 
error while loading shared libraries: libz.so.1: cannot open shared object file: 
No such file or directory

And this one when I tried to create an AVD Manager:

[2012-06-06 19:00:18 - SDK Manager] /home/catia/android-sdks/tools/mksdcard: error 
while loading shared libraries: libstdc++.so.6: cannot open shared object file: No 
such file or directory 
[2012-06-06 19:00:18 - SDK Manager] Failed to create the SD card.
[2012-06-06 19:00:18 - SDK Manager] Failed to create sdcard in the AVD folder.

Source: (StackOverflow)

Setting JDK 7 as default

 four@twenty:~$ file /etc/alternatives/java /etc/alternatives/javac
 /etc/alternatives/java:symbolic link to `/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java'
 /etc/alternatives/javac:symbolic link to `/usr/lib/jvm/java-6-openjdk-amd64/bin/javac'

Forgive my noobishness but Im interpreting that as the runtime environment using Java 7 but the compiler using 6?

Is this right and if so how can I set it to use 7?

Thanks :)


Source: (StackOverflow)

How can I tell what version of Java I have installed?

I want to start toying around with java (eventually getting to the point where I can write basic little programs for android or web), but I've managed to have java messed up on my computer (from past experiments).

I'm not sure which version of java I have, and would like to know if there is a command to see the version of java that is installed and active. Also, which version works best? All this on 32bit Ubuntu 12.04

EDIT:
Ok, so it seems like I have both openjdk 6 and 7, with openjdk 7 in use. I want to use openjdk 7, so how do I uninstall openjdk 6? Is just via USC good enough or is there a command that should be run?


Source: (StackOverflow)

How to replace OpenJDK 6 with OpenJDK 7?

Surprisingly (as OpenJDK 7 was released to general availability about 4 months ago) Ubuntu 11.10 still uses OpenJDK 6 instead of 7 by default. How do I best fix this? I'd prefer to remove OpenJDK 6 completely and let OpenJDK 7 to be the default-jdk and default-jre.

I don't want the official Oracle tarballs, I want deb repos - the standard Ubuntu way.


Source: (StackOverflow)

Replace openjdk with oracle-jdk on Ubuntu

I have an ubuntu system and I want to replace my openjdk with oracle-jdk.

However if I remove my open-jdk and then install oracle-jdk, when I try to install some packages they want to install openjdk and I don't want this.

Is there any way to install those packages on top of oracle-jdk? One of those packages is freemind.


Source: (StackOverflow)

Installing Chrome Java Plugin

I've been trying to install the Java plugin for Chrome for a couple hours now, and I figured it was time to ask people with more experience. I can't seem to get it working. My current Java version is the 64-bit OpenJDK 1.6.0_24. I tried installing the IcedTea plugin to no avail. I have Ubuntu 12.04 64-bit installed at the moment.

When I tried testing if java was enabled in Chrome, any website with a Java applet would not load (when I disabled the plugin, they loaded, but not the applet).

I followed the instructions from here: http://technonstop.com/install-java-plugin-ubuntu-linux

which said to create this script and run it:

JAVA_HOME=/usr/lib/jvm/jdk1.7.0
MOZILLA_HOME=~/.mozilla
mkdir $MOZILLA_HOME/plugins
ln -s $JAVA_HOME/jre/lib/i386/libnpjp2.so $MOZILLA_HOME/plugins

Note: You may need to change the value of JAVA_HOME so that it correctly points to your installation of the JDK. 64-bit users will need to change the final line to:

ln -s $JAVA_HOME/jre/lib/amd64/libnpjp2.so $MOZILLA_HOME/plugins

but this did not work as well.

I just test it in Firefox and it's working. Still nothing for Chrome


Source: (StackOverflow)

How to set the JDK for Android Studio?

I can't compile a default new project for Android 2.1 because(?) the JDK used by Android Studio is JDK 1.7 but it should be JDK 1.6.

To change it I go to File -> Project Structure and try to find the JDK 1.6 location.

But when I select its directory and press OK I get the following error:

Please choose a valid JDK directory

Please choose a valid JDK directory

As you can see on the screenshoot I'm trying to set Java 6 OpenJDK 64-bits as the new JDK.

What can I do? Isn't Android Studio compatible with OpenJDK and should I use Oracle JDK instead?


Source: (StackOverflow)

How to install Minecraft (Client)

How to correctly install Minecraft, including setting any needed packages or apps to install it and to troubleshoot the most common problems that Ubuntu users face when trying to user Minecraft.

I am trying to install and run Minecraft without first having to install the Oracle version of Java. I want to use the OpenJDK version that comes with Ubuntu and as a last resort, use the Oracle one.

I also want to know a list of problems related to Minecraft in Ubuntu and the possible solutions to them.

A step by step guide on how to install Minecraft would also help.


Source: (StackOverflow)

How do I install openjdk 7 on Ubuntu 16.04?

I would like to upgrade my main system to 16.04, but I work on projects that require OpenJDK 7.

Apparently it is not available from a trivial apt-get install openjdk-7-jdk. Only versions 8 and 9 are listed in the repository.

Can anyone point me to instructions on how to install it?


Source: (StackOverflow)

Setup and install IntelliJ with JDK

Is there any scripts for downloading and installing IntelliJ with JavaJDK or OpenJDK?

I don't know how I did it before using Ubuntu 12.10 but I'm now on a fresh 13.04 install and I have been looking around for an all in one script, or some scripts I can cobble together

I have the two links detailed that I think will be handy, can anyone else add to this please?

How do I install Oracle Java JDK 7?

Install Oracle Java 7 in Ubuntu via PPA Repository

Update: I have now found you can install IntelliJ through the Ubuntu software centre, so although this was a nice learning exercise for me it's not really relevant any more. Thanks to everyone that contributed.


Source: (StackOverflow)

How to uninstall OpenJDK?

I don't want OpenJDK installed on my Ubuntu 13.04 system, but trying to uninstall the openjdk-7-jre yields the following message:

$ sudo apt-get purge openjdk-7-jre
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gcj-4.7-base gcj-4.7-jre gcj-4.7-jre-headless gcj-4.7-jre-lib gcj-jre gcj-jre-headless icedtea-6-jre-cacao icedtea-6-jre-jamvm libgcj-common libgcj13 libgcj13-awt
  openjdk-6-jre-headless openjdk-6-jre-lib
Suggested packages:
  fastjar gcj-4.7-jdk gcj-jdk libgcj13-dbg sun-java6-fonts fonts-ipafont-gothic fonts-ipafont-mincho ttf-telugu-fonts ttf-oriya-fonts ttf-kannada-fonts
  ttf-bengali-fonts
The following packages will be REMOVED:
  default-jre* icedtea-7-plugin* icedtea-netx* icedtea-plugin* libatk-wrapper-java* libatk-wrapper-java-jni* openjdk-7-jre*
The following NEW packages will be installed:
  gcj-4.7-base gcj-4.7-jre gcj-4.7-jre-headless gcj-4.7-jre-lib gcj-jre gcj-jre-headless icedtea-6-jre-cacao icedtea-6-jre-jamvm libgcj-common libgcj13 libgcj13-awt
  openjdk-6-jre-headless openjdk-6-jre-lib
0 upgraded, 13 newly installed, 7 to remove and 4 not upgraded.
Need to get 57,0 MB/57,2 MB of archives.
After this operation, 156 MB of additional disk space will be used.
Do you want to continue [Y/n]?

What do I need to do so that no new packages, of which I need none, will be installed when removing openjdk-7?


Source: (StackOverflow)

How can I select which Java to use?

I have installed both OpenJDK 6 and 7. When I run "java somefile" from the command line, OpenJDK 6 is invoked. I do not want to change this default behavior. What command can I use to run my non-default OpenJDK 7 installation instead?

(I am used to running "python somefile" to invoke the default Python, "python2.7 somefile" to use Python 2.7 specifically and "python3 somefile" to use Python 3 specifically.)


Source: (StackOverflow)