Ain't I using java -Xmx500m correctly?

On the command line, when I type 搄ava -version?I get

java version "1.6.0_01"

Java(TM) SE Runtime Environment (build 1.6.0_01-b06)

Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

when I type 搄ava -Xms32m -Xmx128m?or 搄ava -Xms32m -Xmx500m?I get

Usage: java [-options] class [args...]

(to execute a class)

or java [-options] -jar jarfile [args...]

(to execute a jar file)

and I understood the latter to be the way to increase heap space

in order to avoid heap OutOfMemoryError.

What is wrong, why can抰 the JVM take care of this automatically?

I have 2GB of memory in my PC.

[670 byte] By [hillmia] at [2007-11-27 4:10:41]
# 1

By default the JVM initializes itself with a max memory footprint of 64 megs I believe.

a complete command that should be starting something might look like this...

java -Xmx32m -jar InsertTemplates.jar

You aren't just trying to start the JVM without giving it a JAR or .class file are you?

robpaynea at 2007-7-12 9:16:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
I really don't use the command line because I run all my stuff from JCreator IDE which I like. And that takes care of what I do. Thanks so much for your quick reply. I'll try it later today or maybe tomorrow. But it bothers me a little that I didn't see the -Xmx in the options.
hillmia at 2007-7-12 9:16:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
Well I launch pretty all the stuff I'm working ON from Eclipse 99.9% of the time, but some of the tools I use are written in Java as well and can be launched from .sh files or the command line, so its always nice to know how to use it ;)
robpaynea at 2007-7-12 9:16:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4

.sh files, is that unix? I use XP. can't succeed with linux.

Ya, the -Xmx is there one level down in nonstandard options.

I looked into it a bit, and it抯 kind of sad.

I keep all of my Java code for the classes in one directory.

JCreator retrieves all classes except library imports.

JCreator has a create jar file command,

but it wants to put everything in sight into it.

I would have to study how to make jar files easily.

I don抰 really want to use the successfully avoided project method.

It would be ideal for me to change the default heap space.

I find no place to do that in JCreator or anywhere.

hillmia at 2007-7-12 9:16:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 5
How can I increase the default Java Heap space?
hillmia at 2007-7-12 9:16:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 6
One way is to set an [url http://en.wikipedia.org/wiki/Environment_variable]environment variable[/url] to _JAVA_OPTIONS=-Xmx256m as an example.For windows see [url http://support.microsoft.com/default.aspx?scid=kb;en-us;310519]How To Manage Environment Variables in Windows XP[/url]
Caffeine0001a at 2007-7-12 9:16:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 7
Thanks for the response. I did what it said and found out that for Windows, you need to know three items: the variable name and the value you are going to assign, and whether it is a user variable or a system variable. I don't know the variable name, or the type.
hillmia at 2007-7-12 9:16:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 8
variable name: _JAVA_OPTIONSvalue: -Xmx256m Of course the value can be any vm options you want for the default.system variables are for all users.user variables is only for the current user.
Caffeine0001a at 2007-7-12 9:16:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...