Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Default JVM flags

Reply
Thread Tools

Default JVM flags

 
 
CD1
Guest
Posts: n/a
 
      06-22-2008
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!
 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      06-22-2008
CD1 wrote:
> 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.

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      06-22-2008
On Sun, 22 Jun 2008 11:10:47 -0700 (PDT), CD1
<(E-Mail Removed)> wrote, quoted or indirectly quoted someone
who said :

>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


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

See http://mindprod.com/project/kicker.html
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
CD1
Guest
Posts: n/a
 
      06-22-2008
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!
 
Reply With Quote
 
Arne Vajhj
Guest
Posts: n/a
 
      06-22-2008
Roedy Green wrote:
> On Sun, 22 Jun 2008 11:10:47 -0700 (PDT), CD1
> <(E-Mail Removed)> wrote, quoted or indirectly quoted someone
> who said :
>> 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

>
> 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
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      06-22-2008
On Sun, 22 Jun 2008 15:58:26 -0400, Arne Vajhj <(E-Mail Removed)>
wrote, quoted or indirectly quoted someone who said :

>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.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      06-22-2008
Wayne wrote:
> Roedy Green wrote:
>> On Sun, 22 Jun 2008 15:58:26 -0400, Arne Vajhøj <(E-Mail Removed)>
>> wrote, quoted or indirectly quoted someone who said :
>>> 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.

>
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Quetion about flags of socket.recv(bufsize, [flags]) Steve Holden Python 0 02-08-2009 04:09 PM
install module with CPAN - how to change default compiler flags? Alex Hunsley Perl Misc 1 04-07-2005 09:45 AM
MS JVM and Sun JVM problem Young-Jin Lee Java 3 01-21-2004 04:25 AM
Different behavior for newStringUTF() for Sun JVM and IBM Jvm Lasse Java 1 01-05-2004 07:49 PM
Re: Handling both MS JVM and Sun JVM Kevin Hooke Java 2 09-02-2003 05:31 AM



Advertisments