简体   繁体   中英

Javac not installed with openjdk-6-jdk

I have been trying some different java compilers over the weekend and decided to stick with javac this morning. I then proceeded to clean up the mess that was caused by my testing and removed every last trace of java and did a fresh 'apt-get install openjdk-6-jdk' after autoremove and autoclean.

The following weirdness was then encountered:

tarskin@5-PARA-11-0120:~$ javac
The program 'javac' can be found in the following packages:
 * openjdk-6-jdk
 * ecj
 * gcj-4.4-jdk
 * gcj-4.6-jdk
 * gcj-4.5-jdk
 * openjdk-7-jdk
Try: sudo apt-get install <selected package>

I had allready installed openjdk but i tried it anyhow yielding:

tarskin@5-PARA-11-0120:~$ sudo apt-get install openjdk-6-jdk
[sudo] password for tarskin: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
openjdk-6-jdk is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
tarskin@5-PARA-11-0120:~$ 

I know i must be doing something stupid but I have no idea what, if anyone else could give a pointer in the right direction that would be very much appreciated...

Cheers

EDIT: Found some other weird aspects about the 'new' instance of my java distro, it doesn't seem to recognise for example 'Pattern' or 'Matcher' that should be coming from the regex import shrugs .

TL;DR: install java-1.6.0-openjdk-devel

I had a similar issue on Fedora, but used rpm -q -l to list the contents of the (pre-installed) java-1.6.0-openjdk package, and discovered that it doesn't include javac. It is in fact only a JRE, not a JDK, as implied by the installation instructions on http://openjdk.java.net/install/ . To get javac, I installed java-1.6.0-openjdk-devel . Not exactly what I expected, because the usual packaging conventions would indicate that is the package for doing openjdk development (ie, working on the JVM), not for developing programs with it.

Basically, openjdk's package naming doesn't follow either standard Java conventions (would require calling it a JRE somewhere), or standard Linux packaging conventions (using -devel indicates it is used for developing the package w/o -devel itself).

As per http://openjdk.java.net/install/ , to install the OpenJDK-6 JRE only:

$ sudo apt-get install openjdk-6-jre

To install the full JDK :

$ sudo apt-get install openjdk-6-jdk

Check /etc/alternatives and /usr/bin . One or both will contain links to old Java versions which you had installed. When those links are broken, you can get the error message above.

To update the links after installing a new version of Java, try update-alternatives

First to check if javac is installed try to look for that file: 1. locate javac 2. or find / -name javac

And also you can check at this website with instrucions on how to install java on Ubuntu (i suppose you are on ubuntu):

http://openjdk.java.net/install/

You can also check: http://packages.ubuntu.com/hardy/i386/openjdk-6-jdk/filelist for the files installed by the pacakge, and you can notice that javac should be installed. Maybe you also need to run: Open the terminal and run this command to install OpenJDK 7.0 on Ubuntu Oneiric:

sudo update-alternatives --config java

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM