How to Install Java on a Flash Drive

By Deborah Lee Soltesz

If you use multiple computers, having a portable flash drive full of your favorite software is a handy way to carry around your workspace. This is particularly useful if you frequently work on public computers in libraries or school computer labs where you may not have permission to install the software packages you need. Installing Java on a flash drive lets you create your own portable software environment, ensuring you have access to the version of Java you need.

Install and Configure

Step 1

Visit the Java Downloads page (see Resources). Click the \"Download\" link for the latest version of the Java Platform, Standard Edition JDK (Java Development Kit).

Step 2

Click the \"Download\" button on the next screen to continue.

Step 3

Save the installer file to your desktop.

Step 4

Attach your flash drive into your computer. Note which drive letter is assigned to the drive.

Step 5

Double-click the JDK installer icon on your desktop to launch the installation.

Step 6

Read the License Agreement. Click \"Accept\" to accept the terms of the agreement.

Step 7

Click on \"Development Tools\" to select it. Click \"Change\" to open a file chooser window.

Step 8

Click the \"Look in\" menu to open it. Select your flash drive from the list. Click the \"New Folder\" button (sparkly folder icon), type \"java\" for the new folder name, and hit the Enter key.

Step 9

Double-click the new \"java\" folder to select it as the installation folder. Click \"OK\" to return to the installation screen.

Step 10

Click on each of the remaining listed components (Demos and Samples, Source Code, etc.), hit the \"Change\" button, select the \"java\" folder on your flash drive, and click \"OK.\"

Step 11

Click \"Next\" to start the installation.

Step 12

Click \"Finish\" to finish the installation.

Step 13

Open a Command Prompt window by clicking the \"Start\" button, and selecting All Programs > Accessories > Command Prompt.

Step 14

Type the drive letter of your flash drive followed by a colon (for example, \"x:\") and hit the Enter key to change the current working drive to the flash drive.

Step 15

Type \"notepad js.bat\" on the command line and hit the Enter key. Notepad opens. Click \"Yes\" to create a new file.

Step 16

Type the following in Notepad:

set Path=\java\bin;%Path%

Step 17

Save the file and close Notepad.

Step 18

Type \"js\" on the command line and hit the Enter key. This sets the environment to use Java on the flash drive.

Step 19

Test the installation by typing \"javac -version\" followed by the Enter key. The version information is output to the screen.

Use the Flash Drive

Step 1

Attach your flash drive to a computer. Note the drive letter assigned to the flash drive.

Step 2

Open a Command Prompt window.

Step 3

Type the drive letter of your flash drive followed by a colon and hit the Enter key.

Step 4

Type \"js\" on the command line and hit the Enter key.