Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Currently, I'm trying to launch a java program on a server. The server is launched on my virtual machine (VirtualBox) and controlled over SSH. Its OS is Debian. So, in order to launch my program I need jdk7. I've downloaded its tar.gz archive to the server and extracted it to /usr/java. But the system can't see the new jdk. When I type "java -version" in my terminal it writes 1.6 instead of desired 1.7. So, a trivial question: how can I install jdk7 on Debian? (No GUI is available).

share|improve this question
1  
/usr/java/ wont be in your path (or indeed /usr/ if you put the java executable directly in there). You already have some varient of java installed which is giving you the 1.6 - probably from a package. Type dpkg -S `which java`, what comes up? –  didster Oct 11 '12 at 14:54
    
Here's an output of that command: dpkg: /usr/bin/java not found. and how can I add a folder to the path? –  Angstrem Oct 11 '12 at 15:58
    
OK so you have a /usr/bin/java that has got there from some other way - probably a manual install. Do ls -laF /usr/bin/java and see what that gives you - does it point to /etc/alternatives/java? If so, please then run update-alternatives --list java and post the results. There are many different ways of getting Java on Debian. Also post the list of directories under /usr/java/ –  didster Oct 11 '12 at 18:04
add comment

1 Answer 1

Simply extracting the archive's contents will not install your software. Check the folder where you extracted the files, there will be installation instructions there.

You can also try following this guide to create a debian package from the tar.gz archive.

Finally, jdk1.7 is in Debian's "experimental" repository. You can edit /etc/apt/sources.lst to include this line:

deb http://ftp.debian.org/debian experimental main

Then run these commands:

sudo apt-get update
sudo apt-get install default-jdk

WARNING: Depending on how up to date your system is, many packages might need to be updated which could result in an unstable system. Make sure you change your /etc/apt/sources.lst back to how it was before if you chose this method.

share|improve this answer
    
See also apt pinning possibilities at wiki.debian.org/AptPreferences (or recompile from the experimental source package for your release = poor man's backport with dpkg-buildpackage); it's less dangerous! –  tricasse Oct 11 '12 at 23:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.