Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Memory use in Java

43 sec read

When you run a Java application, there is usually a fixed maximum amount of memory which is available. This is usually 64 megabytes of memory.

So if you run a java program from the command line like this, the program can use a maximum of 64 megabytes of memory (this is the default).

java -jar jpedal.jar

Sometimes, you need more memory. So there is a useful Java option (-Xmx) to increase the maximum memory available. The format is slightly fiddly so best shown with an example which tells Java to use a maximum memory of 128 megabytes instead

java -Xmx128M -jar jpedal.jar

The number value comes straight after the -Xmx flag and then the M tells Java the figure means megabytes (which is the most common setting you would use). The memory needs to be available – if it is not the program will fail to run.

So if you need a little more memory, just add this flag to your Java command.

I was asked to explain memory usage in a (hopefully) non-technical way which led to this short article. If there is anything Java/PDF related which you would explained, please drop us a line and we will try to help.



View PDF files in a web application →

Parse PDF files as HTML →

Display PDF Forms in a web browser →

View PDF Documents in Java Applications →

Rasterize PDF Documents to image →

Read/Write images (including HEIC, JPG and WEBP) →

Convert Image files to PDF Documents →

Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

One Reply to “Memory use in Java”

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2022. All rights reserved.