How to Run Java Application from USB Flash Drive

I copied Java IRC client jIRCii that I downloaded a few days ago to my USB Flash Drive, hoping that I can use it anywhere I go. When I connected it to my other computer, I found that I cannot run it, because the computer has no Java runtime installed.

I thought it would be nice if I can have Java runtime on my flash drive. I don’t have to download and install it again. I tried to google for tutorials, but I couldn’t find any. Here is a solution I came up with. I use jIRCii as an example. You can modify it for other Java applications. You do this on a computer pre-installed with Java runtime.

  1. Create a program folder on my flash drive and copy the Java application to it. I named my program folder Portable Programs.
  2. Copy the Java runtime folder to Portable Programs. The Java runtime is in C:Program FilesJavajre6 .
  3. Now go to the Java application folder. In this example, it’s the jIRCii folder. Create a batch file jircii.bat with the following lines.
    SET PATH=%PATH%;..jre6bin
    start javaw -jar jerk.jar

    Note that jerk.jar is the jar file for this application. You have to find the correct jar file for the Java application you intend to use and modify the batch file accordingly.

Now you can double click on the batch file to run the application. If you run to problems, you can try to add the command pause to the batch file, so you can see the error messages.

This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.