JOSM/Linux

From OpenStreetMap Wiki
Jump to: navigation, search
Linux mascot “Tux”

This page provides help for JOSM on Linux systems.

Installing JOSM

The following distributions have JOSM available in their package libraries, however the maintenance of these packages may be some way behind the recent JOSM developments and bug fixes.

In general JOSM simply requires a single jar file, so downloading and starting a recent version of this jar file can be the best way to work with a reasonably up-to-date version of JOSM. See the general JOSM/Installation page for this.

Some of the following instructions use wget to download. In case the wget complains about a certificate error you may want to install the required root CA certificates to your system, or wget's --no-check-certificate switch, or use the unsecured http URL.

Arch Linux

Install the josm package available in the official repositories.

pacman -S josm

Debian (includes Ubuntu)

help text 1 (Ubuntu)

On Ubuntu, use either the manual installation or the JOSM packages. The version from the official Ubuntu repositories is often outdated (see also help.ubuntu.com).

help text 2 (Ubuntu)

… very old Ubuntu versions.
8.10 (Intrepid):

The latest version of JOSM and all the associated packages can be installed very simply with Ubuntu's Synaptic Package Manager.

  • Open Synaptic Package Manager (System >> Administration >> Synaptic Package Manager). Select All at the top of the list of software categories and type JOSM in the search box.
    • if JOSM doesn't appear in the package list make sure you have enabled Community-maintained open source software (Universe) in the Software Sources manager (System >> Administration >> Software Sources >> Ubuntu Software)
  • Check the box next to JOSM and mark it to be installed.
  • Click the "Apply" button on the top navigation bar. Allow the associated packages to be downloaded; JOSM will be installed on your system.
  • a quick link to JOSM can be found in the Applications >> Education menu; or you can open a terminal and type josm
Custom install on older versions of Ubuntu:
  • Install Java: Java Runtime Environment
  • If you want to have sound for audio mapping and you are using ALSA (default in ubuntu), install alsa-oss:
    $ sudo aptitude install alsa-oss
  • launch JOSM:
    $ aoss java -jar /usr/share/josm/josm.jar

Be sure to adjust the path to your josm jar file.

  • Note: For some reason josm won't play sounds using Sun's JDK, so if you're doing audio mapping use openjdk-6-jdk instead - you'll have to set JAVA_HOME since josm doesn't obey /etc/alternatives/java - see /usr/bin/josm for more.
  • Since Ubuntu 8.04 LTS JOSM is in the universe repository:
    $ sudo aptitude install josm
  • If you want up-to-date packages in Ubuntu 8.04 (updated nearly every day), you can use the PPA from The Launchpad OpenStreetMap Team

help text 3 (Ubuntu/Debian)

Installing the 'josm' package using ubuntu's Synaptic Package Manager. You can untick josm-plugins package if you prefer without

Ubuntu users have a good (dated! … from 2007!) tutorial at UbuntuForums.

There is a 'josm' package. This sets you up with a JOSM entry on the applications menu (under 'Education' for some reason), and installs a JOSM jar file to /usr/share/josm/josm.jar.

After installing the package you can update your version of JOSM by overwriting this file with a downloaded josm-tested.jar or josm-latest.jar, which you may well wish to do because...

The JOSM package can be a bit behind the times. At time of writing the package gives you JOSM version which is many(!) months old (version 4878, while josm-tested is at version 7906) You can see the history of maintenance of this debian package. Looks like it's mostly being done by David Paleino (User:Hanska)

There is also a 'josm-plugins' package containing a handful of plugins. These may also be old. If you want a fresh install without any plugins, you can untick this package and only install 'josm'. If you use JOSM's built in plugin manager to acquire newer plugins, then this may well result in prompts to update josm.

help text 4 (Debian)

