Skip to main content

How to set JAVA_HOME environment variable in Ubuntu

Setting the JAVA_HOME variable can be done in several ways.

1. Globally and at System level, i.e. no user is required to be logged in. This is the preferred way if you are configuring a server and planning to use boot strapped program that needs JAVA_HOME variable.

2. Globally and set for all logged in user, i.e. one user is needed to be logged in, to have the JAVA_HOME variable set.

3. User specific. Then the variable is only set when the designated user is logged in.


First open a Terminal (Applications → Accessories → Terminal), then enter:

sudo gedit /etc/environment

Append to the end of the file:
JAVA_HOME=/usr/lib/jvm/java-7-oracle

Check with this echo command.

echo $JAVA_HOME

Comments

Popular posts from this blog

JavaMelody: Monitoring the Performance of Tomcat Application Server

Javamelody is an opensource (LGPL) application to monitor Java or Java EE application servers in QA and production environments. JavaMelody is mainly based on statistics of requests and on evolution charts. (Extract from the Javamelody home page) It allows to improve applications in QA and production Give facts about the average response times and number of executions Make decisions when trends are bad, before problems become too serious Optimize based on the more limiting response times Find the root causes of response times Verify the real improvement after optimization It includes summary charts showing the evolution over time of the following indicators: Number of executions, mean execution times and percentage of errors of http requests, sql requests, jsp pages or methods of business façades (if EJB3, Spring or Guice) Java memory Java CPU Number of user sessions Number of jdbc connections These charts can be viewed on the current day, week, month, year or cu...

Tomcat Clustering : Session Replication with Backup Manager

Prerequisite Blogs: How To Install Apache Tomcat Multiple Tomcat Instances on Single Machine Tomcat Clustering: Loadbalancing with mod_jk and Apache Tomcat Clustering : Session Affinity    Backup Manager Backup manager usually used clustered environment. Its like delta manger. But it will  replicate to exactly one other instance(backup instance). Its act  like one instance is Primary  and another instance as backup. Steps to make Session Replication in Tomcat Clustering I am continue from exactly where I left in last session affinity post . So check that post and make sure jumRoute all are set properly. Steps are Enable Multicast routing Add <Cluster> Entries in conf/server.xml file for all instances. Enable the Web Application as distributable Step1:  Enable Multicast routing In Linux Environment most of the system kernel is capable to process the multicast address. We need to add...

Integrating code coverage tool JaCoCo in your play 2.1.x project

I've been looking into code coverage for Play 2.1.x and found that the only good option is Jacoco. Its always good to have a fine test coverage in any project. I am working on Play framework & this time i’ve tried to integrate the JaCoCo with my play java project & it’s cool to have it in my project. There are few easy steps to integrate the JaCoCo in Play project. 1. Add the following lines of code in your plugin.sbt file. You’ve to add the plugin dependency to your project’s plugins.sbt. libraryDependencies ++= Seq(   "org.jacoco" % "org.jacoco.core" % "0.5.9.201207300726" artifacts(Artifact("org.jacoco.core", "jar", "jar")),   "org.jacoco" % "org.jacoco.report" % "0.5.9.201207300726" artifacts(Artifact("org.jacoco.report", "jar", "jar"))) addSbtPlugin("de.johoop" % "jacoco4sbt" % "1.2.4") 2. Have...