aspose file tools*
The moose likes Beginning Java and the fly likes Trouble Installing JDK on a Netbook Running Ubuntu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Trouble Installing JDK on a Netbook Running Ubuntu" Watch "Trouble Installing JDK on a Netbook Running Ubuntu" New topic
Author

Trouble Installing JDK on a Netbook Running Ubuntu

Ben Stanley
Greenhorn

Joined: Sep 01, 2010
Posts: 15
Hi everyone,

I'm continuing to work through Head First Java and having a great time, even if it is slow going (had to read the polymorphism stuff twice), but I've encountered one roadblock. I recently purchased a netbook for portability purposes and installed Ubuntu, my operating system of choice, on it. However, I can't for some reason get a successful install of Sun's JDK. This is especially odd because I had no trouble installing it on my notebook that runs Ubuntu.

Here are the steps I took to attempt to install the JDK on my netbook:

(1) Downloaded the file (jdk-6u21-linux-i586.bin) from here:

https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFilter

(2) Opened terminal, and typed the following:



At this point, a bunch of files appeared to be installed, just like they did when I successfully installed the jdk on my notebook. However, when I type "java" or "javac" I don't get anything indicating that the jdk is installed. Furthermore, when I type



it accesses the open java implementation that I suppose comes installed by default with some linux distributions, like Ubuntu.

I thought at first that the issue might be that I needed to edit my PATH environment variable, but I can't find any directory from within which the "javac" command is found. Nor has a search revealed that it even exists on the machine.

Any help would be much appreciated, as I was really hoping to be able to make this work on my netbook.

Thanks in advance!

Ben



Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38412
    
  23
Which shell are you using? If "bash", then edit .bashrc from your home folder (~). My .bashrc has this line in
export PATH=/usr/java/jdk1.6.0_21/bin:.:~/forth/rvm/:$PATH
You obviously don't need the forth installation, but you can add the Java PATH and also (if you wish) the . for current directory. Save the file without closing the editor, close and reopen your terminal, and try again.

By the way: It's not bashrc, but .bashrc. The initial . means it's a hidden file.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38412
    
  23
The "javac" instruction should be inside whichever directory you put after the cd instruction you obscured in your post. Remember to start your PATH entry with / or ~ and end with bin.
Ben Stanley
Greenhorn

Joined: Sep 01, 2010
Posts: 15
Thanks for the replies Campbell, but I'm afraid that you're one step ahead of me

Even after running the .bin file, there appears to be no "javac" file anywhere on my machine!?! I've confirmed this by searching the for the file multiple ways.

How is it possible that once I ran the .bin file it didn't install "javac"?

Thanks again.
Ben Stanley
Greenhorn

Joined: Sep 01, 2010
Posts: 15
This is so weird!....I actually DO have "javac" but I can't run it even when I'm in the appropriate directory!

If I do this in the terminal:



I can see that "javac" is there, but when I type "javac" while in that directory it still acts as though it's not installed!

It sounds like you're right, Campbell, that I need to set the PATH variable (this could explain why a search didn't turn anything up either I guess), but shouldn't it work even without having taken this step, if I'm in the directory in which "javac" is actually located?

Thanks.

Ben Stanley
Greenhorn

Joined: Sep 01, 2010
Posts: 15
Once I edit .bashrc as you suggested, I can access javac from within the directory in which it resides, but I still can't do so from other directories (and, yes, I included "." in my path)...
Ben Stanley
Greenhorn

Joined: Sep 01, 2010
Posts: 15
Sorry for the quadruple post, but I think everything is working now.

I just had to add the "~" in front of the "/Development/Java...".

Thanks so much for your help Campbell!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38412
    
  23
You're welcome Well done getting it sorted, and I did say the PATH entry might have to start with ~
Ben Stanley
Greenhorn

Joined: Sep 01, 2010
Posts: 15
yes, you certainly did Thanks again for the help.
 
 
subject: Trouble Installing JDK on a Netbook Running Ubuntu