Allocating more VRAM to Javafx Program

1.9k views Asked by At

I am working on a JavaFX program and want to speed up my application. After reading about large images and issues related to them here, I decided to follow the advice there and allocate more VRAM. I am not quite sure how to do this, however, although I have an idea of how to do it I would like specific instructions to do so. The parameter I need to use is Dprism.maxvram=XX. I am using the eclipse IDE and would like to know where in it do I insert the parameter and will the parameter be carried when exporting to a jar file?

2

There are 2 answers

0
Salem On BEST ANSWER

In Eclipse, to change build arguments, go to Run -> Run configurations... and then select Arguments.

Add -Dprism.maxvram=whatever to your VM arguments (not Program arguments, these are the args[] passed to your main method)

This will not carry over to your .JAR file, because parameters must be passed through the command line and are not stored in the file itself.

You could create a batch file to run the JAR for you with your specified arguments, though.

Example batch file:

java -Dprism.maxvram=90M -jar MyJar.jar

Then you'd just have to double click your bat file to run your JAR with 90MB of VRAM.

0
James_D On

The JavaFX deployment guide specifies mechanisms to pass parameters to the JVM on startup. These will work if you launch the application either as a "self-contained application bundle", or if you launch via web start. In short, you can use

<fx:platform javafx="8.0+">
    <fx:property name="prism.maxvram" value="90M"/>
</fx:platform>

in your JavaFX Ant build file, or use the option

-BjvmProperties=prism.maxvram=90M

to the javapackager tool.