Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to try out some features rolled out in Oracle's new JDK 1.7. I followed the post:- Oracle JDK 1.7 but the post doesn't seem to help.

I was trying to fetch out the structure for java.nio.file.Paths class file but got the following error:-

buffer@ankit:~$ javap java.nio.file.Paths ERROR:Could not find java.nio.file.Paths

However i can easily get the information about class structures till JAVA SE 1.6, here is an example:-

buffer@ankit:~$ javap java.lang.Object
Compiled from "Object.java"
public class java.lang.Object{
    public java.lang.Object();
    public final native java.lang.Class getClass();
    public native int hashCode();
    public boolean equals(java.lang.Object);
    protected native java.lang.Object clone()       throws java.lang.CloneNotSupportedException;
    public java.lang.String toString();
    public final native void notify();
    public final native void notifyAll();
    public final native void wait(long)       throws java.lang.InterruptedException;
    public final void wait(long, int)       throws java.lang.InterruptedException;
    public final void wait()       throws java.lang.InterruptedException;
    protected void finalize()       throws java.lang.Throwable;
    static {};
}

Running java -version gives the following result:-

buffer@ankit:~$ java -version java version "1.7.0_09" Java(TM) SE Runtime Environment (build 1.7.0_09-b05) Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)

SYSTEM INFORMATION

buffer@ankit:~$ sudo update-alternatives --config java
[sudo] password for buffer: 
There are 4 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode
  3            /usr/lib/jvm/jdk1.7.0_09/                        1         manual mode
* 4            /usr/lib/jvm/jdk1.7.0_09/bin/java                1         manual mode



buffer@ankit:~$ sudo update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).

  Selection    Path                                         Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk-amd64/bin/javac   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk-amd64/bin/javac   1061      manual mode
* 2            /usr/lib/jvm/jdk1.7.0_09/bin/javac            1         manual mode



buffer@ankit:~$ sudo update-alternatives --config javaws
There are 3 choices for the alternative javaws (providing /usr/bin/javaws).

  Selection    Path                                              Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws   1061      manual mode
  2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/javaws   1060      manual mode
* 3            /usr/lib/jvm/jdk1.7.0_09/bin/javaws                1         manual mode

The directory structure of /usr/lib/jvm/ is as follows:-

buffer@ankit:~$ ls -l /usr/lib/jvm/
total 24
lrwxrwxrwx 1 root   root     24 Dec  2  2011 default-java -> java-1.6.0-openjdk-amd64
drwxr-xr-x 4 root   root   4096 Nov  8 16:24 java-1.5.0-gcj-4.6
lrwxrwxrwx 1 root   root     24 Dec  2  2011 java-1.6.0-openjdk -> java-1.6.0-openjdk-amd64
lrwxrwxrwx 1 root   root     20 Oct 25 00:01 java-1.6.0-openjdk-amd64 -> java-6-openjdk-amd64
lrwxrwxrwx 1 root   root     20 Oct 25 06:59 java-1.7.0-openjdk-amd64 -> java-7-openjdk-amd64
lrwxrwxrwx 1 root   root     24 Dec  2  2011 java-6-openjdk -> java-1.6.0-openjdk-amd64
drwxr-xr-x 7 root   root   4096 Nov  8 16:24 java-6-openjdk-amd64
drwxr-xr-x 3 root   root   4096 Nov  8 16:24 java-6-openjdk-common
drwxr-xr-x 5 root   root   4096 Nov  8 05:48 java-7-openjdk-amd64
drwxr-xr-x 3 root   root   4096 Nov  8 05:48 java-7-openjdk-common
drwxr-xr-x 8 buffer buffer 4096 Sep 25 09:08 jdk1.7.0_09

Any help would be highly appreciated.

share|improve this question
2  
Have you similarly done a update-alternatives on javap ? –  fossfreedom Nov 23 '12 at 8:23
    
@fossfreedom, +1, i made changes to java,javac and javaws. I made similar changes to javap and it works :). You can please post your comment as an answer so that I can accept. –  Ankit Nov 23 '12 at 8:37

2 Answers 2

up vote 2 down vote accepted

java executable

Java consists of many individual executables - javac and javaws are the most common.

javap is another - when installing Java you need to individually ensure that each executable has been registered - you do so with update-alternatives

sudo update-alternatives --install "/usr/bin/java" "javap" "/usr/lib/jvm/jdk1.7.0/bin/javap" 1
sudo update-alternatives --config javap

This answer gives you a list of the individual executables that you can register if you wish to use them during development.

Alternatively - you could use a third-part PPA such as webupd8 - but as a developer myself, I like to understand the issues and tailor my configuration to my needs.

share|improve this answer

Install it through this PPA

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

http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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