Installing Java on Linux Correctly

Carlosinfl

Loves the juice
Joined
Sep 25, 2002
Messages
6,633
I've got my CentOS 6.5 installation up and running & I would like to deploy OpenJDK 1.7.0 or Oracle JDK to the box correctly so that Java is available to all future users I add to the box. Normally I would create my user-base and then edit their ~/.bashrc to use JAVA_HOME and point it to $JAVA_HOME/bin/java but this is not practical if we would add several random users to the OS.

Can someone tell me how this is typically performed on production systems that require Java? I'm assuming there's some formality to this process that is recommended for RPM based Linux admins?

I can use yum to install OpenJDK 1.7.0 from the repository which will deploy the Java package in the correct directory and also eliminate any package dependency issues I'm likely to run into. So that is basically my projected install process on OpenJDK on my Linux system. The part I am really asking here for is guidance on how to correctly configure my Linux box to safely and correctly use Java from a system-wide level. I can see the Yum package manager will deploy Java in /usr/lib/jvm/ folder. My question is now for all users I create, how can I pass this into their environment? Is this something I need to edit /etc/profile for?
 
Users using the JRE don't usually need to have $JAVA_HOME set. Installing the JRE using the relevant package manager (in this case yum) will link 'java' in to $PATH correctly.

Production systems usually do not need the entire JDK (production systems don't compile).

Java developers can pull JDK tarballs from OpenJDK or Oracle directly and use them from user directories. The JDK doesn't need to be installed by an admin (you don't really have to 'install' it anyway). This also gives developers better control over what JDK they are compiling against while allowing the system to patch and update its version of java without interfering with the developer.


I'd recommend against installing the browser-plugin component of the JRE if possible (some distro's break it out as a separate package).
 
I am installing JBoss 7 AS on this server and the installation guide calls for JDK directly. I don't know anything about Java and would like to learn JBoss to some degree. So I understand what you mean about running JDK on a production server however I don't know if JRE is sufficient to just run JBoss or if in fact I do need to use the package manager to install OpenJDK and let it do it's thing in the background.
 
Jboss only needs a JRE installed in my experience, I've not evaluated Jboss 7 personally though.

A brief glance at the quick start guide only mentioned Java SE 6 as a requirement, I read that as JRE being sufficient.
 
Back
Top