NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I am starting JOSM using the following script:

rem Set up settings + plugin location
set APPDATA=\APPDATA
echo %APPDATA%

rem Download latest version
curl http://josm.openstreetmap.de/download/josm-tested.jar -o josm-tested.jar

rem Run 
java.exe -Xmx1024M -jar josm-tested.jar

The update works, the running itself works, but all preferences are saved to C:UsersMyNameAppDataRoaming despite environment variable being set to APPDATA.

I looked into the source code of JOSM and on the first look it seems like asking for the correct environment variable. Why does it not work?

Background: I want to have JOSM in a folder together with everything, however I do not want to install java on a flash drive and run it from there ...

Edit: If anyone is interested this is the result so far (updates josm only if needed, keeps all settings within own folder, starts josm and tracerserver (only relevant for the Czech Rep.)

@echo off

echo:Setting up settings + plugin location
set APPDATA=appdata
echo:set to %APPDATA%

echo:Determining latest tested version
curl http://josm.openstreetmap.de/tested -verbose -o tested.txt
set /p testedVersion=<tested.txt

echo:Determining current version
java.exe -Xmx1024M -jar josm-tested.jar -? | findstr /C:"Revision" > current.txt
set /p temp=<current.txt
set currentVersion=%temp:~10,4%

set /a diffVersion=testedVersion-currentVersion
echo %diffVersion%

if %diffVersion% gtr 0 (
    echo:Update needed
) else (
    echo:JOSM is up to date 
    goto runapps
)

echo:Downloading latest version
rem Download to temporary file, then copy and remove - to prevent file corruption when download fails
curl http://josm.openstreetmap.de/download/josm-tested.jar -o josm-tested-download.jar
move /Y josm-tested-download.jar josm-tested.jar
del josm-tested-download.jar

:runapps
echo Starting tracer server
start TracerServer\bin\Osm.Kn.Trace.Server.exe

echo Starting JOSM 
start java.exe -Xmx1024M -jar josm-tested.jar

:end

asked 21 Nov '11, 23:37

LM_1's gravatar image

LM_1
3.3k335188
accept rate: 10%

edited 22 Nov '11, 19:02


You can also pass the preferences folder on the command line. Assuming a subfolder of "JosmTestedSettings" -

java.exe -Xmx1024M -jar josm-tested.jar -Djosm.home="./JosmTestedSettings"

permanent link

answered 22 Nov '11, 12:46

Mike%20N's gravatar image

Mike N
2.9k22254
accept rate: 17%

Found the problem, it has to be set to APPDATA, not \APPDATA

permanent link

answered 22 Nov '11, 00:12

LM_1's gravatar image

LM_1
3.3k335188
accept rate: 10%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×622

question asked: 21 Nov '11, 23:37

question was seen: 4,229 times

last updated: 22 Nov '11, 19:02

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum