LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-19-2007, 03:19 PM   #1
lumix
Member
 
Registered: Mar 2007
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323

Rep: Reputation: 30
How to install JDK , Debian and in general...


so the Sun site says run the install! and life is javalicious. But this is not the case. I ran the .bin file (yes I've tried the rpm too), and it does NOTHING to set up the environment as far as I can tell.

Anyone know what environment settings need to be set and how?

Debian Etch, (but wondering how this is done in general).

Thanks.
 
Old 03-19-2007, 03:28 PM   #2
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
Most people would do ... # aptitude install sun-java6-jdk
 
Old 03-19-2007, 03:36 PM   #3
lumix
Member
 
Registered: Mar 2007
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323

Original Poster
Rep: Reputation: 30
Yeah, tried that too...

actually, I'm looking for java5 because I'm in a class that's teaching in that environment (and it's required). But anyway, substituting 5 for 6, the package name is found but the package is not. I get:

Failed to fetch ftp://ftp.au.debian.org/debian/pool/...-10-3_i386.deb Unable to fetch file, server said '/debian/pool/non-free/s/sun-java5/sun-java5-jdk_1.5.0-10-3_i386.deb: No such file or directory ' [IP: 203.16.234.86 21]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?


Did the apt-get update ...nothing new.

ALSO: I have succeeded in getting the above installed by tediously getting each dependency whined about and forcing the installs where there were circular dependencies. The apt-get did not set up a path (which I've done manually), nor has it set up the many other variables that I believe are necessary, like classpath.

Last edited by lumix; 03-19-2007 at 03:40 PM.
 
Old 03-19-2007, 03:37 PM   #4
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Yes, it's very easy to install from the repositories. If you do install the bin file provided by sun instead, you would have to:
- edit /etc/profile
- edit $HOME/bash_profile
- edit java in /etc/alternatives
That's what I had to do on Fedora but I really don't see any need to go to this trouble with Debian.

Edit: I just read your most recent post; I'm a java developer myself and I wonder whether it makes any difference whether you use 1.6 or 1.5. But if you do insist on jdk5, the you may have to try a different mirror.

Last edited by jay73; 03-19-2007 at 03:42 PM.
 
Old 03-19-2007, 03:44 PM   #5
lumix
Member
 
Registered: Mar 2007
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323

Original Poster
Rep: Reputation: 30
Is there something wrong with a config file that aptitude (or apt-get) uses, per the above error?
 
Old 03-19-2007, 03:49 PM   #6
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Your repository files may be outdated. Just run

apt-get update

from the command line and it will fetch the latest "index" of the repositories.

Edit: I'm begin to wonder whether the package is in the testing repositories at all; I remember I had to fetch a number of packages from sid instead - jdk6 may have been one of them.

Edit2: of course, you need jdk FIVE - ignore my previous edit.

Last edited by jay73; 03-19-2007 at 03:52 PM.
 
Old 03-19-2007, 03:53 PM   #7
lumix
Member
 
Registered: Mar 2007
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323

Original Poster
Rep: Reputation: 30
I did that already and got a similar error (noted in above message). Ironically, you'll note it tells me that to fix it I might try running "apt-get update."

Error after "sudo apt-get update"

Failed to fetch ftp://ftp.au.debian.org/debian/dists...rce/Sources.gz Unable to fetch file, server said '/debian/dists/testing/non-free/source/Sources.gz: No such file or directory ' [IP: 203.16.234.86 21]
Reading package lists... Done
W: GPG error: http://www.backports.org sarge-backports Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EA8E8B2116BA136C
W: You may want to run apt-get update to correct these problems
E: Some index files failed to download, they have been ignored, or old ones used instead.
 
Old 03-19-2007, 05:32 PM   #8
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
OK, it looks as if you haven't got the key; or else it may have been updated. I suggest doing this as root:

gpg --keyserver wwwkeys.eu.pgp.net --recv-keys XXXXXXXXXXXXX (where the Xs represent the key number returned after trying to do an apt-get update)

then:

apt-key add /root/.gnupg/pubring.gpg

then:

apt-get update

If that doesn't help, you may want to try a different mirror, plenty to choose from:

http://www.debian.org/mirror/list

EDIT: I just checked the mirror you are using now; you're right, it does not appear to exist so grabbing a new key will not work. But I do not see why you should have to go for a backport to Sarge. Aren't you using Etch? jdk5 can be had from the regular Etch repositories.

Last edited by jay73; 03-19-2007 at 05:37 PM.
 
Old 03-20-2007, 07:49 AM   #9
lumix
Member
 
Registered: Mar 2007
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323

Original Poster
Rep: Reputation: 30
So I've done this, and thank you, my apt-get now works, but my java still doesn't. It did the install without complaint but still didn't create any paths or environment variables of any kind, that I can tell. So when I try to run something very simple:


class PyramidVolTest{

public int pyramidVol(int rows){

if (rows==1) return 1;
else return rows*rows+(pyramidVol(rows-1));
}

public void main(String[] args) {System.out.println (pyramidHght(4));}


}

I'm getting:

java.lang.UnsupportedClassVersionError
at java.lang.VMClassLoader.nativeDefineClass (VMClassLoader.java)
at java.lang.VMClassLoader.defineClass (VMClassLoader.java:130)
at java.lang.ClassLoader.defineClass (ClassLoader.java:679)
at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:108)
at java.net.URLClassLoader.findClass (URLClassLoader.java:955)
at java.lang.ClassLoader.loadClass (ClassLoader.java:359)
at java.lang.ClassLoader$1.loadClass (ClassLoader.java:1333)
at java.lang.ClassLoader.loadClass (ClassLoader.java:310)
at java.lang.VirtualMachine.main (VirtualMachine.java:99)