tl;dr: (June 2016):

  • Debian Jessie (current Debian stable):— requires an alternative repository for JOSM to obtain any updates (minimally fiddly); neither the default JOSM nor the default OpenJDK (JAVA) can be used, as the osm developers refuse to backport josm-tested to Jessie.
  • Debian stretch (current Debian testing):— use as the minimum distribution for an uncomplicated installation + updates.
  • Debian sid (Debian unstable):— has the identical JOSM + OpenJDK versions as stretch
  • All packages 1: Use synaptic (GUI) / aptitude (console) to update JOSM (ignore JOSM link-pages)
  • All packages 2: Use JOSM to install / update Plugins (F12 | Configure available plug-ins | Update plug-ins)
  • All packages 3: Launch JOSM from menu (under ‘Education’)

This is the state of the game at June 2016:—

  • Stable: jessie 8.4
  • JOSM-tested: Stretch + Sid + Jessie w/openstreetmap.de repository: svn10301; requires Java-8
  • maximum JOSM under Java-7:— svn10168
  • all current josm-tested require java-8-openjdk or java-8-oracle

The bottom line, Stretch or Sid:—

After Debian install + setup, fire up System | Synaptic; search/find ‘josm’, mark for installation, then do it.

See next section for the alternatives and java-alternatives system if you need to switch your Debian from preferring Java-7 to preferring Java-8.

JOSM-Plugins:

The simple instruction for all distributions is: do not install. Install instead from within JOSM (that was easy).

The bottom line, Jessie:—

There are 3 issues with Jessie:—

  1. JOSM in the standard distro is 2 years out of date (svn7643, Oct 24, 2014) (and ditto for the plugins)
  2. Neither Jessie-JOSM nor the plugins will ever be updated
  3. The max default Java version available is Java-7

Whoops-a-daisy

JOSM:

openstreetmap.de provide a distro that can provide an effective replacement. Here's how to implement it:—

  1. Use the following one-liner in a terminal to create a new repository:—
    echo deb https://josm.openstreetmap.de/apt alldist universe | sudo tee /etc/apt/sources.list.d/josm.list > /dev/null

    Notice the word sudo (“super-user do”) in that line? That is necessary because the dir /etc/apt/ is root.root, and the file that it is creating needs to be the same. Your user needs to be within the ‘sudo’ group before issuing that command. If that is not already the case, issue the command ‘su’ (“switch user” to root) in a terminal & give the root password. At the root prompt (a '#') issue the command ‘adduser your-username sudo’ (replace “your-username” with your username!). The command ‘exit’ will then take you back to your normal user screen. That only needs to be done once. From now on, you can use sudo to do a command as the SuperUser. The password that you then give is your normal user password.
  2. Next, it is necessary to download and register the openstreetmap.de public key. That can also be done in a single line:—
    wget -q https://josm.openstreetmap.de/josm-apt.key -O- | sudo apt-key add -
  3. The final item is to refresh the sources.

    Either use Synaptic, or use ‘sudo apt-get update’ within a terminal. You may suffer an extra wrinkle at this point, not mentioned on the Download page:
    :~$ sudo apt-get update
    E: The method driver /usr/lib/apt/methods/https could not be found.
    N: Is the package apt-transport-https installed?
    (it is a simple matter of installing apt-transport-https first)

Jessie is now in the correct state to start installing josm as detailed above with Stretch and/or Sid. However, it also needs to be able to install Java-8, so see below. But first...

JOSM-Plugins:

The simple instruction for all distributions is: do not install. Install instead from within JOSM (that was easy).

Java:

The default version currently (May 2016) installed on Debian stable is Java-7, although an unannounced Java-6 is also installed. That default is ‘java-7-openjdk’, and is available from the standard repository(s) in the normal fashion. It is independent of Sun/Oracle, and as such is both developed & supported by Debian. The current josm-tested requires Java-8.

