AP CS Java Setup
0
Install a terminal
Windows
Download and install Git for Windows. This includes our console, git bash
.
OS X
Use Terminal
, which is included in MacOS.
1
2
Download Java SE Development Kit 8 for your operating system.
You will need to click the Accept License Agreement
checkbox above the download links before anything will download. You may need to sign up for a free Oracle account.
3
Run the installer.
4
Optional
If you want to be able to run your text editor from the command line, like we do in class:
$ code .
Windows
Create a text file with the name of the command you want to use (code in this case, and always with no extension) with the following content (the second line is the path to your chosen text editor program):
#!/bin/sh
"C:\Program Files (x86)\Microsoft VS Code\Code.exe" $1 &
Move the text file into the C:\Program Files\Git\usr\bin
folder (or C:\Program Files (x86)\Git\usr\bin
if that’s where Git was installed).
Restart Git Bash
and your command should work.
Mac
With VScode open press the keys cmd + shift + p
.
In the box that pops up, type shell
.
Select the first option: Shell Command: Install 'code' command in path
by pressing Enter
or clicking it.
Press okay
, then type in your user password.
Finally, close and reopen terminal
.
5
Windows Only
Add java to your path.
Windows 10
Windows 7 or 8
To test if java
is working, restart git bash and run:
$ javac
You should see info related to java
, not a command not found
error.