How to assign more memory to JOSM? - again

Morning all,

I’ve once again been told that JOSM needs more than its paltry 256 (257?)mb of memory. Now I asked the same question last year but couldn’t get it to work and in the end JOSM calmed itself down and decided it had enough memory anyway. However the beast once again rear its ugly head.
First things first, I have the .jar version of JOSM and am running Windows 10 64bit. I have also changed the name of JOSM from ‘josm-tester.jar’ to ‘josm.jar’, however the problem existed prior to this as well.

Also I am somewhat hopeless with computers so please assume I know virtually nothing of them! I am able to do certain stuff, but that’s only because I can follow instructions rather than knowing what I’m doing and why. Imagine it like explaining how to build an engine to someone who can drive a car and change the oil.

So far as I can tell one has to do one of two things. First of all you can open the Command Prompt and run this:

java -Xmx1024M -jar C:\Users\Myname\Desktop\Myname\josm.jar

(The file path is correct btw)
Now when I do this the command prompt replies

The second option it seems is to create a .bat or .cmd file in the same folder as josm.jar is kept.

So what I do is right click in that folder>new text document. Put in that document

java -Xmx1024M -jar C:\Users\Myname\Desktop\Myname\josm.jar

and then save it as ‘josm.bat’ (on one attempt) or ‘josm.cmd’ (on the other attempt). In both cases when I click on it in the folder there is a brief flash of the command prompt box on the screen and nothing at all after that. In both instances the .bat and .cmd files seem to be ‘correct’ insofar as they were listed as those file types in the ‘folder details bit’.

What am I doing wrong? Have I put all the things in exactly correctly or something like that?

SOS please send help!
Thanks!

Hi,

I dont know what you do wrong, but I know that my *.bat file works with the latest JOSM version.

Best regards

Ah that does something! However it (cmd) says it cannot find java.exe. I do have Java on my computer however (somewhere, I have no idea where on my c drive the folder containing all the java stuff is since it’s decided to give itself a different name other than Java or Oracle).

Does java.exe want to be in the same folder as josm.jar and the .bat file? or should I put those two in the same folder as java.exe. Would that make a difference?

Right, problem solved I think! I located where Java had put itself and put a copy of java.exe into the folder with josm.jar and the .bat file and it seem to have worked! Thank you for your help!

I guess the problem is simply that Windows cannot find the java.exe, neither in your command line method nor in the batch file method. There should be two simple solutions to it.

  1. add the full path of java.exe to your environment variable. Since I have no clue how you do that on Windows 10, you can wait for someone else to explain or use method 2).

  2. add the full path to the command line or batch file command. So instead of writing

java -Xmx1024M -jar C:\Users\Myname\Desktop\Myname\josm.jar

you write

'C:\Program Files\Java\jre1.8.0_60\bin\java' -Xmx1024M -jar C:\Users\Myname\Desktop\Myname\josm.jar

The

C:\Program Files\Java\jre1.8.0_60\bin\

needs to be replaced by the path on your computer. If you need help with finding it, please ask again.

The other way would be to download josm.jnlp, open this file in a text editor and replace the line

<j2se version="1.7+"/>

by

<j2se version="1.7+" initial-heap-size="256m" max-heap-size="768m"/>

Save and then always start josm by double clicking on the jnlp file. You can adjust the max-heap-size to your needs. The advantage of the jnlp is, that it auto downloads if a new stable version is availible.

This is an old thread but I will post what worked for me so in case someone else is still wanting a way to increase the memory for JOSM.

  1. One needs to have the 64 bit version of Java installed.
    a.) the 32 bit version of Java would not allow more then 1024m memory for JOSM for me.
    2 I ran the following command in CMD java -Xmx9216m -jar “C:\Program Files (x86)\JOSM\josm-tested.jar”
    (I would test the command in cmd to make sure josm has enough memory for you. Change -Xmx9216m to the amount of memory you want in mb. Also change the josm file location as appropriate to the location of your josm file.)
    (If this works then procede to next step.)
  2. I installed JOSM with the windows installer. Therefore I changed the shortcut to josm with the above working command as the target of the shortcut.