Default JVM flags

C

CD1

Hi!

I always run a Java class which takes a lot of memory, and every time
I have to set the maximum memory to some value. For example:

java -Xmx512m MyClass

How do I set this flag to be the default to all the future invocations
of the JVM? I didn't want to type that every time. I know I can set
the default Swing flags in the file $JDK_HOME/jre/lib/
swing.properties. Is there an equivalent of that file to the JVM (not
Swing related)?

Thanks!
 
D

Daniel Pitts

CD1 said:
Hi!

I always run a Java class which takes a lot of memory, and every time
I have to set the maximum memory to some value. For example:

java -Xmx512m MyClass

How do I set this flag to be the default to all the future invocations
of the JVM? I didn't want to type that every time. I know I can set
the default Swing flags in the file $JDK_HOME/jre/lib/
swing.properties. Is there an equivalent of that file to the JVM (not
Swing related)?

Thanks!
You can create a script file that starts "java" with the appropriate
arguments.
 
C

CD1

Yeah, that's what I'm going to do if nothing else works. I thought
there was an official way of doing that, using a properties file. But
thanks anyway, I'll do it as you said!
 
A

Arne Vajhøj

Roedy said:
one way is to write a kicker, a tiny C program that uses a C-exec to
launch with the default switches you want.

If one want to spend the time to create a program to start
with then it is minimal extra work to actually start the JVM
instead of spawn/exec java.exe !

Arne
 
R

Roedy Green

If one want to spend the time to create a program to start
with then it is minimal extra work to actually start the JVM
instead of spawn/exec java.exe !

You can do it with a bat file, which is a generic sort of kicker, and
somewhat larger than the C kicker would be. The C kicker does nothing
but the EXEC. A shell has the full ability to interpret scripts.

The C kicker has the advantage you can put it in the aux path in the
registry, which you can't do with bat files. See
http://mindprod.com/jgloss/registry.html

If you write a kicker, you can stomp them out like cookies, with theme
and variations for various purposes. My kicker project, originated in
the DOS days, was to make it possible to create them without a C
compiler or programming knowledge.
 
A

Arne Vajhøj

Wayne said:
Didn't there used to be (or is there still) a "jvm.cfg" text file one
could edit for this?

It is still there in 1.6, but can you set Xmx in that ?

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top