<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>geeky updates &#187; java</title>
	<atom:link href="http://sergeyvlasov.com/tag/java/feed" rel="self" type="application/rss+xml" />
	<link>http://sergeyvlasov.com</link>
	<description>spontaneous posts about computers, internet and the life</description>
	<lastBuildDate>Sat, 13 Feb 2010 22:54:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to install Sun JDK on Ubuntu</title>
		<link>http://sergeyvlasov.com/how-to-install-sun-jdk-on-ubuntu</link>
		<comments>http://sergeyvlasov.com/how-to-install-sun-jdk-on-ubuntu#comments</comments>
		<pubDate>Sat, 01 Nov 2008 12:36:38 +0000</pubDate>
		<dc:creator>sergey</dc:creator>
				<category><![CDATA[Setups]]></category>
		<category><![CDATA[en]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[setup]]></category>

		<guid isPermaLink="false">http://sergeyvlasov.com/?p=330</guid>
		<description><![CDATA[sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk sudo update-java-alternatives -s java-6-sun You also need to edit a file called /etc/jvm. This file defines the default system JVM search order. Each JVM should list their JAVA_HOME compatible directory in this file. The default system JVM is the first one available from top to bottom. Open /etc/jvm $ [...]]]></description>
			<content:encoded><![CDATA[<p><code lang="bash">sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk</code></p>
<p><code lang="bash">sudo update-java-alternatives -s java-6-sun</code></p>
<p>You also need to edit a file called /etc/jvm. This file defines the default system JVM search order. Each JVM should list their JAVA_HOME compatible directory in this file. The default system JVM is the first one available from top to bottom. Open /etc/jvm <code>$ sudo vi /etc/jvm</code><br />
Make sure /usr/lib/jvm/java-6-sun is added to the top of JVM list <code>/usr/lib/jvm/java-6-sun</code><br />
At the end your file should read as follows:</p>
<p><code lang="bash">/usr/lib/jvm/java-6-sun<br />
/usr/lib/jvm/java-gcj<br />
/usr/lib/jvm/ia32-java-1.5.0-sun<br />
/usr/lib/jvm/java-1.5.0-sun<br />
/usr</code></p>
<p>Save and close the file.</p>
<h2>Setup the environment variable</h2>
<p>You also need to setup JAVA_HOME and PATH variable. Open your $HOME/.bash_profile or /etc/profile (system wide) configuration. Open your .bash_profile file: <code>$ vi $HOME/.bash_profile</code><br />
Append following line: <code>export JAVA_HOME=/usr/lib/jvm/java-6-sun<br />
 export PATH=$PATH:$JAVA_HOME/bin</code><br />
Save and close the file.</p>
<h2>Test your new JDK</h2>
<p>Type the following command to display version: <code>$ java -version</code><br />
Output:</p>
<pre>java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)</pre>
<h3>Try HelloWorld.java &#8211; first java program</h3>
<p><code>$ vi HelloWorld.java</code><br />
Append code:</p>
<pre class="java"><span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">class</span> HelloWorld <span style="color: #66cc66;">{</span>
    <span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">static</span> <span style="color: #993333;">void</span> main<span style="color: #66cc66;">(</span><a href="http://www.google.com/search?hl=en&#038;q=allinurl%3AString+java.sun.com&#038;btnI=I%27m%20Feeling%20Lucky"><span style="font-weight: bold; color: #aaaadd;">String</span></a><span style="color: #66cc66;">[</span><span style="color: #66cc66;">]</span> args<span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span>
        <a href="http://www.google.com/search?hl=en&#038;q=allinurl%3ASystem+java.sun.com&#038;btnI=I%27m%20Feeling%20Lucky"><span style="font-weight: bold; color: #aaaadd;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">"Hello, World!"</span><span style="color: #66cc66;">)</span>;
    <span style="color: #66cc66;">}</span>
<span style="color: #66cc66;">}</span></pre>
<p>Save and close the file. Compile HelloWorld.java and execute program by typing following two instructions: <code>$ javac HelloWorld.java<br />
 $ java  HelloWorld<br />
 </code><br />
Output:</p>
<pre>Hello, World!</pre>
<script type="text/javascript" class="owbutton" src="http://www.onlywire.com/button" title="How to install Sun JDK on Ubuntu" url="http://sergeyvlasov.com/?p=330"></script>]]></content:encoded>
			<wfw:commentRss>http://sergeyvlasov.com/how-to-install-sun-jdk-on-ubuntu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
