Execution of java and javac commands
Alfred Vahau
alf.vahau at upng.ac.pg
Thu Dec 8 16:25:15 UTC 2005
On Wed, 2005-12-07 at 19:21 +1100, Alfred Vahau wrote:
> On Tue, 2005-12-06 at 14:57 +0000, Dick Davies wrote:
> > > On 12/5/05, Alfred Vahau <Alf.Vahau at upng.ac.pg> wrote:
> >
> > > > How can I get the system to recognize that java and javac are on the
> > > > environment path? I have tried rebooting (I didn't think this was necessary
> > > > but tried anyway and it didn't make a difference.) For noting the execution
> > > > of the java command is successful when I am in the directory containing the
> > > > command and issuing a command for an example like so:
> > > >
> > > > ./java -jar SampleTree.jar
> >
> > Add the directory you are in to the path.
> >
> > I should point out that /usr/bin/java is supposed to be a symlink into
> > /etc/alternatives.
> >
> > If you install a jdk 'The Debian (Ubuntu) Way[1], you'd use :
> >
> > update-alternatives --set java /path/to/java command
> >
> > to point the /usr/bin/java symlink where you want it to be.
> > Do the same thing for javac, rmid, etc.
> >
> > (some of these are taken care of automatically for you if you install with
> > java-package) .
> >
> > [1]: http://www.debian-administration.org/articles/142
> >
> > --
> > Rasputin :: Jack of All Trades - Master of Nuns
> > http://number9.hellooperator.net/
> >
> Thanks. I'll try this pointer first and report the outcome to the list.
> But I came to a conclusion overnight (10 hours ahead of GMT) that maybe
> it was doing the installation the non-debian way that led to the
> problem. I have downloaded the rpm packages from the Java site and will
> convert them to the deb packages prior to installation. I hope that the
> system will take care of itself this way. I already had an experience
> with the installation of the OpenOffice2.0 with the help of the list so
> I am sure that will be the way to go.
>
> Alfred,
>
>
It turned out that installation via the 'Debian (Ubuntu)' way was
successful. I downloaded the fakeroot and java-packages from the Debian
site together with the dependent libc6 package needed by fakeroot.
After installing these using apt-get, I converted the java bin packages
to debs using the fakeroot command and this was o.k although a few
dependents were flagged but I ignored these. The final step was to
install the deb packages and this was done using the dpkg -i command.
The executables were placed in /usr/lib/j2re1.5-sun/bin/java for
instance. I checked the /etc/alteratives and noted that java was a
symlink to /usr/lib/j2re1.5-sun/bin/java.
The final step was to get the path correct as java was not on the path.
So I issued a command to include the path like so:
PATH=/usr/lib/j2re1.5-sun/bin:$PATH
export PATH
When I issued the command 'which java', it returned a positive reply
which was /usr/lib/j2re1.5-sun/bin/java as registered in the /etc
alternatives file.
I edited the /etc/profile file and inserted the java PATH in it. To flag
the change, I issued the command '. profile' and further confirmation of
the path was indicated by the 'which java' returning a positive result.
I will keep the java path for now but I prefer to have it
in /usr/bin/java. I was unsuccessful at executing the
update-alternatives command to have the /usr/bin/java symlink point to
j2re1.5-sun/bin/java as in /etc/alternatives.
I'm still curious why my first attempts, 'non-Ubuntu' installations
failed to give the JRE. In particular why the use of the alien and the
dpkg combination failed but I'll check those again to see where I went
wrong. For now I can issue the Java command anywhere which was the
objective.
As a result, one of the outstanding problem relating to OpenOffice2.0
installation associated with the javaldx error message has been
eliminated. Now I can move on to testing a Java-based online student
system on Ubuntu and I hope my Breezy CDs will arrive soon enough so I
can get this project off the ground. At present all my testing is done
on the Ubuntu Warty.
All the replies were very much appreciated and very helpful in solving
my problem.
Thanks once again.
Alfred Vahau
More information about the ubuntu-users
mailing list