| | 16 | Be careful if you run a 64-bit version of Windows, the Java Runtime (update every month) may be installed in 64-bit when visiting the Java website with a 64-bit version of your browser, or in 32-bit otherwise. |
| | 17 | Both Java platforms will coexist on the PC, but by default the file associations will run first the 32-bit version, creating VMs limited to a maximum of 247MB (if your VM size reaches this limit, due to the volume of data loaded, JOSM may become very slow or unresponsive). |
| | 18 | |
| | 19 | But, the JAR extension will only be launched with the 32-bit version of the Java Runtime ("\Program files (x86)\bin" folder, instead of "\Program files\bin" for the 64-bit version) since the v8u66 if both versions are installed. |
| | 20 | |
| | 21 | Visit the www.java.com main site, choose to download java ... and chose the i586 package. You can keep the 64-bit package because it is not installed at the same location than the 32-bit (i586) package. |
| | 22 | |
| | 23 | If only a 64-bit version of Java is installed on a 64-bit version of Windows (and with a Java version higher or equal to the minimum version specified in the JNLP if you use JavaWebStart to download/update and launch JOSM), JOSM will start automatically in a 64-bit Java VM (with more memory available to handle larger volumes of data, and better performance). Otherwise, it will launch in a 32-bit Java VM, unless you add VM parameters to the command line to locate and use the 64-bit version of Java. |
| | 24 | |
| | 25 | But you may also uninstall any 32-bit versions of Java if you don't need applets in a 32-bit browser (the 32-bit version of Java remains useful when using an old 32-bit browser for using applets in web pages, or for 32-bit OSes where this is the only choice available on the web or in standalone usage). |
| | 26 | |
| 63 | | as described here: http://kubasik.net/blog/index.php/2006/06/19/java-sun-150-and-xglcompiz-on-ubuntu/ |
| 64 | | |
| 65 | | '''Blank window on startup''':: |
| 66 | | AWT before JDK7 [http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6574362 doesn't play well] with non-reparenting window managers (i.e. xmonad, awesome, dwm, ratpoison, Ion3, ...), resulting in the main window not being displayed properly on startup. The Awesome Wiki has [http://awesome.naquadah.org/wiki/Problems_with_Java workarounds] for this problem. There is also an [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-SetWMName.html xmonad specific] way of doing the wmname thing. |
| | 68 | as described here: [https://web.archive.org/web/20060718112352/http://kubasik.net/blog/index.php/2006/06/19/java-sun-150-and-xglcompiz-on-ubuntu/ http://kubasik.net/blog/index.php/2006/06/19/java-sun-150-and-xglcompiz-on-ubuntu/] |
| 73 | | 2. If you are running Mountain Lion, you will need to temporarily disable Gatekeeper. Otherwise, you will be unable to open josm and upon launching josm, receive the error message "JOSM.app is damaged and can't be opened. You should move it to the Trash." Disable Gatekeeper by opening System Preferences > Security & Privacy, and setting 'Allow applications downloaded from:' to 'Anywhere'. Once you open the application, you can re-enable gatekeeper, and it appears that JOSM will open again without a problem. See [osmwww:user/drnoble/diary/17636 this] and #7904 for more information. |
| | 75 | 2. If you are running Mountain Lion, you will need to temporarily disable Gatekeeper. Otherwise, you will be unable to open josm and upon launching josm, receive the error message "JOSM.app is damaged and can't be opened. You should move it to the Trash". Disable Gatekeeper by opening System Preferences > Security & Privacy, and setting 'Allow applications downloaded from:' to 'Anywhere'. Once you open the application, you can re-enable gatekeeper, and it appears that JOSM will open again without a problem. See [osmwww:user/drnoble/diary/17636 this] and #7904 for more information. |
| 90 | | * to use additional java options just add them right after "java" |
| 91 | | |
| 92 | | If you for example have experienced the "Out of memory" warning (e.g. trying to load geo-tagged photos to JOSM) you would start JOSM like this: |
| 93 | | {{{ |
| 94 | | #!sh |
| 95 | | java -Xmx256M -jar FOLDER/josm-latest.jar |
| 96 | | }}} |
| 97 | | |
| 98 | | This would allow JOSM to use up to 256 MB of RAM (memory). The java option "-Xmx256M" set's the maximum Java heap size to 265 MB. You are free to replace -Xmx256M by any number appropriate for your system (e.g. -Xmx512M or even -Xmx1024M). |
| 99 | | |
| 100 | | By the way. To get an overview of all Java start options you can type in: |
| 101 | | {{{ |
| 102 | | #!sh |
| 103 | | java -help |
| 104 | | }}} |
| 105 | | |
| 106 | | == Getting the Source == |
| 107 | | JOSM is available under GPL, and so of course you can get the sources and compile, modify or redistribute it by yourself. You can grab the sources via [http://subversion.tigris.org subversion] |
| 108 | | {{{ |
| 109 | | #!sh |
| 110 | | svn co https://josm.openstreetmap.de/svn/trunk josm |
| 111 | | }}} |
| 112 | | Or you can inspect single files over the web frontend at [/svn] (or [/browser]). |
| 113 | | |
| 114 | | == Compiling == |
| 115 | | === Using ant === |
| 116 | | The easiest way to compile JOSM provided Java on your machine is properly set up is to go to the josm directory and type: |
| 117 | | |
| 118 | | {{{ |
| 119 | | #!sh |
| 120 | | ant |
| 121 | | }}} |
| 122 | | |
| 123 | | That will create a `dist/josm-custom.jar` file if successful. |
| 124 | | |
| 125 | | === Using eclipse === |
| 126 | | |
| 127 | | Use eclipse and the provided `.project` and `.classpath` file. Just add a new Java Project using the JOSM source folder as existing path. |
| 128 | | |
| 129 | | As of Eclipse 3.5.2 and the latest JOSM (August 10, 2011), you will have problems compiling, due to problems compiling Mappaint MapCSS with a fresh install of Eclipse. First you will need the [http://www.engr.mun.ca/~theo/JavaCC-FAQ/javacc-faq-moz.htm JavaCC] [http://eclipse-javacc.sourceforge.net/ plugin for Eclipse]. To install it in Eclipse, go to Help->New Software... then add the site [http://eclipse-javacc.sourceforge.net/] as a source, and install the JavaCC Eclipse Plug-in. Then in the Package Explorer, expand org.openstreetmap.josm.gui.mappaint.mapcss, right-click on MapCSSParser.jj, and "Compile with JavaCC". This should put new java files in a package called org.openstreetmap.josm.gui.mappaint.mapcss.parsergen, but if it doesn't, you will have to create the package manually (right-click and create package), then drag the new files into the package you just created (they should be easy to identify based on the light gray text that denotes it was compiled from MapCSSParser.jj). This should resolve any import issues in MapCSSStyleSource.java, and you should now be able to compile JOSM. |
| 130 | | |
| 131 | | If you try to compile the JOSM sources in Eclipse and get errors like "The method marktr(String) is undefined for the type SomeType" look at [https://lists.openstreetmap.org/pipermail/josm-dev/2008-August/001585.html solution suggested at mailing list]. |
| 132 | | |
| 133 | | There are also two Videos available at youtube, which show [https://www.youtube.com/watch?v=-LoWGf-hqiQ how to checkout JOSM into Eclipse] and [https://www.youtube.com/watch?v=Z3OjG3nDvzA how to checkout a JOSM plugin into Eclipse]. |
| 134 | | |
| 135 | | === Using javac === |
| 136 | | |
| 137 | | You can also build josm without ant or eclipse. To do so, call `javac` on the file `org/openstreetmap/josm/gui/MainApplication.java` with all libs from `../lib/*.jar` in your classpath (you have to specify all subsequent). If running Linux, this would look like that: |
| 138 | | |
| 139 | | * Check out the sources |
| 140 | | {{{ |
| 141 | | #!sh |
| 142 | | svn co https://josm.openstreetmap.de/svn/trunk josm |
| 143 | | # ''tons of output here'' |
| 144 | | cd josm/ |
| 145 | | mkdir build |
| 146 | | }}} |
| 147 | | * Compile and run |
| 148 | | {{{ |
| 149 | | #!sh |
| 150 | | javac -cp .:src -d build src/org/openstreetmap/josm/gui/MainApplication.java |
| 151 | | java -cp .:build org.openstreetmap.josm.gui.MainApplication |
| 152 | | }}} |
| 153 | | |
| 154 | | == Unit Tests == |
| 155 | | |
| 156 | | It is most convenient, to run tests from an IDE like Eclipse or Netbeans. There is also an ant task to run all tests (but you cannot rerun individual tests). |
| 157 | | |
| 158 | | === Running Test from Command line === |
| 159 | | |
| 160 | | You can run tests from the command line, as well. Include all libraries in the class path like this: |
| 161 | | {{{ |
| 162 | | #!sh |
| 163 | | export TESTCP=".:test/unit:test/functional:dist/josm-custom.jar:test/lib/fest/fest-assert-1.0.jar:test/lib/fest/MRJToolkitStubs-1.0.jar:test/lib/fest/jcip-annotations-1.0.jar:test/lib/fest/fest-swing-1.1.jar:test/lib/fest/fest-reflect-1.1.jar:test/lib/fest/fest-util-1.0.jar:test/lib/fest/debug-1.0.jar:test/lib/junit/junit-4.11.jar:test/lib/jfcunit.jar:test/lib/unitils-core/ognl-2.6.9.jar:test/lib/unitils-core/commons-lang-2.3.jar:test/lib/unitils-core/unitils-core-3.3.jar:test/lib/unitils-core/commons-logging-1.1.jar:test/lib/unitils-core/commons-collections-3.2.jar" |
| 164 | | }}} |
| 165 | | Then run for example |
| 166 | | {{{ |
| 167 | | #!sh |
| 168 | | javac -cp $TESTCP test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java |
| 169 | | java -cp $TESTCP org.junit.runner.JUnitCore org.openstreetmap.josm.data.projection.ProjectionRefTest |
| 170 | | }}} |