JOSM/HOWTO/Run from flash disk with Java

From OpenStreetMap Wiki
Jump to navigation Jump to search

This HOWTO explains the setup of a portable installation of JOSM with Java for Windows, e.g. for a USB flash disk. This can be useful when you want to run JOSM but Java is not installed on a PC (e.g. at a library). Installation of Java is usually limited to administrator accounts, but Java can run from a flash disk without installing.

Requirements

You will need:


Assuming you have your flash disk with drive letter F:...

Get JOSM

JOSM is actively developed, so it is worth checking that you have the latest version. It can always be found here:

https://josm.openstreetmap.de/download/josm-latest.jar

Step #Updating JOSM (optional) below will explain how to automatically download the latest version each time you run JOSM.

For this example, assume you put josm-latest.jar in F:\JOSM


Get Java

If you have run JOSM before on a Windows PC, that machine will already have Java installed.

Otherwise, you will need to install it on a Windows PC where you have admin rights. Get the latest from https://www.java.com

Once it's installed on the local machine, you copy the entire contents (subfolders and their files) from C:\Program Files\Java\jre<VERSION>\ to your flash disk.

<VERSION> was "1.6.0_03" in 2007. May be different now.


To use Microsoft's OpenJDK rather than Oracle's JAVA copy C:\Program Files\Microsoft\jdk etc to your flash drive.

For the purposes of this HOWTO, put them in F:\Java\ so you have F:\Java\bin and so on.

Create a batch file

By default, JOSM will save your preferences to the local machine, which is not much use for a portable installation. You can easily change that by running it from a batch file:

set APPDATA=\APPDATA
\Java\bin\java.exe -jar \JOSM\josm-latest.jar 

Save the above in a file, e.g. F:\gojosm.bat

Updating JOSM (optional)

You may wish to automatically download this file each time you run the batch file, using cURL, a small command line program for transferring files.

http://curl.haxx.se/latest.cgi?curl=win32-nossl-sspi

Unzip the contents of the cURL zip to F:\cURL

Then you can either add the following line to the start of gojosm.bat, or into a separate batchfile (e.g. F:\josm-update.bat)

\cURL\curl http://josm.openstreetmap.de/download/josm-latest.jar -o \JOSM\josm-latest.jar

Note that it is advisable to use a https-secured connection for software downloads. Is cURL capable of this? Then use it.

Note that if you are using JOSM plugins, they may not be compatible with the latest JOSM, so use this with care.

Try it out

That's it! Try running gojosm.bat

See also