Defining Java Heap Size for All Users on a Windows System

1.8k Views Asked by At

I am relatively new to Java we are running Java 8 JRE Update 211 32bit on Windows 10 PC and Server 2019 and I am trying to define heap size for all users who login to the PCs/Servers.

I know the Java is out of date but the Java has been suggested by Application providers and our network is closed off to the internet and really locked down.

I have done some googling seems like you can define this in the Deployment.properties file (located in C:\Windows\Sun\Java\Deployment) currently I have this:

deployment.javaws.jre.0.args=-xms1024M

deployment.javaws.jre.0.args=-xmx3072M

deployment.javaws.jre.0.args=-xmn512M

I do know that maximum you can define 2GB on 32bit systems.

I am unable to find any Java forums or help on these commands I found some on the internet and tweaked them I wanted to know if these are correct above?

Java Error on Client System

We have been advised from the application side (Cramer) the heap size has doubled and still getting this message.

Edit Added:

Unable to do this from the Java Control Panel as the system tab area is greyed out:

Java Control Panel

Also ran the commands:

javaw -XX:+PrintFlagsFinal | find "MaxHeapSize"

javaw -XX:+PrintFlagsFinal | find "InitialHeapSize"

Found that the Java has not picked up the changes that have been defined in the deployment.properties file:

Java command output

I believe the digits outputted above are in bytes which converting them to MBs doesn't match the values I defined.

2

There are 2 best solutions below

0
S.Mahmood On BEST ANSWER

I have figured it out.

So, first thing I did was remove definitions of heap sizes I added to the deployment.properties file.

I had to create a system variable called:

Variable name: _JAVA_OPTIONS

Variable value: -Xmx512M

Also, had to add to the PATH Variable Java bin folder location:

C:\Program Files (x86)\Java\jre1.8.0_211\bin

Then rebooted the server and when I entered the following command:

javaw -XX:+PrintFlagsFinal | find "MaxHeapSize"

Then I saw the Max Heap size was set to 512MB for all users which is what I was trying to achieve.

I didn't want to start messing about with the initial heap size settings as this was causing a few issues.

Now I can foresee another issue I need to resolve is how to define different Max Heap Sizes for 32bit and 64bit Java's install on one Operation System.

1
Renis1235 On

I am guessing you have the JRE installed in the system through an installer. If this is the case, go to Control Settings and select show small icons:

enter image description here

There you have java settings. Click on it and you will be greeted with a settings window for your JRE. Go to the Java Tab and then click display.

enter image description here

Add on runtime parameters the parameters you need (e.g. -Xmx3072M). You can choose whether you want to do that for the Users or for the whole system (hence the tabs).