Zac
Zac

Reputation: 791

Java/Ubuntu Config

I am a brand-new Ubuntu user trying to manually install Java. I am trying to avoid using apt-get or Synaptic to do all the work for me, because I want to really understand the process of configuring a JDK on Ubuntu, even if it is more difficult and takes longer.

I downloaded the JDK binary to my /home/myUsername/Downloads directory, and then moved it to /opt/java because that is where I would like my Java to be based out of.

It looks like there are some basic UNIX-like configs I need to do manually, and I'm not sure what they are, how to do them, and in what order. Things, perhaps, such as setting the PATH and CLASSPATH env variables in the .bashrc file.

Can someone give me a good account of all the steps from taking a JDK binary into a fully-installed Java system, so that I may run tools such as java or javac?

Thanks!

Upvotes: 0

Views: 639

Answers (1)

Peter Lawrey
Peter Lawrey

Reputation: 533492

What I do is add a java.sh to the /etc/profile.d directory which add /opt/java/current/bin (Where my javac etc are) to the PATH

That's all I have every needed to do. Some applications like to have JAVA_HOME or JDK_HOME set as well.

EDIT: If you want to add a java.sh file it looks like

export PATH=%PATH%;/opt/java/current/bin

The reason I use java.sh is it is a drop in file, you don't have to alter any existing file and you can copy it from one system to another/one version of Unix to another.

Upvotes: 1

Related Questions