There are currently (May 2016) two possibilities for installation of Java-8. Neither is perfectly satisfactory, due to undocumented differences between the java-7 & java-8 groups. However, that does not stop JOSM-tested from setting itself up fine:—

  • openjdk-8: add jessie-backports as a Distribution within a standard Debian Repository listing
  • oracle java8: add the webupd8team Repository

Here are recent examples of both (note that Oracle Java is commented out & therefore not currently installed):—

:~$ tail -2 /etc/apt/sources.list

deb http://ftp.uk.debian.org/debian/ jessie-backports main non-free

deb-src http://ftp.uk.debian.org/debian/ jessie-backports main non-free
:~$ cat /etc/apt/sources.list.d/webupd8team-java.list

# deb http://ppa.launchpad.net/webupd8team/java/ubuntu/ xenial main

# deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu/ xenial main

I would advise adding openjdk-8 via jessie-backports; that can be done via a text editor as root, or via Synaptic: (menu):Settings | Repositories. Once entered into the Repository system & refreshed, it can be installed as openjdk-8-jre.

Jessie should now be in the same state as both Stretch & Sid, and JOSM can be installed/updated in the same fashion (instructions at top of this section).

The rest of this documentation discusses the Debian alternatives system for Java. If, after installation, JOSM loads up fine without complaint then ignore what follows. If not, this is how to manually select Java-8:—

Java is handled via the Debian alternatives system (using the terminal command update-alternatives). There is also a poorly-documented update-java-alternatives which also requires you to be root. The next section will show both of these being used in the order shown, and with the result shown. That is because that was how the author did it & his JOSM works fine on his Jessie system. The author has to confess perfect ignorance of which aspect is vital.

Debian alternatives:

This is a method to automatically handle competing versions for the same facility, application and/or service. update-alternatives is a user-level console application which gives the option to manually select a version for a facility, application and/or service handled by the alternatives system.

When it comes to JAVA, there are two independent sets of user-level console application:—

  1. update-alternatives
  2. update-java-alternatives

A system of symlinks is maintained at /usr/lib/jvm/; this was the state of that directory following a new installation of Jessie 8.4, then installation of both openjdk-7 and openjdk-8:—

:~$ ls -Al /usr/lib/jvm/

total 20
lrwxrwxrwx 1 root root 24 May 6 2014 default-java -> java-1.7.0-openjdk-amd64
lrwxrwxrwx 1 root root 20 Apr 25 14:13 java-1.7.0-openjdk-amd64 -> java-7-openjdk-amd64
-rw-r--r-- 1 root root 2439 Apr 25 14:13 .java-1.7.0-openjdk-amd64.jinfo
lrwxrwxrwx 1 root root 20 Apr 22 18:01 java-1.8.0-openjdk-amd64 -> java-8-openjdk-amd64
-rw-r--r-- 1 root root 2600 Apr 22 18:01 .java-1.8.0-openjdk-amd64.jinfo
drwxr-xr-x 5 root root 4096 May 20 19:50 java-6-openjdk-amd64
drwxr-xr-x 5 root root 4096 May 17 13:06 java-7-openjdk-amd64

drwxr-xr-x 5 root root 4096 May 20 19:27 java-8-openjdk-amd64
update-alternatives:

This is exceptionally easy to use:—

  1. Open a Terminal (console)
  2. Issue the following command:—
:~$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      auto mode
  1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manual mode
* 2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1069      manual mode

Press enter to keep the current choice[*], or type selection number: 

In the above situation, java-8 is already selected as the default, so there is zero need to alter that.

update-java-alternatives:

There is virtually no documentation on this command. The reason for it's existence is clear if you examine the text within the ‘.jinfo’ files within /usr/lib/jvm/ (47 sub-groups within openjdk-8). This utility can change all 47 at once. Or at least, it could if there was not a bug within the setup of some of the groups. Nevertheless, it will work effectively. Follow the commands below if you need to change JAVA from 7 to 8:—

:~$ sudo update-java-alternatives -l

