So, i want to have a Windows startmenu-entry for JOSM-OSM (default) and JOSM-OHM so i can simply start the one i want to use.
JOSM installed with the .msi from https://josm.openstreetmap.de/ so default JOSM start is in %localdata%\JOSM and the preferences get stored in %appdata%\JOSM.
I found Help/Preferences – JOSM and it seems to expect the usage of one of the *.jar-versions and not the msi-installer. If i copy the %localappdata%\JOSM to %localappdata%\JOSM-OHM and insert into that folder the preferences from “roaming” and then cd in the CMD into %localappdata%\JOSM-OHM\app so i can use josm-custom.jar instead of the in the site mentioned josm-latest.jar with java -Djosm.dir.name=JOSM-OHM -jar josm-custom.jar - it fails.
Usage of java -Djosm.dir.name=JOSM-OHM -jar josm-custom.jar results in Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openstreetmap/josm/gui/MainApplication has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I tried some stuff and was not able to get it working. So after that i found CLI-Options for JOSM Help/CommandLineOptions – JOSM
So i made two shortcuts for the Start Menu, with %localappdata%\JOSM\JOSM.exe --load-preferences=file:///%localappdata%\JOSM\preferences_ohm.xml and one for osm itself.
But no matter what i do there (also with absolute path and without the “%”) - its still using the default preferences found in %appdata%\JOSM (So Roaming).
So how can i get a simple way to get 2 or 3 profiles for JOSM without having to change it everyime i start it up, change the preferences and restart JOSM again?
Or do i have to use the .jar to even be able to do that?
(i’m afraid the answer is really simple actually )
I am not an Windows expert and do not have a Windows system but:
This error message tells you that you are using an older Java version. You need Java version 11 or higher to run JOSM. The windows package usually includes a Java Runtime Environment but it is only used for JOSM.
I guess that you still have java 1.8 installed. What does java --version say?
You might be able to use the Java version provided by JOSM but you need to specify the path to the java.exe or you simply need to install a newer Java version on your system.
OK, my guess was correct regarding the java version.
The JOSM windows installer ships a newer Java version and the .jar file but you need to set the correct paths to both. JOSM.exe is probably only a batch file and does not pass the options correctly to Java.
I fear I am not a the right person to help you out and you need to wait for someone else with better knowledge of Windows to step up. (@GerdP).
Dunno about that. I do know that I fetch data from OSM, change the preferences, fetch data from OHM, change the preferences again.
I don’t have to restart.
I only change server and inlog details, and it is somewhat of a nuisance
I don’t understand what problem you cannot solve. You can start JOSM with an option to use a specific configuration directory. Typical solution would be two or more *.cmd (or *.bat) files where each configures the path to a newer java version
and then starts josm_custom.jar with the desired options.
So, the *.cmd file for OHM would contain something like
SETLOCAL
set path=<path to actual jre>;%path%
java -Djosm.home=c:\josm_confg\ohm -jar josm.jar
I don’t think that JOSM itself offers an option to switch between different configurations while it is running.
I just had one JOSM on one monitor and one JOSM on an other. One JOSM was logged in OSM and the other in OHM. I could copy / paste at source position items from one to the other and vice versa. However it didn’t work all the time. Sometimes it wouldn’t paste at source position.
I’m not quite sure what’s going on.
As usual there is more than one option to achieve your goal . Personally, I would choose two completely separated settings using -Djosm.dir.name=* or -Djosm.home=*, as I probably would need different external presets, styles, rules plus settings.
Though, you could try to use --load-preferences=* or even once manually export and then always manually import the few settings regarding the server to use plus credentials under the advanced preferences.