Skip to content

Commit 37721c4

Browse files
authored
Revamp installation and test instructions (#136)
- Ensure only installation instructions are in INSTALLATION.md and only instructions for running tests are in TESTS.md. - Remove install instructions for IDEs: - IDEs start to pay dividends when your codebase gets large enough that the refactoring and code navigation features start to seriously increase your efficiency; Exercism programs are, by design, toy-sized; - There are far fewer instructions to getting started when doing it from the command-line (and therefore less likely to get wrong). - Focus on using package managers: - these tools provide the right kind of "magic" — you really don't need to know the installation details to start programming; - they automatically perform steps that can be hard to describe and do right (less likely to get wrong).
1 parent 84ebdae commit 37721c4

File tree

3 files changed

+240
-203
lines changed

3 files changed

+240
-203
lines changed

docs/INSTALLATION.md

Lines changed: 164 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,228 +1,246 @@
1-
## Windows
1+
# Installing Java
22

3-
If you are new-ish to programming in Java, these instructions are for you. This is a step-by-step opinionated guide to getting from zero to submitting your first exercise.
3+
In addition to the exercism CLI and your favorite text editor, practicing with Exercism exercises in Java requires:
44

5+
* the **Java Development Kit** (JDK) — which includes both a Java Runtime *and* development tools (most notably, the Java compiler); and
6+
* **Gradle** — a build tool specifically for Java projects.
57

6-
### Install Java Development Kit 1.8
8+
Choose your operating system:
79

10+
* [Windows](#windows)
11+
* [Mac OS X](#mac-os-x)
12+
* [Linux](#linux)
813

9-
First determine if you have Java installed already.
14+
... or ...
15+
* if you prefer to not use a package maanger, you can [install manually](#install-manually).
1016

11-
In a Command Prompt window (Start -> Command Prompt)...
17+
Optionally, you can also use a [Java IDE](#java-ides).
1218

13-
```
14-
C:\Users\johndoe> java -version
15-
```
19+
----
1620

17-
if you see:
21+
# Windows
1822

19-
```
20-
'java' is not recognized as an internal or external command,
21-
operable program or batch file.
22-
```
23+
Open an administrative command prompt. (If you need assistance opening an administrative prompt, see [open an elevated prompt in Windows 8+](http://www.howtogeek.com/194041/how-to-open-the-command-prompt-as-administrator-in-windows-8.1/) (or [Windows 7](http://www.howtogeek.com/howto/windows-vista/run-a-command-as-administrator-from-the-windows-vista-run-box/)).
2324

24-
You'll need to install the JDK — it contains both a Java Runtime and development tools.
25+
1. If you have not installed Chocolatey, do so now:
2526

26-
1. Go to [Oracle OTN](http://www.oracle.com/technetwork/java/javase/downloads/index.html) and download the latest version of the JDK (at the time of writing, [JDK 8u45](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html))
27-
2. Run the installer, using all the defaults.
27+
```batchfile
28+
C:\Windows\system32> @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
29+
```
30+
- Install the JDK:
2831

29-
Verify that the install worked.
32+
```batchfile
33+
C:\Windows\system32> choco install jdk8
34+
...
35+
C:\Windows\system32> refreshenv
36+
...
37+
```
38+
- Install Gradle:
3039

31-
Close any open Command Prompt windows and in a *new* Command Prompt window...
40+
```batchfile
41+
C:\Windows\system32>choco install gradle
42+
...
43+
```
3244

33-
```
34-
C:\Users\johndoe> java -version
35-
```
45+
We recommend closing the administrative command prompt and opening a new command prompt -- you do not require administrator priviledges to practice Exercism exercises.
3646

37-
You should see something like this:
47+
You now are ready to get started with the Java track of Exercism!
3848

39-
```
40-
java version "1.8.0_45"
41-
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
42-
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
43-
```
49+
To get started, see "[Running the Tests](http://exercism.io/languages/java/tests)".
4450

45-
The exact version number is not important, just that version 1.8 or better is installed. Circa 2004, Sun Microsystem, in their inifinite wisdom, decided that it would be "better" to have dual numbering conventions. Java 1.8 == Java 8.0.
51+
----
4652

47-
### Install IntelliJ IDEA Community Edition
53+
# Mac OS X
4854

49-
Download, install and configure IntelliJ with the JDK you have installed:
55+
Below are instructions for install using the most common method - using Homebrew. If you'd rather, you can also [install on OS X without Homebrew](#installing-on-mac-os-x-without-homebrew).
5056

51-
1. Download [IntelliJ IDEA Community Edition](https://www.jetbrains.com/idea/download/) and run the installer; accept all the defaults.
57+
## Installing
5258

53-
2. Run IntelliJ (Start -> All Programs -> JetBrains -> IntelliJ IDEA Community Edition).
54-
* The first time you do, IntelliJ walks you through some initial setup. We recommend selecting a UI Theme and then just clicking "Skip All and Set Defaults".
59+
1. If you haven't installed [Homebrew](http://brew.sh), yet, do so now:
5560

56-
3. In the "Welcome to IntelliJ IDEA" window, open the "Configure" pull-down and select "Project Defaults", then "Project Structure".
61+
```sh
62+
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
63+
```
64+
- Tap the [Homebrew Cask](https://caskroom.github.io/) — this allows us to install pre-built binaries like the JDK.
5765

58-
3. In the "Default Project Structure" dialog, find the "Project SDK:" section in the right panel. Click the "New..." button and select "JDK".
66+
```
67+
$ brew tap caskroom/cask
68+
```
69+
- Install the JDK:
5970

60-
4. In the "Select Home Directory for JDK" file open dialog, navigate to "`C:\Program Files\Java\jdk1.8...`". Be sure to select the JDK, not the JRE. Click "OK".
71+
```
72+
$ brew cask install java
73+
```
74+
- Install Gradle:
6175

62-
5. Back in the "Default Project Structure" dialog, in the "Project language level:" section, select "8 - Lambdas, type annotations etc.". Click "OK".
76+
```
77+
$ brew install gradle
78+
```
6379

64-
## Mac OS X
80+
You now are ready to get started with the Java track of Exercism!
6581

66-
If you are new-ish to programming in Java on Mac OS X, these instructions are for you.
67-
This is a step-by-step opinionated guide to getting from zero to submitting your first exercise.
82+
To get started, see "[Running the Tests](http://exercism.io/languages/java/tests)".
6883

69-
### Step 1 — Install Java Development Kit 1.8
84+
----
7085

71-
First, determine if the JDK 1.8 is installed:
86+
# Linux
7287

73-
```bash
74-
$ java -version
75-
```
88+
Below are instructions for install using the package manager of your distro. If you'd rather, you can also [install on Linux without a package manager](#installing-on-linux-without-a-package-manager).
7689

77-
What you do next depends on the output of that command.
90+
* [Debian](#debian)
91+
* [Fedora](#fedora)
7892

79-
#### No JDKs Installed
93+
## Debian
8094

81-
If you have no JDKs installed at all (e.g. you have a fresh install of Mac OS X 10.10 [Yosemite]),
82-
the OS presents a dialog:
95+
If you are using Debian or its derivatives (like Ubuntu or Linux Mint), use APT:
8396

84-
![To use the "java," command-line tool you need to install a JDK. Click "More Info..." to visit the Java Developer Kit download website.](http://x.exercism.io/v3/tracks/java/docs/img/mac-osx--install-java-dialog.png)
97+
*(verified on: Linux Mint 18, Ubuntu 14)*
8598

86-
Clicking on the "More Info..." button takes you to the [Oracle OTN](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
99+
1. Install the JDK:
87100

88-
Download the latest version of the JDK (at the time of writing,
89-
[JDK 8u71](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html))
90-
and run the installer, using all the defaults.
101+
```sh
102+
$ sudo apt-get update
103+
$ sudo apt-get install python-software-properties
104+
$ sudo add-apt-repository ppa:webupd8team/java
105+
$ sudo apt-get update
106+
$ sudo apt-get install oracle-java8-installer
107+
```
108+
- Install Gradle:
91109

92-
Skip down to [Verify JDK Install](#verify-jdk-install)
110+
```sh
111+
$ sudo apt-get install gradle
112+
```
93113

94-
#### Older JDKs Installed
114+
You now are ready to get started with the Java track of Exercism!
95115

96-
If you see something like...
116+
To get started, see "[Running the Tests](http://exercism.io/languages/java/tests)".
97117

98-
```bash
99-
java version "1.6.0_65"
100-
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
101-
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
102-
```
118+
----
103119

104-
Or any version that is prior to 1.8, you need to install the 1.8 JDK...
120+
## Fedora
105121

106-
1. Go to [Oracle OTN](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
107-
and download the latest version of the JDK (at the time of writing,
108-
[JDK 8u71](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html))
109-
2. Run the installer, using all the defaults.
122+
If you are using Fedora or its derivatives, use DNF:
110123

111-
#### Verify JDK Install
124+
*(verified on: Fedora 24)*
112125

113-
Let's verify that the installation worked...
126+
1. Install the JDK:
114127

115-
```bash
116-
$ java -version
117-
```
128+
```sh
129+
$ sudo dnf install java-1.8.0-openjdk-devel
130+
```
131+
- Install Gradle:
118132

119-
You should see something like this:
133+
```sh
134+
$ sudo dnf install gradle
135+
```
120136

121-
```bash
122-
java version "1.8.0_45"
123-
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
124-
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
125-
```
126137

127-
The exact version number is not important, just that version 1.8 or better is installed.
128-
Circa 2004, Sun Microsystem, in their inifinite wisdom, decided that it would be "better" to
129-
have dual numbering conventions. Java 1.8 == Java 8.0.
138+
You now are ready to get started with the Java track of Exercism!
130139

131-
Congratulations, you've ensured you have the proper version of Java, itself, installed!
140+
To get started, see "[Running the Tests](http://exercism.io/languages/java/tests)".
132141

133-
### Step 2 — Install IntelliJ IDEA Community Edition
142+
----
134143

135-
Download, install and configure IntelliJ with the JDK you have installed:
144+
# Install Manually
136145

137-
1. Download [IntelliJ IDEA Community Edition](https://www.jetbrains.com/idea/download/) and
138-
run the installer; accept all the defaults.
146+
* [Installing on Windows manually](#installing-on-windows-manually)
147+
* [Installing on Mac OS X without Homebrew](#installing-on-mac-os-x-without-homebrew)
148+
* [Installing on Linux without a package manager](#installing-on-linux-without-a-package-manager)
139149

140-
2. Run IntelliJ (`/Applications/IntelliJ IDEA 14 CE.app`)
141-
* The first time you do, IntelliJ walks you through some initial setup. We recommend
142-
selecting a UI Theme and then just clicking "Skip All and Set Defaults".
150+
----
143151

144-
3. In the "Welcome to IntelliJ IDEA" window, open the "Configure" pull-down and select
145-
"Project Defaults", then "Project Structure".
152+
## Installing on Windows manually
146153

147-
6. In the "Default Project Structure" dialog, find the "Project SDK:" section in the right panel.
148-
Click the "New..." button and select "JDK".
154+
*NOTE: these instructions are intended for experienced Windows users. If you don't already know how to set environment variables or feel comfortable managing the directory structure, we highly recommend you use the Chocolatey-based install, [above](#windows).*
149155

150-
5. In the "Select Home Directory for JDK" file open dialog, navigate to
151-
`/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home`. Click "OK".
156+
1. Install the JDK:
157+
1. Download "**Java Platform (JDK)**" from [Oracle OTN](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
158+
- Run the installer, using all the defaults.
159+
- Install Gradle:
160+
- Download "**Binary only distribution**" from the [Gradle download page](https://gradle.org/gradle-download/).
161+
- Unzip the archive. We recommend a place like `C:\Users\JohnDoe\Tools`.
162+
- Add a new system environment variable named `GRADLE_HOME` and set it to the path you just created (e.g. `C:\Users\JohnDoe\Tools\gradle-x.y`).
163+
- Update the system `Path` to include the `bin` directory from Gradle's home (e.g. `Path`=`...;%GRADLE_HOME%\bin`).
152164

153-
6. Back in the "Default Project Structure" dialog, in the "Project language level:" section,
154-
select "8 - Lambdas, type annotations etc.". Click "OK".
155165

156-
## How work with Exercism using Eclipse
166+
You now are ready to get started with the Java track of Exercism!
157167

158-
This section is about Eclipse, and it is assumed that you already have
159-
Java development kit for your computing environment installed. If that
160-
is not the case, see the instructions above.
168+
To get started, see "[Running the Tests](http://exercism.io/languages/java/tests)".
161169

162-
Additionally, this is not a guide about how to use Eclipse. Please, consult
163-
your favorite search engine for that because there are plenty of tutorials
164-
already available.
170+
----
165171

166-
Once you've got Eclipse installed and running, there are at least two ways
167-
to get exercism tasks into Eclipse: letting gradle build Eclipse workspace
168-
for you and using Buildship Gradle plugin for Eclipse.
172+
## Installing on Mac OS X without Homebrew
169173

170-
Firstly, a simpler way of doing things.
174+
*NOTE: these instructions are intended for experienced Mac OS X users. Unless you specifically do not want to use a package manager, we highly recommend using the Homebrew-based installation instructions, [above](#mac-os-x).*
171175

172-
1. Fetch an exercise: `exercism fetch java <exercise>`
173-
(see [the list of available exercises](http://exercism.io/languages/java)).
176+
1. Install the JDK:
177+
1. Download "**Java Platform (JDK)**" from [Oracle OTN](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
178+
- Run the installer, using all the defaults.
179+
- Install Gradle:
180+
- Download "**Binary only distribution**" from the [Gradle download page](https://gradle.org/gradle-download/).
181+
- Unpack Gradle:
174182

175-
2. Change to the directory containing the exercise: `cd ~/exercism/java/
176-
<exercise>` (by default things will end up in `~/exercism`).
183+
```sh
184+
$ mkdir ~/tools
185+
$ cd ~/tools
186+
$ unzip ~/Downloads/gradle-*-bin.zip
187+
$ cd gradle*
188+
```
189+
- Configure Gradle and add it to the path:
177190

178-
3. Let Gradle prepare things for Eclipse: `gradle eclipse`.
191+
```sh
192+
$ cat << DONE >> ~/.bashrc
193+
export GRADLE_HOME=`pwd`
194+
export PATH=\$PATH:\$GRADLE_HOME/bin
195+
DONE
196+
```
179197
180-
4. Start Eclipse.
181198
182-
5. From the "File" menu select "Import".
199+
You now are ready to get started with the Java track of Exercism!
183200
184-
6. Select "Existing Projects Into Workspace" as import source.
201+
To get started, see "[Running the Tests](http://exercism.io/languages/java/tests)".
185202
186-
7. Browse the directory containing the exercise fetched during the
187-
step 1 to a text field labeled "Select root directory".
203+
----
188204
189-
8. Hit the button labeled "Finish".
205+
## Installing on Linux without a package manager
190206
191-
Secondly, a slightly more complex and more "Eclipseish" way. This is
192-
for those who absolutely despise doing anything away from Eclipse.
207+
*NOTE: these instructions are intended for experienced Linux users. Unless you specifically do not want to use a package manager, we highly recommend using the the installation instructions, [above](#linux).*
193208
194-
1. Install the Buildship Gradle Integration plugin from Eclipse
195-
Marketplace (accessible from Help-menu, under Eclipse Marketplace).
209+
1. Install the JDK:
210+
1. Download "**Java Platform (JDK)**" from [Oracle OTN](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
211+
- Run the installer, using all the defaults.
212+
- Install Gradle:
213+
- Download "**Binary only distribution**" from the [Gradle download page](https://gradle.org/gradle-download/).
214+
- Unpack Gradle:
196215
197-
![Eclipse Help Menu](/docs/img/eclipse-help-dropdown.png)
216+
```sh
217+
$ mkdir ~/tools
218+
$ cd ~/tools
219+
$ unzip ~/Downloads/gradle-*-bin.zip
220+
$ cd gradle*
221+
```
222+
- Configure Gradle and add it to the path:
198223
199-
To find the Buildship Gradle Plugin, search for "Buildship Gradle".
224+
```sh
225+
$ cat << DONE >> ~/.bashrc
226+
export GRADLE_HOME=`pwd`
227+
export PATH=\$PATH:\$GRADLE_HOME/bin
228+
DONE
229+
```
200230
201-
![Buildship Gradle Plugin](/docs/img/eclipse-mp-search-buildship-gradle.png)
231+
You now are ready to get started with the Java track of Exercism!
202232
203-
In case you've been reading about the Gradle STS plugin, note that
204-
the Buildship Gradle Integration plugin replaces the Gradle STS plugin
205-
which is no longer maintained.
233+
To get started, see "[Running the Tests](http://exercism.io/languages/java/tests)".
206234
207-
Start (or restart) Eclipse after the plugin has been installed.
235+
----
208236
209-
2. Fetch an exercise: `exercism fetch java <exercise>`
210-
(see [the list of available exercises](http://exercism.io/languages/java)).
237+
# Java IDEs
211238
212-
3. From the "File" menu select "Import".
239+
There are many Java IDEs available. The three most popular are:
213240
214-
5. Select "Gradle" > "Gradle Project" as your import source.
241+
* [IntelliJ IDEA](https://www.jetbrains.com/idea/download/) (download the "Community" edition)
242+
- [Eclipse](https://www.eclipse.org/downloads/)
243+
- [NetBeans](https://netbeans.org/downloads/) (download the "Java SE" bundle)
215244
216-
6. Browse to the directory containing the exercise fetched during
217-
the step 1 to a text field labeled "Project root directory".
218-
219-
7. Hit the button labeled "Finish".
220-
221-
It seems that the simple way of doing things is, as usual, the better
222-
way of doing things. The only caveat is that you have to run `gradle eclipse`
223-
every time you change something affecting Eclipse.
224-
225-
For most exercises there is no need to ever touch build.gradle or anything
226-
else besides the source files; so, there is no need to constantly run
227-
`gradle eclipse`.
245+
and there are [others](https://en.wikibooks.org/wiki/Java_Programming/Java_IDEs).
228246

0 commit comments

Comments
 (0)