NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I have just purchased a new computer with windows 7 and 4GByte RAM.

I have installed java.jar version 6 (as directed by osm-instructions!

I have installed josm-latest.jar to C:osm\

josm-latest.jar starts and runs without any problem: i.e. as expected!

I have created a batch file josm.bat in C:osm to invoke the Xmx option but it does not work and I cannot figure out why.

alt text

Whats wrong? For any advice I will be very grateful

asked 19 Jan '12, 17:19

dcp's gravatar image

dcp
721374456
accept rate: 0%

What is the output when you type "java -version" ?

Do you have Win7 and Java as 32bit or 64bit version?

(19 Jan '12, 17:24) stephan75

java -version does not pass the version but replies with the same text as above i.e. `java´ is not recognised.......... I don't know how to determine whether I have 32bit or 64bit versions. I am still looking. It seems that my batch file can´t find java. I just don´t know!

(19 Jan '12, 17:56) dcp

I am using this: start java.exe -Xmx1024M -jar josm-%downloadFileVersion%.jar and it works.
Your problem might be that java directory is not in PATH (try writng set PATH). Add it to PATH or use full path for java (C:Program Files...java.exe).

The whole starting script:

@echo off
rem default settings

set downloadFileVersion=tested
set runTracerServer=true

rem read parameters
:Loop
IF "%1"=="" GOTO Continue

    echo %1
    GOTO %1

    :/latest
        set downloadFileVersion=latest
        goto :END_SWITCH

    :/noupdate
        goto runapps

    :/notracer
    set runTracerServer=false
        goto :END_SWITCH

    :/help
        echo:JOSM starter script
        echo:starts JOSM tested or latest version, updates the program if needed. 
        echo:keeps all settings in the directory from where it was started
        echo:run [/latest] [/notracer] [/help] [/noupdate]
        echo:    /latest    runs latest version instead of tested
        echo:    /notracer  does not run tracer server
        echo:    /help  displays this help
        echo:    /noupdate  does not run update, any parameters after this one are ignored
        goto end

    :/?
    goto /help

    :-?
        goto /help

    :-help
        goto /help

    GOTO END_SWITCH
    :END_SWITCH
SHIFT
GOTO Loop
:Continue

echo:Setting up settings + plugin location
set APPDATA=appdata
echo:set to %APPDATA%

echo:Determining actual %downloadFileVersion% version number (server)
curl http://josm.openstreetmap.de/%downloadFileVersion% -verbose -o %downloadFileVersion%.txt
set /p serverVersion=<%downloadFileVersion%.txt

echo:Determining current version
java.exe -Xmx1024M -jar josm-%downloadFileVersion%.jar -? | findstr /C:"Revision" > current.txt
set /p temp=<current.txt
set currentVersion=%temp:~10,4%

echo Server %downloadFileVersion%: %serverVersion%
echo Local %downloadFileVersion%: %currentVersion%

set /a diffVersion=serverVersion-currentVersion
echo Difference: %diffVersion%

if %diffVersion% == 0 (
    echo:JOSM is up to date 
    goto runapps
) else (
    echo:Update or downgrade needed
)

echo:Downloading latest version
rem Download to temporary file, then copy and remove - to prevent file corruption when download fails
curl http://josm.openstreetmap.de/download/josm-%downloadFileVersion%.jar -o josm-%downloadFileVersion%-download.jar
rem todo - check download success
move /Y josm-%downloadFileVersion%-download.jar josm-%downloadFileVersion%.jar
del josm-%downloadFileVersion%-download.jar

:runapps

echo:Starting JOSM 
start java.exe -Xmx1024M -jar josm-%downloadFileVersion%.jar

if %runTracerServer% == true (
    echo:Starting tracer server
    start TracerServer\bin\Osm.Kn.Trace.Server.exe
)

rem pause

rem Delete temporary files
del %downloadFileVersion%.txt
del current.txt

:end
permanent link

answered 19 Jan '12, 17:32

LM_1's gravatar image

LM_1
3.3k335188
accept rate: 10%

edited 19 Jan '12, 17:40

Wow! This is a above my level of competance!

I can´t even figure out what this batch file will do!

(19 Jan '12, 17:58) dcp

It downloads (updates) the latest or tested version if it there is one available and starts JOSM. Plus it starts tracer server, but that is really useful only in the Czech Republic.

(20 Jan '12, 10:20) LM_1

LM_1 has provided an interesting, if lengthy batch file. Mine, on 64 bit Windows 7, simply reads:

C:\Windows\SysWOW64\java -Xmx1500m -jar C:\Users\Ed\Downloads\JOSM\josm-latest.jar

Which I think is "using the full path" as he suggested:

permanent link

answered 19 Jan '12, 17:44

EdLoach's gravatar image

EdLoach ♦
19.5k16156280
accept rate: 22%

Are you suggesting that my batch-file should be moved to to:

C:WindowsSysWOW64\

(19 Jan '12, 18:06) dcp
1

No. When you run the command java it will look for the file java.exe or java.bat in the current directory and then in the list of directories in the PATH variable. If it can not find the file it will print an error message.

If you run the command C:WindowsSysWOW64java it will look for the file in *C:WindowsSysWOW64*.

LM_1 is sugesting that you run start java whitch uses a different PATH, while EdLoach sugests that you use the full path. It does not matter where the batch file is located.

(Moving the batch file to *C:WindowsSysWOW64* would fix the problem.)

(19 Jan '12, 20:30) Gnonthgol ♦

I changed my josm.bat file to : C:WindowsSysWOW64java -Xmx1024m -jar C:osmjosm-latest

This is what was returned: Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine

I then reduced the -Xmx requirements to 512 and this functioned.

But this begs the question: Why, if I buy a new computer with 6GByte of RAM, can`t I get more than 512MByte allocated. -Xmx1024m functioned on my old computer with 2GByte of RAM. Could it be that my RAM is defect?

(20 Jan '12, 06:44) dcp

There is a YouTube tutorial video of CMD and Java,

link

i hope it helps you...

permanent link

answered 21 May '12, 12:46

nadi106's gravatar image

nadi106
-1112
accept rate: 0%

That covers sticking Java in the path (which was the original problem) but doesn't cover 32- vs 64-bit stuff though - have a look here for a question on that and here for more detailed information.

A stackoverflow question about the "heap" message (unfortunately without an answer to the "but I have 6Gb" issue) is here.

(21 May '12, 13:23) SomeoneElse ♦

In answer to this question:

'But this begs the question: Why, if I buy a new computer with 6GByte of RAM, can`t I get more than 512MByte allocated. -Xmx1024m functioned on my old computer with 2GByte of RAM. Could it be that my RAM is defect?'

I suspect that you need to use the 64-bit Java.exe not the 32-bit one. On my (Windows 7, 4Gb) PC 32-bit Java fails to start JOSM with 1.4Gb max allocated, but 64-bit Java has not problem with 3Gb.

Your 32-bit version of Java is probably installed in somewhere like:

"c:\Program Files (x86)\Java\jdk1.6.0_32\bin\"
(also available via) "c:\windows\syswow64\"

Your 64-bit version of Java is probably installed in somewhere like:

"C:\Program Files\Java\jre6\bin\"

Try using that to start JOSM instead.

permanent link

answered 21 May '12, 13:41

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866
accept rate: 16%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×622
×76
×12
×1

question asked: 19 Jan '12, 17:19

question was seen: 13,205 times

last updated: 21 May '12, 13:41

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum