forked from dr-cs/intro-oop-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-java.html
More file actions
115 lines (113 loc) · 7.21 KB
/
install-java.html
File metadata and controls
115 lines (113 loc) · 7.21 KB
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
---
layout: default
title: CS 1331 - Installing Java
---
<h1 class="title">Installing The JDK</h1>
<h2 class="subtitle" id="originally-by-ashutosh-gupta">Originally by Ashutosh Gupta</h2>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#windows-7" id="id1">Windows 7</a></li>
<li><a class="reference internal" href="#mac-os-x" id="id2">Mac OS X</a></li>
<li><a class="reference internal" href="#linux" id="id3">Linux</a></li>
<li><a class="reference internal" href="#troubleshooting" id="id4">Troubleshooting</a></li>
</ul>
</div>
<div class="section" id="windows-7">
<h1><a class="toc-backref" href="#id1">Windows 7</a></h1>
<ol class="arabic">
<li><p class="first">Download and run the appropriate Java Development Kit installer from <a class="reference external" href="http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html#javasejdk">http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html#javasejdk</a></p>
<ul>
<li><p class="first">To determine if your machine is running 32- or 64-bit,</p>
<ul>
<li><p class="first">Go to Start</p>
</li>
<li><p class="first">Right-click on "Computer"</p>
</li>
<li><p class="first">Choose "Properties"</p>
<blockquote>
<p>Under System Type, you should see either "32-bit Operating System" or "64-bit Operating System".</p>
</blockquote>
</li>
</ul>
</li>
</ul>
</li>
</ol>
<img alt="win32-64.jpg" class="align-center" src="images/win32-64.jpg" style="width: 480px;"/>
<ol class="arabic" start="2">
<li><p class="first">Update your system PATH variable:</p>
<ul class="simple">
<li>Go to Start</li>
<li>Choose "Control Panel"</li>
<li>In the search bar at the top right, type "Path" and press enter</li>
<li>Choose "Edit the system environment variables"</li>
<li>Click "Environment Variables"</li>
<li>In the "System variables" section, scroll to "Path"</li>
<li>Select the Path variable and click "Edit"</li>
<li>Under "Variable value", add <tt class="docutils literal"><span class="pre">;C:\Program</span> Files\Java\jdk1.8.0_20\bin</tt></li>
</ul>
<p>The system Path variable tells the operating system where to find the Java tools that you installed in step 1. If you did not install the tools in <tt class="docutils literal"><span class="pre">C:\Program</span> Files\Java\jdk1.8.0_20</tt>, change that portion of the path to the correct folder. Important: the path must have bin at the end.</p>
<p>It is important that there is a semicolon (;) separating the folder that you add from the previous folder. For example, if your Path variable looks like this initially:</p>
<pre class="code literal-block">
C:\Foo\bin;C:\Bar\bin
</pre>
<p>it should look like this after you add the new folder:</p>
<pre class="code literal-block">
C:\Foo\bin;C:\Bar\bin;C:\Program Files\Java\jdk1.8.0_20\bin
</pre>
<p>Press "OK" in all prompts until you are back to the Control Panel.</p>
</li>
<li><p class="first">Determine if Java was installed correctly at the command line ( the Windows <tt class="docutils literal">cmd.exe</tt> program):</p>
<ul class="simple">
<li>Press the Windows Key + R</li>
<li>Type "cmd"</li>
<li>Press enter</li>
<li>At the command prompt type <tt class="docutils literal">java <span class="pre">-version</span></tt>. You should get output on the next line like <tt class="docutils literal">java version "1.8.0_20</tt>.</li>
<li>At the command prompt type <tt class="docutils literal">javac <span class="pre">-version</span></tt>. You should get output like <tt class="docutils literal">javac 1.8.0_20</tt>.</li>
</ul>
</li>
</ol>
</div>
<div class="section" id="mac-os-x">
<h1><a class="toc-backref" href="#id2">Mac OS X</a></h1>
<ol class="arabic simple">
<li>Download and run the appropriate Java Development Kit installer DMG from <a class="reference external" href="http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html#javasejdk">http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html#javasejdk</a></li>
<li>Double-click on the <tt class="docutils literal">.dmg</tt> file you downloaded to mount it and open it in the Finder.</li>
<li>Double click on the installer <tt class="docutils literal">.pkg</tt> file to run the installer.</li>
<li>Check that the JDK has been properly installed.<ul>
<li>Run <tt class="docutils literal">/Applications/Utilities/Terminal.app</tt></li>
<li>At the command prompt type <tt class="docutils literal">java <span class="pre">-version</span></tt>. You should get output on the next line like <tt class="docutils literal">java version "1.8.0_20</tt>.</li>
<li>At the command prompt type <tt class="docutils literal">javac <span class="pre">-version</span></tt>. You should get output like <tt class="docutils literal">javac 1.8.0_20</tt>.</li>
</ul>
</li>
</ol>
</div>
<div class="section" id="linux">
<h1><a class="toc-backref" href="#id3">Linux</a></h1>
<ol class="arabic simple">
<li>Download and run the appropriate Java Development Kit installer from <a class="reference external" href="http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html#javasejdk">http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html#javasejdk</a></li>
</ol>
<p>OR</p>
<blockquote>
For Ubuntu and other debian based distribution, install openjdk using your default package manager</blockquote>
<p>OR</p>
<blockquote>
For Fedora-based and other distros that use the Redhat Package Manager format, download the correct "Linux RPM" architecture from Java Downloads</blockquote>
<ol class="arabic simple" start="2">
<li>Add the JDK's <tt class="docutils literal">bin</tt> directory to your <tt class="docutils literal">PATH</tt> environment variable, if necessary.</li>
<li>Check that the JDK has been properly installed.<ul>
<li>Open a terminal window.</li>
<li>At the command prompt type <tt class="docutils literal">java <span class="pre">-version</span></tt>. You should get output on the next line like <tt class="docutils literal">java version "1.8.0_20</tt>.</li>
<li>At the command prompt type <tt class="docutils literal">javac <span class="pre">-version</span></tt>. You should get output like <tt class="docutils literal">javac 1.8.0_20</tt>.</li>
</ul>
</li>
</ol>
</div>
<div class="section" id="troubleshooting">
<h1><a class="toc-backref" href="#id4">Troubleshooting</a></h1>
<blockquote>
<p>If neither the <tt class="docutils literal">java</tt> nor <tt class="docutils literal">javac</tt> commands work, first try closing the command window and opening a new one so that the command shell reads the PATH environment variable you just updated. If that does not work, double check that the folder you added to the Path variable contains executable files like <tt class="docutils literal">java</tt> and <tt class="docutils literal">javac</tt> on Unix, or <tt class="docutils literal">java.exe</tt> and <tt class="docutils literal">javac.exe</tt> on Windows.</p>
<p>If <tt class="docutils literal">java</tt> works but <tt class="docutils literal">javac</tt> does not, you probably installed a JRE (Java Runtime Environment), not a JDK. Return to Step 1 and start over.</p>
</blockquote>
</div>