如何创建1 GB堆的可执行jar文件 [英] How to create an executable jar file with 1 GB heap

查看:210
本文介绍了如何创建1 GB堆的可执行jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个类,它提供了一个包含系统性能作为输出的文本文件。我想将它作为可执行文件 Jar运行。但是当我运行Jar时,我想将堆增加到1 GB。

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 increase the heap to 1 GB.

如果我们运行这个程序,我可以这样运行:

If we run this program I can do this by running like this:

java -Xms1200m  -Xmx1300m Sample

但是如何使用可执行文件 Jar增加堆空间?当我点击jar时,它必须以1 GB的堆空间执行。

But how can I increase heap space using an executable Jar? When I click on the jar it must execute with a heap space of 1 GB.

推荐答案

 java -Xms1200m -Xmx1300m -jar FILENAME.jar

在jar文件中或在清单是不可能的:

Define this somewhere in the jar File or in the Manifest is not possible:

我可以设置从jar文件运行的Java最大堆大小吗?

这篇关于如何创建1 GB堆的可执行jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