JA:Java Runtime Environment
OSMの多くのソフトウェアは Java動作環境(Java Runtime Environment 略してJRE)に依存しています。
- JOSM
- Mkgmap
- Osmosis
- JTileDownloader
- More listed on Category:Java
Contents |
インストール方法
ピュア Java アプリケーションは、大きな長所があります。ピュア Java アプリケーションは、オペレーティングシステムに依存しません。これは、開発者が個々のオペレーティングシステム向けにインストーラーやバイナリーパッケージを用意しなくてよくなります。代わりに、JRE をインストールするのは、オペレーティングシステムに依存します。ここでは、Java をどうやってあなたの PC にインストールするか、どうやって JRE を通してJava のアプリケーションを実行するかを説明します。
Windows
- Java Runtime Environment(JRE)をここから入手してください。:Java SE.
- 単にインストーラを実行します
- All the default options are generally the most sensible (installs to "Program Files/Java")
- A full java install is pretty typical nowadays, but if you're not interested in running applets on the web you might choose not to install any browser extensions. You might also choose to not install the 'java update checker' since this will add a new start-up item (one of those things which slows down start-up times very slightly)
Mac OS X
- Java 1.5は、OS X 10.4では最初からインストールされています。残念ながらMac OS 10.3.xではJava 1.5が利用できません。
- 通常 Java は開発用ディスクで配布されています。
- アップルは、 Javaのアップデートを 開発者向けサイトでアナウンスしています。もしあなたのJavaのバージョンが古いときは、見てみてください。
Linux
- Java SEからJavaランタイムをインストールします。
- いくつかのディストリビューションは、彼らのパッケージシステムでインストールすることを推奨しています:
= Ubuntu
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:
$ sudo aptitude install sun-java6-jre
- 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
Debian
- (ルート権限で)次のコマンドを実行してください:
$ apt-get install sun-java6-jre
- Debian Lenny には、JOSM が (いくつかのjosmプラグインのオプションつきで)リポジトリーにはいってます。:
$ sudo aptitude install josm josm-plugins
注: もし他の JVM を導入していて、SUN の Java 仮想マシンを使いたい場合には、 josm を開始するときに、次のようにしてください。
JAVACMD=/usr/lib/jvm/java-6-sun/bin/java josm
Gentoo
Portageを使った標準的なイスントール方法:
emerge -av sun-jre-bin
Gentoo ebuild コレクションには、OSMの Java アプリケーションが既にあります。これのうちどれかをインストールすると、JREが依存関係でインストールされます。例えば:
emerge -av josm
JOSM プラグインなどもebuildsで入手可能です。 http://svn.openstreetmap.org/applications/utils/gentoo/ に完全なリストがあります。最新の開発バージョンのJava アプリケーションや、プラグインが見たければ、OpenStreetMap Gentoo オーバーレイを利用してください。
openSUSE/Fedora/Mandriva
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
FreeBSD
JREのバイナリーパッケージが、http://www.freebsdfoundation.org/downloads/java.shtml で得られます。 次の様にインストールしてください:
pkg_add diablo-jre-freebsd7.amd64.1.6.0.07.02.tbz
もちろん、portsコレクションで JRE をインストールすることもできます。:
cd /usr/ports/java/diablo-jre16/ make install clean
しかし、JREをportsでコンパイルするのを推奨しません。なぜなら、長い時間がかかる上にこのコンパイルにはJava Development Kit (JDK)を必要とします。JDKは上のパッケージでインストールされる上に、JDKも既にJavaのアプリケーションを実行することができます。JREをコンパイルするのは、FreeBSD portsの開発者以外には無意味なことです。
Java アプリケーションの実行方法
多くの Java アプリケーションは、拡張子が".jar"のファイルにパッケージ化されています。
コマンドターミナルで実行する
これは一番基本で、どのオペレーティングシステムでも使える方法です。いくつかのJava アプリーケーションは(例えばmkgmap.jar)はターミナルなしには実行できません。
たとえ、コマンドラインの経験がなくてもそんなに難しくはありません。例えば、JOSM を起動するには、次のようなコマンドを入力してください:
cd [josm.jarを入れたディレクトリーのパス名] java -jar josm.jar
そうすれば、JOSM が動きます。
コマンドラインにはオプションを足すことができます。オプションは2種類あります。一つは、Java バーチャルマシン(VM)の初期化のためのもので、もう一つはアプリケーション用オプションです。
java [JavaVMのオプション] -jar application.jar [アプリケーションのオプション]
以下が、よく使われるJava VM用のオプションです。
- メモリオプション
- -Xmx is the only memory option which really matters. これは、Javaアプリケーションの最大メモリ容量を指定します。初期値は64 MBで小さすぎます。これを、例えば 512 MB に増やすには、"-Xmx512m"とします。(other java memory options)
- プロキシオプション
- -Dhttp.proxyHost= は、http をプロキシを通して使いたいときに、これでプロキシサーバーを指定します。例えば、"-Dhttp.proxyHost=192.168.1.1" とします。
- -Dhttp.proxyPort= これでプロキシポート番号を指定します。初期値は 80 です。例えば、"-Dhttp.proxyHost=8080" とします。
- -Dhttp.proxyUser= プロキシユーザー名を指定します。プロキシサーバーに認証が必要な場合に設定します。
- -Dhttp.proxyPassword= プロキシパスワードを指定します。プロキシサーバーに認証が必要な場合に設定します。
- -Djava.net.preferIPv6Addresses=true IPv6が必要な時に、これを指定します。ところで、まだOpenStreetMapのサーバーはIpv6をサポートしていません。
- グラフィックアクセラレータ
- -Dsun.java2d.opengl=true OpenGLを有効化します。 あなたのPCがOpenGL 2Dグラフィックアクセレータをサポートしているときに指定してください。この設定に問題がある場合には、(WinXP + nVidia FX1500 + dual monitorでは、アイコンバックグラウンド・ダイアログがおかしくなります。) 代わりに -Dsun.java2d.opengl=true -Dsun.java2d.opengl.fbobject=falseを設定してください。またOpenGLオプションは、Linux上のウィンドウマネージャーに問題を起こすことが知られています。
- -Dsun.java2d.d3d=true -Dsun.java2d.ddscale=true Windowsでの、 DirectX グラフィックアクセレーションを有効にします。
アプリケーション用のオプションは、アプリケーションによりけりです。それぞれアプリケーションのページを見てください。
コマンドターミナルってどこ?
- Windows:
- "スタート"ボタンをクリックしてください。"コマンドプロンプト"が、"プログラム/アクセサリー"の中に見つかるでしょう。もしみつからなければ、あなたのシステムはコマンドプロンプトのショートカットがインストールされてません。しかし、インストールする必要もありません。
- "スタート"メニューの"名前を指定して実行"をクリックして、出てきたウィンドウのボックスに"cmd"と入力してください。
- Alternatively create a file 'run-josm.bat', and edit it in notepad. Enter your command as the only contents of the file. Save it, then double-click the file to run it. If the black command window disappears immediately, you can debug by adding a new line 'PAUSE' in the bat file.
- Mac OS X: まず、ファインダーから"アプリケーション"、そして"ユーティリティー"にいきます。"ターミナル"が見つかるはずです。
Windows
通常 JRE インストーラーが、.jar ファイルタイプを javaw.exe (これはもう一つのJava 実行コマンドで、Windows用に特別にあるターミナルを必要としないGUIアプリケーションを実行するためのものです。) で実行する様に関連付けるので、.jar ファイルをダブルクリックするだけで実行できます。 しかし、これではオプションが付けられません。オプションを足す方法は2つあります。
- .bat ファイルを作成します。
- テキストエディタ(例:メモ帳)を起動し、新しいテキストファイルを作成します。
- テキストファイルにコマンドを記載します。"java"コマンドを実行する前に、"cd"コマンドを記載して、起動ディレクトリを指定したほうがよいでしょう。
- 拡張子を .batに変更して保存します。(例: josm.bat)
- .batファイルをダブルクリックするとコマンドプロンプトが起動し、.batファイル内に記載されているコマンドが自動的に実行されます。
- ショートカットを作る (.lnk ファイル)
- Right-click on a .jar file. Click "Create Shortcut" on the pop-up menu. (You can use "Send to/Desktop (create shortcut)", too.)
- Right-click the created shortcut and select properties.
- The full path of .jar file is shown on Target box. Add "javaw [Options for JavaVM] -jar " before the .jar path. Add " [Options for the application]" after the path.
- If you need to specify the current directory when it runs, you can write it in "start in" box.
- When you double-click the shortcut, it runs the application with the options.
- The shortcut is free to move, to rename and to change the icon. I recommend it to rename it to the application name (eg. "JOSM" without "shortcut to"), and to move it to under the "start menu".
Mac OS X
Mac OS 10.4 以上が必要です。10.3では、できません。10.4.xと10.5.xでは、単にjar ファイルをダブルクリックすると、Java 1.5が、.jarファイルを実行します。 もっとメモリーを確保したい場合、(大きなファイルを編集するとか、'変なことが起こる'メモリーエラーになったとかで)
- ターミナルを開きます。
- josm-latest.jar が保存されているディレクトリーに移動します。デスクトップなら、'cd Desktop'としてみてください。
- 次のラインをコピーアンドペーストでターミナルに入力し、JOSMを512メガバイトのメモリー確保でスタートさせます。:
java -Xmx512M -jar josm-latest.jar
Include -Dapple.laf.useScreenMenuBar=true to place the menu on the OS X menu bar, and -Xdock:name="JOSM" -Xdock:icon="logo.png" to give it icon and name.
If you're not familiar with scripts just use the Jar Bundler application, coming with MacOS X. It'll create a start application, let's call it "JOSM!". You'll find it here /Developer/Applications/Java Tools/ or here /Developer/Applications/Utilities/. Just double click to launch it. In the first menu build information enter the location of the just downloaded JOSM jar file by clicking the choose... button. In the third menu properties choose the edit box vm options to enter the appropriate memory settings. If you're able to afford it try spending up to a GB RAM to JOSM. Here's what to enter into the edit box: -Xmx512M -XX:MaxPermSize=512M (which starts the JOSM application with 512MB and grants up to 1GB of RAM). Then press create application... to create the start application (call it JOSM!, f.e.). JOSM! does not have to be in the same directory as the jar file. Just save or move JOSM! to your applications folder. Double click JOSM! to start the JOSM aplication.
Linux, FreeBSD, (Mac OS X with a terminal)
Input a command line as the above is the basic. Usually the command line become long. It is better to make a shell script to run for each jars. There are some users make some useful shell scripts.
You can use a shell-script developed by User:Cobra to keep JOSM always up-to-date, start it, and pass files to it.
Or you can use the following simple script to use always the latest Josm Version:
#!/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 http://josm.openstreetmap.de/download/josm-latest.jar dcop "$DCOPREF" close $JAVA_HOME/bin/java -Xmx1024M -DproxyHost=$PROXY -DproxyPort=8080 -jar josm-latest.jar
If you use Ubuntu 8.04 LTS or Debian and install JOSM via package, you will simply use josm.
Ubuntu users have a good tutorial at UbuntuForums.
There are also some tutorial videos. One describes the steps to set up KDE for starting JOSM by clicking on the JAR file. Get the tutorials from one of the mirrors listed at openstreetmap.de.