Shouldn't I see a Classpath, among others, in the env vars?

Thanks again, for the help.

Last edited by lumix; 03-20-2007 at 07:52 AM.
 
Old 03-20-2007, 08:46 AM   #10
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Did you check the target of the java related items in /etc/alternatives, particularly java and javac? These should point to the java and javac items in your jdk/bin folder.
 
Old 03-20-2007, 09:28 AM   #11
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
You should at least have
JAVA_HOME=/path/to/jdk1.5.x/
and ${JAVA_HOME}/bin in your $PATH.

I set both up manually after installing from the .bin file (RedHat & Fedora).
Either put them in your .bashrc, .bash_profile or in the system-wide /etc/bashrc or /etc/profile.

The Classpath can be set when running the java/javac executables (see for instance java's --cp and --classpath options).
 
Old 03-20-2007, 09:34 AM   #12
lumix
Member
 
Registered: Mar 2007
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323

Original Poster
Rep: Reputation: 30
Forgive my ignorance, but I don't exactly understand what that means. There are 2 files in that directory by those names (java & javac), but they are large and cryptic to me.

Incidentally, how would I have known to look into these? Did I miss some documentation somewhere?

In any case, I really appreciate your help.
 
Old 03-20-2007, 09:39 AM   #13
lumix
Member
 
Registered: Mar 2007
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by timmeke
You should at least have
JAVA_HOME=/path/to/jdk1.5.x/
and ${JAVA_HOME}/bin in your $PATH.

I set both up manually after installing from the .bin file (RedHat & Fedora).
Either put them in your .bashrc, .bash_profile or in the system-wide /etc/bashrc or /etc/profile.

The Classpath can be set when running the java/javac executables (see for instance java's --cp and --classpath options).

Where are my class files? How do I get the paths to stick? I "export" the paths but they're gone when I reboot.

Yes, I'm a newb to both linux and java...that's why I'm taking a class for it. I still don't get why Sun's install page mentions none of this.

Last edited by lumix; 03-20-2007 at 09:41 AM.
 
Old 03-20-2007, 09:54 AM   #14
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
This will help set your path in /etc/profile (=system-wide); as root:

echo JAVA_HOME=/path/to/jdkXXX >> /etc/profile
echo export JAVA_HOME >> /etc/profile
source /etc/profile

To verify, type:
echo $JAVA_HOME

That should return the path to your jdk.

As for /etc/alternatives, you can check whether your jdk is properly recognized by typing:

java -version

That should return a description of the currently installed jdk.

Last edited by jay73; 03-20-2007 at 09:58 AM.
 
Old 03-20-2007, 10:05 AM   #15
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
I wouldn't say that you're ignorant, rather that you're new to this, but at the same time inquisitive and looking for help and information, which is a good attitude and exactly what these forums are for.

javac is the java compiler (it compiles .java source files into binary class files) and java is the tool to run already compiled programs.

It used to mention this $JAVA_HOME stuff on the java.com website, but it doesn't seem to any more.
I found an explanation in one of the tutorials on java.sun.com (the Java developer website): http://java.sun.com/docs/books/tutor...ems/index.html
Basically, what you'll do is add /path/to/your_jdk/bin to your $PATH environment variable, so that you can
just type "javac yourClass.java" or "java yourApplication.class" rather than having to type the entire path of javac/java each time.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
JDK Install fails with install.sfx.#### No such file during installation. weibullguy Linux From Scratch 13 04-14-2012 10:54 PM
help to install jdk Carunkumar Ubuntu 11 12-25-2006 01:22 AM
jdk for debian win2suse Debian 1 08-31-2006 10:46 AM
Install JDK on Mepis tuxhats MEPIS 10 06-07-2006 08:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration