You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is recommended to install Django in a virtual environment. You can run:
57
+
It is recommended to install Django in a virtual environment. Virtual environments are used to isolate the needs of one application from another, orfrom cluttering the OS. You can run the command below in your terminal:
58
58
59
59
```python
60
60
$ python3 -m venv venv
@@ -158,7 +158,7 @@ In the terminal, I will run the command `tree` to see the project's structure.
158
158
159
159
You may not have this command installed. To use it, you will need to install it first. Thankfully, there is some instruction on the terminal on how to do the installation. Follow it and then re-run the `tree` command.
160
160
161
-
Above, you can see that we are currently in our initial project directory, denoted by the `.`. Our actual project is called `blog_app` and it has a few more files in it. In the top-level directory. There is also the `manage.py` file which acts as the entry point to the application.
161
+
Above, you can see that we are currently in our initial project directory, denoted by the `.`. Our actual project is called `blog_app` and it has a few more files in it. In the top-level directory, there is also the `manage.py` file which acts as the entry point to the application.
Copy file name to clipboardExpand all lines: 03_java/01_getting_started_with_java.md
+58-6Lines changed: 58 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,13 +12,14 @@ To build things using Java, you need the Java Development Kit (JDK). It is one o
12
12
-[Install Your IDE](#install-your-ide)
13
13
-[Install Java In Your Ubuntu OS](#install-java-in-your-ubuntu-os)
14
14
-[Quickstart](#quickstart)
15
+
-[Modify Path to New JDK](#changing-the-default-jdk)
15
16
16
17
17
18
## Download JDK
18
19
19
20
I will show you how to install the open-source JDK (OpenJDK) from Amazon called the [Amazon Corretto](https://aws.amazon.com/corretto/?filtered-posts.sort-by=item.additionalFields.createdDate&filtered-posts.sort-order=desc). As of this writing, I will be showing you how to download [Amazon Corretto 17](https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html).
You can choose to either use the terminal commands to download the JDK or you can click on the highlighted link to download directly from the site. Ensure that you download the file to a location you want, say in the home directory, for example.
24
25
@@ -33,6 +34,10 @@ We will need to use an Integrated Development Environment when working with Java
33
34
34
35
## Install Java in Your Ubuntu OS
35
36
37
+
This can be done in two ways:
38
+
39
+
### Using apt
40
+
36
41
- To use the Corretto Apt repositories on Debian-based systems, such as Ubuntu, import the Corretto public key and then add the repository to the system list by using the following commands:
37
42
38
43
```java
@@ -46,6 +51,8 @@ We will need to use an Integrated Development Environment when working with Java
-Before you install the JDK, install the java-common package.
50
57
51
58
```java
@@ -114,18 +121,63 @@ When working with Java Projects, VS Code does not offer core support the way Int
114
121
115
122
At this point, you should already have the [Extension pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) installed. To create a Java Project, open VS Code.
116
123
117
-

124
+

118
125
119
126
Select on "File Explorer" to access the "Create Java Project" button. Click on it.
Notice that the project comes with a structure already. In the example above, I have already clicked on the `App.java` file. You can do the same. To run it, you can press the "play" button on the top-right, or `f5`. Alternatively, you can right-click on the file to access the command "Run Java". Select it and you will see the text "Hello World" displayed on the terminal.
139
+
140
+
## Changing the Default JDK
141
+
142
+
You may notice that when you run the script above, the default JDK 11 is used instead of the newly installed Amazon Corretto 17. Typically, this is an issue to do with the path to the jdk. If we want to use Amazon Corretto 17, then we need to modify our settings to point to this jdk.
143
+
144
+
145
+
- Click on "Java Projects" at the bottom left of the VS Code's sidebar to access `...` more actions option.
-MyVSCode is already configured to use Corretto17, but by default, the version number may be 11.This is different from our installation efforts above. To change it to version 17, or whatever version you may have, we need to modify VSCode's configurations to point to Corretto 17.
151
+
152
+
- Get the path to Amazon Corretto. From your home directory, list the available JVMs:
130
153
131
-
Notice that the project comes with a structure already. In the example above, I have already clicked on the `App.java` file. You can do the same. To run it, you can press the "play" button on the top-right, or `f5`. Alternatively, you can right-click on the file to access the command "Run Java". Select it and you will see the text "Hello World" displayed on the terminal.
- Save the modified fille and reload VS Code to apply the changes. If you open "Configure Runtime Java" as we did above, you should see that the version number has now changed to 17.
177
+
- When you run any Java program, you will notice that our new path is being used the terminal:
0 commit comments