Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323
Rep:
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).
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323
Original Poster
Rep:
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.
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.
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.
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323
Original Poster
Rep:
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.
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.
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323
Original Poster
Rep:
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?
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.
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).
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323
Original Poster
Rep:
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?
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323
Original Poster
Rep:
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.