[sudo] password for user:
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
java-1.8.0-openjdk-amd64 1069 /usr/lib/jvm/java-1.8.0-openjdk-amd64

:~$ sudo update-java-alternatives -s java-1.8.0-openjdk-amd64

(the -l parameter lists the available JAVA versions)
(the -s parameter will then set that JAVA version as the default for all JAVA sub-groups)

Here is a current example of the java groups controlled by alternatives following the two sets of commands as above:—

:~$ update-alternatives --get-selections | fgrep -i java
itweb-settings         auto     /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/itweb-settings
java                   manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
javaws                 auto     /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/javaws
jexec                  manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jexec
jjs                    manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/jjs
keytool                manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
mozilla-javaplugin.so  auto     /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so
orbd                   manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/orbd
pack200                manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/pack200
policytool             manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/policytool
rmid                   manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmid
rmiregistry            manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmiregistry
servertool             manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/servertool
tnameserv              manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/tnameserv
unpack200              manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/unpack200


Note: If you have another JVM installed and want to use SUN's java, start josm with

JAVACMD=/usr/lib/jvm/java-6-sun/bin/java josm

Fedora

Install from desktop: System->Administration->Add/Remove Software - type "josm" into search box & click Find. Click checkbox & then Apply.

Install from command line: $ dnf install josm<CR> (Logged in as root or use sudo]

JOSM will then be installed & a launcher item put into the Applications->Education menu

FreeBSD

On FreeBSD JOSM is available at ports/astro/josm.

Gentoo

See JOSM/Gentoo

Linux Mint

You can use the Ubuntu package in Linux Mint :

#Add the key
wget -q https://josm.openstreetmap.de/josm-apt.key -O- | sudo apt-key add -
#Add the repository
echo "deb https://josm.openstreetmap.de/apt `grep "VERSION=" /etc/os-release |
awk '{ print $2 }' | tr [:upper:] [:lower:]` universe" |
sudo tee -a /etc/apt/sources.list

openSUSE

OpenSUSE Build Service has regularly updated builds at Applications:Geo. Installation via YaST, zypper or rpm.

Older stuff (if you use openSUSE and this is really not needed any more, please delete):

JOSM packages are available in the openSUSE's build service, in the Application:Geo repository.

Go to http://download.opensuse.org/repositories/Application:/Geo/, select you distibution and find the RPM in the noarch directory. Install using RPM or your favourite package manager.

Example for openSUSE 10.3 using zypper:

zypper ar http://download.opensuse.org/repositories/Application:/Geo/openSUSE_10.3
zypper ref
zypper in josm

The first command has changed slightly for openSUSE 11.0 (and openSUSE 11.1):

zypper ar http://download.opensuse.org/repositories/Application:/Geo/openSUSE_11.0/Application:Geo.repo
zypper ref
zypper in josm

Use this for openSUSE OneClick install:

 http://packages.opensuse-community.org/index.jsp?searchTerm=josm

Start JOSM

  • See JOSM/Installation#Start JOSM.
  • If you installed JOSM via a package (e.g. from your distribution), you may be able to simply use a simpler josm command.

To automate updating and starting you can use

  • an update and startup script that backs up a number of old versions if the current one doesn't work as desired
  • or you can use the following simple script to use always the latest JOSM version (note that it contains some stuff which you may not need – proxy — or which you may not have – kdialog):
#!/bin/sh
GPSDIR=/home/sven/Desktop/gps
PROXY=www-proxy
export JAVA_HOME=/usr/local/java/jdk1.6.0_04/
DCOPREF=`kdialog --title "Hole JOSM"  --progressbar "Hole JosmLatest" 100`
cd $GPSDIR
wget -N https://josm.openstreetmap.de/download/josm-latest.jar
dcop "$DCOPREF"  close
$JAVA_HOME/bin/java -Xmx1024M -DproxyHost=$PROXY -DproxyPort=8080 -jar josm-latest.jar