jdk interview questions

Top 15 jdk interview questions

14696 Jobs openings for jdk

Which Java package should I use: OpenJDK or Oracle JDK?

I'm new to Java development under Ubuntu. When I typed javac in the terminal, it prompted me to install OpenJDK and a bunch of other JDKs. I want to know if there is any difference between OpenJDK 7 and Oracle's JDK 7. Are they basically the same? Thanks.

Source: (StackOverflow)

How to remove Oracle JDK

I didn't find article any related articles How to remove Oracle JDK there are some related articles but they didn't solve the problem.

I installed Oracle JDK tarball file from Oracle site by following this article How do I install Oracle Java JDK 7. It was very helpful. but I don't what I should do to uninstall Oracle JDK.

Source: (StackOverflow)

"No such file or directory" when invoking java

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?

Source: (StackOverflow)

How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?

I want to install Oracle's JRE and to update to the latest version with the Software Updater when they released. Is there a Ubuntu package that is provided by Canonical or Oracle?

Before release Java 7, I followed this way to install Java 6.

But it doesn't work for Java 7. There is no package sun-java7-xxx. How can you install Java 7?

Source: (StackOverflow)

Where is the Oracle java jdk keystore located?

Installed Oracle Java with the webupd8 ppa and need to tweak some policy settings (access to clipboard specifically)

webUpd8 plug: http://www.webupd8.org/2011/09/how-to-install-oracle-java-7-jdk-in.html

(these guys have done alot for the Ubuntu community)

Previously it was under /etc/java-6-oracle

Google doesn't have any answers on this one -- any ideas?

Source: (StackOverflow)

installed jdk by and have Error: Could not create the Java Virtual Machine

I am getting my new laptop going and went to install the latest oracle JDK 7u25. I followed the instructions on this site to do it.

Afterwards when I type java --version in the terminal I get the error:

Error: Could not create the Java Virtual Machine

I tried reinstalling it via a different method but the error wont go away. I am running Ubuntu 12.04 64bit.

Source: (StackOverflow)

How do I install Oracle Java JDK 7? [duplicate]

This question already has an answer here:

If I downloaded the latest JDK from Oracle, do I just download the .tar file and extract it to /usr/lib/jvm/?

Source: (StackOverflow)

How do I install Oracle JDK 6? [duplicate]

This question already has an answer here:

Most of the software is not thoroughly tested with Java 7 and I would like to install Oracle's JDK 6.0 on Ubuntu 11.10.

Could someone please provide me the instructions for the same?

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

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)

Specify JDK for tomcat7

I have installed tomcat7 (using apt-get install) and whenever I want to start tomcat7 it says :

* no JDK found - please set JAVA_HOME

I have set JAVA_HOME in my bash.bashrc and also in ~/.bashrc and when I issue echo $JAVA_HOME I clearly see that this variable is pointing to my jdk's root folder. Can someone help me with this please?


Source: (StackOverflow)

'tools.jar' is not in IDEA classpath

I am a new user of Linux, it has been recommended to me by my friend.

He told me to install software called IntelliJ Idea IDE.

Well I have been following the tutorial. But now when I try to open "idea.sh", an error message pops-up:

'tools.jar' is not in IDEA classpath.
Please ensure JAVA_HOME points to JDK rather than JRE.

Please remember that I'm new to Ubuntu and I'm planning for a nice long stay once I get myself into it :)

Also I do not know if I am running a correct Java6 JDK. When I do java -version, this is what I get:

java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre10-0ubuntu5)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

Thank You for reading this and I hope I will get a nice response.

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)

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)

Changing JVM in Java

I only recently discovered the different JVM's on the wiki page and thought I'd start tinkering. Its been difficult to find documentation on how to configure Java on Ubuntu though.

Lets say I wanted to change the JRE or JDK that I'm using, I could crack open a terminal and say

sudo update-alternatives --config java

And then pick from one of the installed versions.

If I'm understanding JVM's right (which I may very well be not), You can configure the openJDK to use alternative JVM's (Eg JAMVM) and run it as such

jamvm -jar foo.jar

2 questions,

1: Do i have the concept of a JVM right? As in, is this possible?

2: If so how do i configure the JVM and switch the default to a JVM of my choosing?

Source: (StackOverflow)