summaryrefslogtreecommitdiff
path: root/.html/java/install/centos.html
blob: 9bbf3f489346d5de3ab8198e6036e2a2b568f507 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE html>
<html>
<head>
	<title>
		The Codex » 
		Installing Java on CentOS
	</title>

	<link
		rel='stylesheet'
		type='text/css'
		href='http://fonts.googleapis.com/css?family=Buenard:400,700&amp;subset=latin,latin-ext'>
	<link
		rel="stylesheet"
		type="text/css"
		href="../../media/css/reset.css">
	<link
		rel="stylesheet"
		type="text/css"
		href="../../media/css/grimoire.css">
</head>
<body>

<div id="shell">
	
		<ol id="breadcrumbs">
			
				<li class="crumb-0 not-last">
					
						<a href="../../">index</a>
					
				</li>
			
				<li class="crumb-1 not-last">
					
						<a href="../">java</a>
					
				</li>
			
				<li class="crumb-2 not-last">
					
						<a href="./">install</a>
					
				</li>
			
				<li class="crumb-3 last">
					
						centos
					
				</li>
			
		</ol>
	

	
	<div id="article">
		<h1 id="installing-java-on-centos">Installing Java on CentOS</h1>
<p>Verified as of CentOS 5.8, Java 6. CentOS 6 users: fucking switch to Debian
already. Is something wrong with you? Do you like being abused by your
vendors?</p>
<h2 id="from-package-management-yum">From Package Management (Yum)</h2>
<p>OpenJDK is available via <a href="http://fedoraproject.org/wiki/EPEL/FAQ">EPEL</a>, from
the Fedora project. Install EPEL before proceeding.</p>
<p>You didn't install EPEL. Go install EPEL. <a href="http://fedoraproject.org/wiki/EPEL/FAQ#Using_EPEL">The directions are in the EPEL
FAQ</a>.</p>
<p>Now install the JDK:</p>
<pre><code>sudo yum install java-1.6.0-openjdk-devel
</code></pre>
<p>Or just the runtime:</p>
<pre><code>sudo yum install java-1.6.0-openjdk
</code></pre>
<p>The RPMs place the appropriate binaries in <code>/usr/bin</code>.</p>
<p>Applications that can't autodetect the JDK may need <code>JAVA_HOME</code> set to
<code>/usr/lib/jvm/java-openjdk</code>.</p>
<h2 id="by-hand">By Hand</h2>
<p>The <a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html">Java SE Development Kit
7</a>
tarballs can be installed by hand. Download the “Linux x64” <code>.tar.gz</code> version,
then unpack it in <code>/opt</code>:</p>
<pre><code>cd /opt
tar xzf ~/jdk-7u45-linux-x64.tar.gz
</code></pre>
<p>This will create a directory named <code>/opt/jdk1.7.0_45</code> (actual version number
may vary) containing a ready-to-use Java dev kit.</p>
<p>You will need to add the JDK's <code>bin</code> directory to <code>PATH</code> if you want commands
like <code>javac</code> and <code>java</code> to work without fully-qualifying the directory:</p>
<pre><code>cat &gt; /etc/profile.d/oracle_jdk &lt;&lt;'ORACLE_JDK'
PATH="${PATH}:/opt/jdk1.7.0_45/bin"
export PATH
ORACLE_JDK
</code></pre>
<p>(This will not affect non-interactive use; setting PATH for non-interactive
programs like build servers is beyond the scope of this document. Learn to use
your OS.)</p>
<p>Installation this way does <em>not</em> interact with the alternatives system (but
you can set that up by hand if you need to).</p>
<p>For tools that cannot autodetect the JDK via <code>PATH</code>, you may need to set
<code>JAVA_HOME</code> to <code>/opt/jdk1.7.0_45</code>.</p>
	</div>


	
<div id="comments">
<div id="disqus_thread"></div>
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'grimoire'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</div>


	
	<div id="footer">
		<p>
			
				The Codex —
			
			Powered by <a href="http://markdoc.org/">Markdoc</a>.
			
<a href="https://bitbucket.org/ojacobson/grimoire.ca/src/master/wiki/java/install/centos.md">See this page on Bitbucket</a> (<a href="https://bitbucket.org/ojacobson/grimoire.ca/history-node/master/wiki/java/install/centos.md">history</a>).

		</p>
	</div>
	
</div>
</body>
</html>