summaryrefslogtreecommitdiff
path: root/www/java-setup.html
blob: 99ec942941b02326e19dcd416291abe26383725b (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
<!DOCTYPE html>
<html>
  <head>
    <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.6.0">
    <link rel='stylesheet' type='text/css' href='/index.css'>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title> Java Setup for Windows </title>
  </head>
  <body id="tutorial">
    <article>
      <h1> Installing Java </h1>
      <p> To install Java you need to install the Java Development Kit (JDK). It can be downloaded from here: <a href="https://jdk.java.net/13">https://jdk.java.net/13</a></p>
      <p>You will want to select the zip download for Windows.
        <br/>
        <span class='scaled-half'><img src="/imgs/java-setup/ScreenShot-JavaInstall-1.PNG"/></span>
        <br/><i>Hover to zoom</i>
      </p>
      <p>
      After downloading the zip you will want to unzip it (into a folder, should by default) and then copy that folder into <code class='inline'>C:\Program Files\Java\</code></p>
        <br/>
        <span class='scaled-half'><img src="/imgs/java-setup/ScreenShot-JavaInstall-2.PNG"/></span>
        <br/><i>Hover to zoom</i>
        <p>
        When I did this myself, it unzipped into a folder <code class="inline">jdk-13.0.1</code>. By the end you should have the following folder structure: <code class='inline'>C:\Program Files\Java\jdk-13.0.1</code>
      </p>
      <h2> Setting up your environment </h2>
      <p>
      In order to make the JDK discoverable by your programs you need to add the JDK folder to your PATH environment varible. This is best done by first setting up a varible for the java directory <code class='inline'>JAVA_HOME</code> that points directly to the directory you copied the unzipped files into.</p>
      <br/>
      <span class='scaled-half'><img src='/imgs/java-setup/ScreenShot-JavaInstall-3.PNG'/></span>
      <br/><i>Hover to zoom</i>
      <p>
      Once you've setup the <code class='inline'>JAVA_HOME</code> variable you can add that varible to your PATH point to the subdirectory <code class='inline'>/bin</code>. This can be confusing if you haven't done this before. <a href="https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho">Here is a StackOverflow article</a> how to add environments variables in Java 10.
      </p>
      <br/>
      <span class='scaled-half'><img src='/imgs/java-setup/ScreenShot-JavaInstall-4.PNG'/></span>
      <br/><i>Hover to zoom</i>
      <p> Optionally, if you want to test that this worked, you can open up the command prompt (or powershell) by opening the start menu and typing/looking for cmd.exe. Then you can type <code class='inline'>java -version</code> which will output the version and some additional information. You should see <code class='inline'>java version 13.0.1</code>.</p>
      <h1> IntelliJ Community Edition </h1>
      <p>I recommend using IntelliJ Community Edition instead of Eclipse. They're both open source but I use IntelliJ at my job daily and its a fantastic, out of the box editor. Where Eclipse requires a lot more setup steps and plugins to get it to be "complete". 
      Feature wise they do the same things, so everything they do in Udemy via Eclipse should work in IntelliJ. </p>
      <h2> Downloading </h2>
      <p> To Download go to <a href="https://www.jetbrains.com/idea/download/#section=windows">www.jetbrians.com/idea/download</a> and click the Exe download for community edition. </p>
      <br/>
      <span class="scaled-half"><img src='/imgs/java-setup/ScreenShot-JavaInstall-5.PNG' /></span>
      <br/> <i> Hover to zoom </i>
      <p> Once the download is complete you can run the installer. You should select your theme, then just use the "Install defaults" option at the bottom, or just Next through the rest of setup, as you shouldn't need any additional plugins. And if you do they all can be installed later </p>
      <p><b> You're Done! You can start Udemy now just ignoring their install/setup instructions. I have some additional steps below to help verify everything works and do some basic operatoins in IntelliJ (Create a Project, Create a class, Run/Debug) but you can refer back to here once you get there in Udemy </b></p>
      <h1> Using IntelliJ </h1>
      <p> Jetbrains actually has a whole <a href="https://www.jetbrains.com/help/idea/guided-tour-around-the-user-interface.html">FAQ/Tutorial section</a> that can help you with any questions too. But here is a brief overview of the core functions of IntelliJ</p>
      <h2> Creating a project </h2>
      <p> When you first open IntelliJ it shows a splash screen where you can open an existing project or create a new one. You will at first want to create a new project. </p>
      <br/>
      <span class='scaled-half'><img src='/imgs/java-setup/ScreenShot-JavaInstall-6.PNG' /></span>
      <br/><i>Hover to zoom</i>
      <p> You want to choose a java (the default) and select the version of the JDK (should default to 13.0.1, if not click browse and navigate to the folder you copied it to from the first step: <code class='inline'>C:\Program Files\Java\jdk-13.0.1</code>.
      </p>
      <br/>
      <span class='scaled-half'><img src='/imgs/java-setup/ScreenShot-JavaInstall-7.PNG'/></span>
      <br/><i>Hover to zoom</i>
      <p> Then you can name the project and choose the directory you want to files in. </p>
      <br/>
      <span class='scaled-half'><img src='/imgs/java-setup/ScreenShot-JavaInstall-8.PNG'/></span>
      <br/><i>Hover to zoom</i>
      <p>Now you should have a project setup that you can create your program in!</p>
      <br/>
      <span class='scaled-half'><img src='/imgs/java-setup/ScreenShot-JavaInstall-9.PNG'/></span>
      <br/><i>Hover to zoom</i>
      <h2> Creating a class </h2>
      <p> To create a class in IntelliJ you should expand the projects menu on th left side and right click the <code class='inline'>src</code> folder. You then select "create class". This will add it directly into your src folder.</p>
      <br/>
      <span class='scaled-half'><img src='/imgs/java-setup/ScreenShot-JavaInstall-10.PNG'/></span>
      <br/><i>Hover to zoom</i>
      <p> From here you can start writing code!</p>
      <br/>
      <span class='scaled-half'><img src='/imgs/java-setup/ScreenShot-JavaInstall-11.PNG'/></span>
      <br/><i>Hover to zoom</i>
      <h2> Running a Program  </h2>
      <p> Java code is executed from the main method <code class='inline'>public static void main(String[] args)</code>. You can run your main method by either right clicking within it and selecting run. Or when the file containing your main method is open using the Run button at the top right of the editor. </p>
      <br/>
      <span class='scaled-half'><img src='/imgs/java-setup/ScreenShot-JavaInstall-12.PNG'/></span>
      <br/><i>Hover to zoom</i>
      <h2> Debugging a Program  </h2>
      <p> To debug you can set breakpoints in your code by selecting the left hand side by the line numbers. This will add a red dot which tells the program to pause executing when it reaches the code at that line. To do this you need to run in debug mode (rather than plain run mode) by right clicking your main method and choosing Debug, or by using the debug icon at the top right of the editor window. </p>
      <br/>
      <span class='scaled-half'><img src='/imgs/java-setup/ScreenShot-JavaInstall-13.PNG'/></span>
      <br/><i>Hover to zoom</i>
      <h1> Additional Help </h1>
      <p> If you need any help at all feel free to text or email. If its a code issue, either a screenshot of the code or the code itself will help! </p>
    </article>
  </body>
</html>