I created a class that gives a text file containing system performance as output. I want to run it as an executable Jar. but when I run the Jar I want to increa
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>PATH_OF_YOUR_JAR</jar>
<outfile>PATH_OF_YOUR_EXE</outfile>
<errTitle></errTitle>
<cmdLine>-log_file=logs\\hp</cmdLine>
<chdir></chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<customProcName>true</customProcName>
<stayAlive>false</stayAlive>
<manifest></manifest>
<icon>PATH_OF_THE_ICON</icon>
<singleInstance>
<mutexName>APPLICATION_NAME</mutexName>
<windowTitle></windowTitle>
</singleInstance>
<jre>
<path>jre-w32\</path>
<minVersion></minVersion>
<maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference>
<initialHeapSize>512</initialHeapSize>
<maxHeapSize>1024</maxHeapSize>
</jre>
</launch4jConfig>
It is a launch4j Config file, here you can specify the heap size as per your requirement.
java -Xms1200m -Xmx1300m -jar FILENAME.jar
Define this somewhere in the jar File or in the Manifest is not possible:
Can I set Java max heap size for running from a jar file?
As already mentioned: it unfortunately is not possible (without creating a wrapper, whether shortcut/script/executable ...).
If you're only running on Windows, I can recommend Launch4J to create an executable wrapper that can apply these settings on execution:
Wrapping it in a executable has other benefits: