Portable Windows Software Installation Guide for CAB302
It can be useful to be able to take your Java development environment with you. Here is a guide to installing some of the components portably.
First, prepare your USB drive or other portable location (e.g. a shared network drive). You will want at least 2 gigabytes of space. For the sake of this explanation I will assume your portable location is D:\cab302\
JDK 11.0.2
Download the Windows ZIP install of the JDK from
https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html
Extract this (using a tool like 7-Zip or WinRAR) into D:\cab302\, preserving the path (so that the JDK is in the D:\cab302\jdk-11.0.2 directory).
You will need to set up the PATH and CLASSPATH environment variables on each computer you use this from in order to use the JDK command line tools; however, as we are compiling software from within IntelliJ, this isn’t necessary.
Git 2.21.0
Download the Windows portable install of Git from https://git-scm.com/download/win
This version of Git is already designed to be used portably, so there is nothing we need to do here. Extract it to D:\cab302\PortableGit. You can now launch Git Bash by running D:\cab302\PortableGit\git-bash.exe
Standard UNIX commands work from within Git Bash (cd, pwd, mkdir). You can access Windows drives through /{drive letter}/ – for example, cd /c/Users/{username}/My\ Documents/ to access the My Documents directory.
IntelliJ IDEA 2018.3.5
Download the Windows ZIP install of IDEA from
https://www.jetbrains.com/idea/download/#section=windows
Extract this ZIP to D:\cab302\ideaIC. You should now have 3 directories in D:\cab302\ like this:
Now you need to make some changes to the IDEA properties file to store settings on the local drive. Open up D:\cab302\ideaIC\bin\idea.properties in a text editor (Notepad will do).
Go down to the line:
# idea.config.path=${user.home}/.IdeaIC/config Change it to:
idea.config.path=../.IdeaIC/config
Then go down to the line:
# idea.plugins.path=${idea.config.path}/plugins Change it to:
idea.plugins.path=../plugins
Leave the rest of the file untouched.
After making these changes, the first part of the file should look like this:
You can now launch ideaIC (run D:\cab302\ideaIC\bin\idea64.exe – you can create a shortcut to it in Dcab302\ if you want to make launching it easier.)
The first time it runs, it may ask you to import settings. This is up to you, but this guide will assume you chose not to import settings.
First IDEA will ask you to choose a dark or light theme- choose whatever is easiest on your eyes.
Next it will ask you to choose default plugins. Just leave these alone and click Next.
It will then ask you to choose featured plugins. Once again, leave this alone and click Start.
The IDEA home screen should then appear:
(note that this screen is from IDEA 2018.3.4- if you installed a newer version you will see that version instead)
For now, choose Create New Project to practice creating a simple Java application.
IDEA will automatically select ‘Java’- leave this selected as we want to create a desktop Java application. Next to Project SDK will be a dialog that may have
Leave all the other settings alone, then click Next.
On the next screen you will be asked to choose a template. Choose “Java Hello World” so we have something that we can compile and run now, then click Next.
On this screen you will be asked to choose a location to create this project. Each project should go in its own directory, for example, a HelloWorld project should go in e.g. the D:\cab302\MyProjects\HelloWorld directory. You can keep your projects in the same portable directory, or put them somewhere else – for example, H: on QUT lab machines, your Dropbox folder or anywhere else The click Finish.
IDEA will then open with your newly created project:
The source of main() might all appear on one line- if that is the case, click the + icon next to it to expand it for editing.
Now you should be able to compile and run the application. Click the green arrow button next to the button with “Main” on it. If everything works correctly, your Hello World application will now build and run in the terminal window down the bottom:
We can see from this terminal that java.exe from the JDK we installed in D:\cab302\jdk-11.0.2\ was used to run our program, and that our program correctly ran and terminated without any errors. For future projects, IDEA should automatically select this JDK- however, if you move to another computer and your USB drive gets a different drive letter, you may need to re-select it.
The last thing we need to do here is set up Git. Go to File -> Settings, choose “Version Control” from the pane on the right of the Settings window, then click ‘Git’ under the expanded submenu. At the top of the settings screen for Git is a setting labelled “Path to Git executable:”, with a dialog (“Auto- detected: git.exe”) and two buttons titled “…” and “Test” next to that. First, click the “…” button, then navigate to D:\cab302\PortableGit\bin\ and select “git.exe” and click “OK’. Finally, click the “Test” button to make sure git is working. If Git was installed properly it should display the Git version. Click out of that dialog, then click “OK” to close the Settings window. Once again, if the drive letter changes you may need to reconfigure this path to point to wherever Git is now.
You should now be ready to develop Java applications on the go.