• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help in setting customised jvm parameters

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I would like to run a java app with modified Xmx value.
When I run the app like this:

C:\j2sdk1.4.2_15\bin\java.exe com.mycomp.main.RunGenerator it's working fine but when I add the Xmx value, like this:

C:\j2sdk1.4.2_15\bin\java.exe �Xmx 500m com.mycomp.main.RunGenerator

I also tried without the space like this:

C:\j2sdk1.4.2_15\bin\java.exe �Xmx500m com.mycomp.main.RunGenerator

But it's throwing: Exception in thread "main" java.lang.NoClassDefFoundError: �Xmx.

Any ideas...?
[ April 21, 2008: Message edited by: Roy Cohen ]
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is some sample output I tried...


D:\>java Simple
Hello World!!!

D:\>java -Xmx500m Simple
Hello World!!!

D:\>java -Xmx 500m Simple
Invalid maximum heap size: -Xmx
Could not create the Java virtual machine.

D:\>


You have to specify -Xmx option without a space in between the size and -Xmx.

Are you sure you have added com.mycomp.main.RunGenerator to your CLASSPATH?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That last one should be correct.

Is your system set up for American English, or some other script? If it's really putting a "%" character in the error message, that's mighty weird.
 
Andrew Carney
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

Actually it's a batch file that I've created.
I thought the problem is not related to classpath issues so I have omitted the complete script.

Here it is in full, be greatful if someone can correct it:

set GENERATOR_HOME=.\\

C:\j2sdk1.4.2_15\bin\java.exe �Xmx500m -classpath %GENERATOR_HOME%\lib\ojdbc14.jar;%GENERATOR_HOME%\lib\activation.jar;%GENERATOR_HOME%\lib\mail.jar;%GENERATOR_HOME%\lib\opencsv-1.8.jar;%GENERATOR_HOME% com.mycomp.main.RunGenerator

(If I remove �Xmx500m it's working but not with this option on).
[ April 21, 2008: Message edited by: Roy Cohen ]
 
Subhash Bhushan C
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I copy and paste your batch file script into my Textpad, I can see that the character '-' in front of Xmx is a special character. But the character in front of classpath seems to be ok.

Just copy the character in front of classpath, and paste it in front of Xmx, and then try.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, that's an "em dash". Never use word processors to edit code!
 
Andrew Carney
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep working indeed, thanks guys .
Now to a differenr question but on the same subject.
Which jvm parameter(s) are you likely to change in case of an OutOfMemory error in your app?
I thought about Xms and Xmx.
[ April 21, 2008: Message edited by: Roy Cohen ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic