|
1 | 1 | # Installing Java
|
2 | 2 |
|
3 |
| -In addition to the exercism CLI and your favorite text editor, practicing with Exercism exercises in Java requires: |
| 3 | +In addition to the Exercism CLI and your favorite text editor, |
| 4 | +practicing with Exercism exercises in Java requires the **Java Development Kit** (JDK). |
| 5 | +The JDK includes both a Java Runtime _and_ development tools (most notably, the Java compiler). |
4 | 6 |
|
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. |
| 7 | +There are many flavors of the JDK nowadays, some of which are open-source. |
| 8 | +Here at Exercism we recommend using [Eclipse Temurin by Adoptium][adoptium]. |
7 | 9 |
|
8 |
| -Choose your operating system: |
| 10 | +## Supported Java versions |
9 | 11 |
|
10 |
| -- [Windows](#windows) |
11 |
| -- [macOS](#macos) |
12 |
| -- [Linux](#linux) |
| 12 | +Exercism's Java track supports Java 21 LTS and earlier. |
13 | 13 |
|
14 |
| -... or ... |
| 14 | +## Installing Eclipse Temurin |
15 | 15 |
|
16 |
| -- if you prefer to not use a package manager, you can [install manually](#install-manually). |
| 16 | +To install Eclipse Temurin on your system, head on over to their excellent [installation instructions][adoptium-installation-guide]. |
| 17 | +Here you will find instructions on how to install the JDK using your favorite package manager, |
| 18 | +and it also contains links to downloadable installers for all major operating systems. |
17 | 19 |
|
18 |
| -Optionally, you can also use a [Java IDE](#java-ides). |
19 |
| - |
20 |
| -## Windows |
21 |
| - |
22 |
| -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/))). |
23 |
| - |
24 |
| -1. If you have not installed Chocolatey, do so now: |
25 |
| - |
26 |
| - ```batchfile |
27 |
| - 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 |
28 |
| - ``` |
29 |
| - |
30 |
| -2. Install the JDK: |
31 |
| - |
32 |
| - ```batchfile |
33 |
| - C:\Windows\system32> choco install temurin21 |
34 |
| - ... |
35 |
| - C:\Windows\system32> refreshenv |
36 |
| - ... |
37 |
| - ``` |
38 |
| - |
39 |
| -3. Install Gradle: |
40 |
| - |
41 |
| - ```batchfile |
42 |
| - C:\Windows\system32>choco install gradle |
43 |
| - ... |
44 |
| - ``` |
45 |
| - |
46 |
| -We recommend closing the administrative command prompt and opening a new command prompt. |
47 |
| -You do not require administrator privileges to practice Exercism exercises. |
48 |
| - |
49 |
| -You now are ready to get started with the Java track of Exercism! |
50 |
| - |
51 |
| -To get started, see "[Running the Tests](https://exercism.org/docs/tracks/java/tests)". |
52 |
| - |
53 |
| -## macOS |
54 |
| - |
55 |
| -Below are instructions for install using the most common method - using Homebrew. |
56 |
| -If you'd rather, you can also [install on macOS without Homebrew](#installing-on-macos-without-homebrew). |
57 |
| - |
58 |
| -## Installing |
59 |
| - |
60 |
| -1. If you haven't installed [Homebrew](http://brew.sh), yet, do so now: |
61 |
| - |
62 |
| - ```sh |
63 |
| - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
64 |
| - ``` |
65 |
| - |
66 |
| -2. Tap the [Homebrew Cask](https://github.com/Homebrew/homebrew-cask-versions) — this allows us to install a specific JDK version. |
67 |
| - |
68 |
| - ```sh |
69 |
| - brew tap homebrew/cask-versions |
70 |
| - ``` |
71 |
| - |
72 |
| -3. Install the JDK: |
73 |
| - |
74 |
| - ```sh |
75 |
| - brew install --cask temurin21 |
76 |
| - ``` |
77 |
| - |
78 |
| -4. Install Gradle: |
79 |
| - |
80 |
| - ```sh |
81 |
| - brew install gradle |
82 |
| - ``` |
83 |
| - |
84 |
| -You now are ready to get started with the Java track of Exercism! |
85 |
| - |
86 |
| -To get started, see "[Running the Tests](https://exercism.org/docs/tracks/java/tests)". |
87 |
| - |
88 |
| -## Linux |
89 |
| - |
90 |
| -Below are instructions for install using the package manager of your distro. |
91 |
| -If you'd rather, you can also [install on Linux without a package manager](#installing-on-linux-without-a-package-manager). |
92 |
| - |
93 |
| -- [Debian](#debian) |
94 |
| -- [Other Linux distributions](#other-linux-distributions) |
95 |
| - |
96 |
| -### Debian |
97 |
| - |
98 |
| -If you are using Debian or its derivatives (like Ubuntu), use APT. |
99 |
| - |
100 |
| -~~~~exercism/note |
101 |
| -These steps have been verified on Ubuntu 20.04 and 22.04 |
102 |
| -~~~~ |
103 |
| - |
104 |
| -1. Install the JDK: |
105 |
| - |
106 |
| - ```sh |
107 |
| - sudo apt-get update |
108 |
| - sudo apt-get install software-properties-common |
109 |
| - sudo add-apt-repository ppa:openjdk-r/ppa |
110 |
| - sudo apt-get update |
111 |
| - sudo apt-get install openjdk-21-jdk |
112 |
| - ``` |
113 |
| - |
114 |
| -2. Install Gradle: |
115 |
| - |
116 |
| - ```sh |
117 |
| - sudo add-apt-repository ppa:cwchien/gradle |
118 |
| - sudo apt-get update |
119 |
| - sudo apt-get install gradle |
120 |
| - ``` |
121 |
| - |
122 |
| -You now are ready to get started with the Java track of Exercism! |
123 |
| - |
124 |
| -To get started, see "[Running the Tests](https://exercism.org/docs/tracks/java/tests)". |
125 |
| - |
126 |
| -### Other Linux distributions |
127 |
| - |
128 |
| -There are a lot of ways to install JDK 21, but one of the easiest ways is to use SDKMAN, which lets you install |
129 |
| -both OpenJDK 21 and the latest Gradle with ease. |
130 |
| - |
131 |
| -Use the following steps: |
132 |
| - |
133 |
| -1. Install SDKMAN: |
134 |
| - |
135 |
| - ```sh |
136 |
| - curl -s "https://get.sdkman.io" | bash |
137 |
| - ``` |
138 |
| - |
139 |
| - (if that doesn't work, take a look at the [installation instructions](https://sdkman.io/install)) |
140 |
| - |
141 |
| -2. Install OpenJDK 21: |
142 |
| - |
143 |
| - ```sh |
144 |
| - sdk install java 21.0.1-tem |
145 |
| - ``` |
146 |
| - |
147 |
| -3. Install Gradle: |
148 |
| - |
149 |
| - ```sh |
150 |
| - sdk install gradle |
151 |
| - ``` |
152 |
| - |
153 |
| -You now are ready to get started with the Java track of Exercism! |
154 |
| - |
155 |
| -To get started, see "[Running the Tests](https://exercism.org/docs/tracks/java/tests)". |
156 |
| - |
157 |
| -## Install Manually |
158 |
| - |
159 |
| -- [Installing on Windows manually](#installing-on-windows-manually) |
160 |
| -- [Installing on macOS without Homebrew](#installing-on-macos-without-homebrew) |
161 |
| -- [Installing on Linux without a package manager](#installing-on-linux-without-a-package-manager) |
162 |
| - |
163 |
| -### Installing on Windows manually |
164 |
| - |
165 |
| -~~~~exercism/note |
166 |
| -These instructions are intended for experienced Windows users. |
167 |
| -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). |
168 |
| -~~~~ |
169 |
| - |
170 |
| -1. Install the JDK: |
171 |
| - - Download "**OpenJDK 21 (LTS)**" from [Adoptium](https://adoptium.net/temurin/releases/?os=windows&arch=x64&package=jdk&version=21) (choose **".msi"**). |
172 |
| - - Run the installer, using all the defaults. |
173 |
| -2. Install Gradle: |
174 |
| - - Download "**Binary only distribution**" from the [Gradle download page](https://gradle.org/gradle-download/). |
175 |
| - - Unzip the archive. We recommend a place like `C:\Users\JohnDoe\Tools`. |
176 |
| - - 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`). |
177 |
| - - Update the system `Path` to include the `bin` directory from Gradle's home (e.g. `Path`=`...;%GRADLE_HOME%\bin`). |
178 |
| - |
179 |
| -You now are ready to get started with the Java track of Exercism! |
180 |
| - |
181 |
| -To get started, see "[Running the Tests](https://exercism.org/docs/tracks/java/tests)". |
182 |
| - |
183 |
| -### Installing on macOS without Homebrew |
184 |
| - |
185 |
| -~~~~exercism/note |
186 |
| -These instructions are intended for experienced macOS users. |
187 |
| -Unless you specifically do not want to use a package manager, we highly recommend using the Homebrew-based installation instructions, [above](#macos). |
188 |
| -~~~~ |
189 |
| - |
190 |
| -1. Install the JDK: |
191 |
| - - Download "**OpenJDK 21 (LTS)**" from [Adoptium](https://adoptium.net/temurin/releases/?os=mac&package=jdk&version=21) (choose **".pkg"**). |
192 |
| - - Run the installer, using all the defaults. |
193 |
| -2. Install Gradle: |
194 |
| - |
195 |
| - - Download "**Binary only distribution**" from the [Gradle download page](https://gradle.org/gradle-download/). |
196 |
| - - Unpack Gradle: |
197 |
| - |
198 |
| - ```sh |
199 |
| - mkdir ~/tools |
200 |
| - cd ~/tools |
201 |
| - unzip ~/Downloads/gradle-*-bin.zip |
202 |
| - cd gradle* |
203 |
| - ``` |
204 |
| - |
205 |
| - - Configure Gradle and add it to the path: |
206 |
| - |
207 |
| - ```sh |
208 |
| - cat << DONE >> ~/.bashrc |
209 |
| - export GRADLE_HOME=`pwd` |
210 |
| - export PATH=\$PATH:\$GRADLE_HOME/bin |
211 |
| - DONE |
212 |
| - ``` |
213 |
| -
|
214 |
| -You now are ready to get started with the Java track of Exercism! |
215 |
| -
|
216 |
| -To get started, see "[Running the Tests](https://exercism.org/docs/tracks/java/tests)". |
217 |
| -
|
218 |
| -### Installing on Linux without a package manager |
219 |
| -
|
220 |
| -```exercism/note |
221 |
| -These instructions are intended for experienced Linux users. |
222 |
| -Unless you specifically do not want to use a package manager, we highly recommend using the installation instructions, [above](#linux). |
223 |
| -``` |
224 |
| -
|
225 |
| -1. Install the JDK: |
226 |
| - - Choose your distribution and download "**OpenJDK 21 (LTS)**" from [Adoptium](https://adoptium.net/temurin/releases/?os=linux&package=jdk&version=21) (choose **".tar.gz"**). |
227 |
| - - Run the installer, using all the defaults. |
228 |
| -2. Install Gradle: |
229 |
| -
|
230 |
| - - Download "**Binary only distribution**" from the [Gradle download page](https://gradle.org/gradle-download/). |
231 |
| - - Unpack Gradle: |
| 20 | +## Java IDEs |
232 | 21 |
|
233 |
| - ```sh |
234 |
| - mkdir ~/tools |
235 |
| - cd ~/tools |
236 |
| - unzip ~/Downloads/gradle-*-bin.zip |
237 |
| - cd gradle* |
238 |
| - ``` |
| 22 | +There are many free IDEs available for Java. |
| 23 | +Here are some popular choices: |
239 | 24 |
|
240 |
| - - Configure Gradle and add it to the path: |
| 25 | +- [IntelliJ IDEA Community Edition][intellij-idea] |
| 26 | +- [Eclipse][eclipse] |
| 27 | +- [Visual Studio Code with the Java extension][vscode-java] |
241 | 28 |
|
242 |
| - ```sh |
243 |
| - cat << DONE >> ~/.bashrc |
244 |
| - export GRADLE_HOME=`pwd` |
245 |
| - export PATH=\$PATH:\$GRADLE_HOME/bin |
246 |
| - DONE |
247 |
| - ``` |
| 29 | +## Next steps |
248 | 30 |
|
249 | 31 | You now are ready to get started with the Java track of Exercism!
|
250 | 32 |
|
251 |
| -To get started, see "[Running the Tests](https://exercism.org/docs/tracks/java/tests)". |
252 |
| -
|
253 |
| -## Java IDEs |
254 |
| -
|
255 |
| -There are many Java IDEs available. The three most popular are: |
256 |
| -
|
257 |
| -- [IntelliJ IDEA](https://www.jetbrains.com/idea/download/) (download the "Community" edition) |
258 |
| -- [Eclipse](https://www.eclipse.org/downloads/) |
259 |
| -- [NetBeans](https://netbeans.org/downloads/) (download the "Java SE" bundle) |
| 33 | +To get started, see "[Running the Tests][exercism-java-tests-docs]". |
260 | 34 |
|
261 |
| -and there are [others](https://en.wikibooks.org/wiki/Java_Programming/Java_IDEs). |
| 35 | +[eclipse]: https://www.eclipse.org/downloads/ |
| 36 | +[exercism-java-tests-docs]: https://exercism.org/docs/tracks/java/tests |
| 37 | +[intellij-idea]: https://www.jetbrains.com/idea/download/ |
| 38 | +[adoptium]: https://adoptium.net |
| 39 | +[adoptium-installation-guide]: https://adoptium.net/en-GB/installation/ |
| 40 | +[vscode-java]: https://code.visualstudio.com/docs/languages/java |
0 commit comments