| Author |
Using Java in Linux
|
James Hambrick
Ranch Hand
Joined: Sep 04, 2004
Posts: 277
|
|
I have downloaded JDK6 and installed it, but when I try to do javac <filename> I get this. The program 'javac' can be found in the following packages: * gcj-4.1 * jikes-sun * jikes-sablevm * gcj-4.2 * kaffe * jikes-classpath * java-gcj-compat-dev * ecj * j2sdk1.4 * jikes-gij * jikes-kaffe * sun-java5-jdk * sun-java6-jdk Try: sudo apt-get install <selected package> bash: javac: command not found I have tried it at my desktop(where the java file is saved) and I have tried it in the bin folder where javac is actually found and it still does not work. Any Ideas? I have used Netbeans and it compiles fine so I'm pretty sure the installation is fine.
|
Visit my blog! http://jameshambrick.com
|
 |
Pat Farrell
Rancher
Joined: Aug 11, 2007
Posts: 4422
|
|
you didn't specify which distribution you are using, but it sounds like you are having problems because /etc/alternatives is not set for Java. Did you check that java is on your executable path? have you done a: which java
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
Which version of which Linux distribution are you using? I'm using Ubuntu 7.10 (and 8.04 beta) myself, and the best way to install Sun JDK 6 is to install it via the package management system (instead of downloading the setup file from Sun's website and installing it manually): Most Linux distributions have a package management system to install software, but the commands may differ. [ April 11, 2008: Message edited by: Jesper Young ]
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Frank Bacher
Greenhorn
Joined: Oct 25, 2002
Posts: 19
|
|
Have you already tried (on Debian/Ubuntu. On other linuxes there is probably a command to configure the used Java, too). [ April 11, 2008: Message edited by: Frank Bacher ]
|
 |
James Hambrick
Ranch Hand
Joined: Sep 04, 2004
Posts: 277
|
|
whoops. I have Ubunto 7.10. I did download it from Suns site. I then made the .tar/.bin file executable using chmod +x <filename> and then ran it like this ./<filename> went through and accepted all the agreements and everything. If it's easier to install using the Ubuntu installer then how do I get rid of what I installed? Will the Ubuntu installer just overwrite it and set the correct settings. I don't know how to set Java on my execution path.
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14491
|
|
Originally posted by James Hambrick: whoops. I have Ubunto 7.10. I did download it from Suns site. I then made the .tar/.bin file executable using chmod +x <filename> and then ran it like this ./<filename> went through and accepted all the agreements and everything. If it's easier to install using the Ubuntu installer then how do I get rid of what I installed? Will the Ubuntu installer just overwrite it and set the correct settings. I don't know how to set Java on my execution path.
export JAVA_HOME=/usr/java/jdk1.6.xxxxx export PATH=$JAVA_HOME/bin:$PATH I loathe "alternatives". It's too complex, especially in the case of Java, where there's multiple items that need to be switched. So I ignore them and manually put the JVM I prefer in my path ahead of the alternatives java. Note that the Sun JDK can live in any directory you want, though the RPM installs will put it in /usr/java by default. That's good enough for me, so even on non-Redhat (and even non-Linux) systems, I normally do likewise.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
James Hambrick
Ranch Hand
Joined: Sep 04, 2004
Posts: 277
|
|
|
Would it matter setting the execution path if it did not work in the bin folder that contained javac?
|
 |
James Hambrick
Ranch Hand
Joined: Sep 04, 2004
Posts: 277
|
|
|
I ran sudo apt-get install sun-java6-jdk and it works now. Does this mean I installed it twice?
|
 |
Stefan Wagner
Ranch Hand
Joined: Jun 02, 2003
Posts: 1923
|
|
Originally posted by James Hambrick: I ran sudo apt-get install sun-java6-jdk and it works now. Does this mean I installed it twice?
Probably. Use locate javac to see, where javac might be found - one place or two of them. which javac will show, what was installed well, so remove the other directory tree.
|
http://home.arcor.de/hirnstrom/bewerbung
|
 |
 |
|
|
subject: Using Java in Linux
|
|
|