Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem in increasing JVM heap size.

Status
Not open for further replies.

cheekooo

Programmer
Jun 30, 2005
5
GB
I am trying to increase the heap size of my jvm.
i am doing it by using "java -Xms10M -Xmx200M". But there seems to be some problem. the jvm is prompting me with Usage: java option. but i think i am using the command correctly. I have tried different memory sizes but its not working .
Is there any way i can check how much heap is currently allocated to my JVM. I dont have jdk installation.
i am appending the command results. please help.


C:\Program Files\Java\j2re1.4.2_07\bin>java -Xms10M -Xms20M
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
 
Well you need to give it a class to execute :

java -Xms10M -Xms20M SomeClass

The default size is 16Mb - you'd be silly to give it any smaller (as in your example).


--------------------------------------------------
Free Database Connection Pooling Software
 
I am using an application known as ImageViewer which opens .tiff document when a user clicks on the image. But this application is not opening the page instead i am getting java.lang.OutOfMemoryError in java console. When i googled it i found out that i have to increase the size of Heap by using -Xms command so that the application doesnt run out of memory.
1. I have no idea which class name should i give in the command as i have not developed the application. Can some one through some light on it?
2. How can i find out the current size of JVM heap?

Thanks a lot for ur time.
 
1) If you don't know the class name then how can we ?! How do you start this application ?

2) As I said before, the default JVM size is 16 Mb ...

--------------------------------------------------
Free Database Connection Pooling Software
 
Now lets consider this senario. I am user and i have a link to a web page. When i go to a web page and click a particular document it gets open in another application (ImageViewer, just like appletviewer ) which uses JVM ( just like applets ). While loading the image the Viewer is throwing an error( which i can see in jave console, the error is java.lang.OutofMemoryError). Now i dont have any idea abt the class name or how the application (Image Viewer) is getting launched.
1. is it still possible to increse the size of the Heap without knowing the class name ?
2. if not, then is there any way i can find out the name of the class by looking into some settings in java console or anywhere else ?

Thanks
 
So its an applet then ? It does help to provide ALL the relevant information if we are to be able to help you ...

If you want to change the size of the JRE when it loads applets :

When an applet is running, there is a "coffee cup" in the system tray. Right click this and open the "Open [Java] Control Panel".
Go to the "Java" tab, and Click on "View" under "Java Applet Runtime Settings", and in the "parameters" text box, add

-Xms64m -Xmx512m

or whatever you wish for the assigned heap.

--------------------------------------------------
Free Database Connection Pooling Software
 
When i click the "Open Control Panel". I see "Java(TM) Plug-in Control Panel" pop up. But i cannot see any java Tab in that.
It has the following tabs:
1. Basic
2. Advanced
3. Browser
4. Proxies
5. Cache
6. Certificates
7. About

please help
 
well just browse around the panel until you see what I am talking about ! Look for "Applet Runtime Settings" ...

--------------------------------------------------
Free Database Connection Pooling Software
 
I searched everywhere but i am not able to find Applet Runtime Settings. But i found a parameters field in Advanced tab. So i changed the setting to -Xms64m -Xmx512m. Now i cannt even see the java console (so that i can reset the settings) and whenever i click the document link both IE and documents window closes. i think i am in trouble :-(
Anyways, thanks a lot for ur time and help. i will try to do something.
In case someone knows then please tell me is there any possible way i can check the current size of my jvm heap?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top