How get going with running and compiling Java programs in Debian real quick

In order to run java software, not only do you need the java-common package, but proboably also a sun jdk package such as sun-java5-bin. You may also want to installt he javacc package. I.e.:

sudo aptitude install java-common sun-java5-bin sun-java5-jdk sun-java5-jre javacc

You reach java as /usr/bin/java . This file is really a link to /etc/alternatives/java , which in turn is a link to your java installation folder that's located in /usr/lib/jvm . For instance, java may link via /etc/alternatives/java to /usr/lib/jvm/java-1.5.0-sun/jre/bin/java .

If you have more detailed questions, you may be interested in seeing

One particular reason that may lead your interest to read the tips above, is in case ant terminates for you with the error:

About Blackdown Java and alternatives


I want to install the ["Java"] runtime 1.4.1 from Blackdown and do

 [apt-get] install j2re1.4 

it escapes with an error message :

 update-alternatives: unable to make /usr/lib/mozilla-cvs/plugins/ 
 a symlink to /etc/alternatives/ No such file or directory

What is wrong?


Seems that this error message happen when the directory


does not exist. According to debian-user maillist this has been reported as a bug, but a workaround exist

 mkdir -p /usr/lib/mozilla-cvs/plugins

will make the install procedure continue without problem.

See also:

About pbuilder and Sun's Java SDK


I am build-depending on sun-javaX-jdk. However, I can't get an automatic build in a clean environment working, because sun-javaX-jdk does not install in a non-interactive environment, because it asks for license confirmation:

 Unpacking sun-java6-jdk (from .../sun-java6-jdk_6-06-1_amd64.deb) ...
 sun-dlj-v1-1 license could not be presented
 try 'dpkg-reconfigure debconf' to select a frontend other than noninteractive


There are two possible answers:

Patch one and for all your pbuilder environment

 $ sudo pbuilder login --save-after-login
 # echo "sun-java5-jdk shared/accepted-sun-dlj-v1-1 boolean true" | debconf-set-selections
 # echo "sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true" | debconf-set-selections
 # exit

Add a hook to patch it on the fly

In Manuel Prinz says:

As mentioned in man pbuilder, you need to make the hook script (D50sun-java-licenses) executable before pbuilder will load it.