由于自定义启动器而无法访问 VM 参数,因此设置 Java 应用程序的虚拟机最大内存?

发布于 2024-08-30 04:19:57 字数 571 浏览 9 评论 0原文

我正在使用一个 Java 应用程序,它允许您导入自定义文件。导入时,这些文件将加载到内存中。

问题是我要导入的文件非常大,这会导致 OutOfMemory 异常。崩溃日志还告诉我,VM 是使用 java 参数“-Xmx512m”启动的,我想将其更改为“-Xmx1024m”,以便获得双倍的可用内存。

问题是这个应用程序正在使用它自己的 JRE 文件夹,并且有一个用 C 编写的启动器正在调用 jvm.dll 文件。无论如何,java.exe 或 javaw.exe 永远不会被调用,因此我无法自己设置这些参数(如果我删除这些可执行文件也没关系,仍然可以运行应用程序 - dll 则不是这种情况)。

所以,我的问题是,我可以用其他方式设置这个虚拟机参数吗?如果没有其他办法,我什至愿意更改 JRE 文件。

更新:发现一些额外信息:

jvm_args:-Djava.system.class.loader=com.company.loader.NativeClassLoader -Xmx160m -Xms160m -Xincgc

java_command:未知

启动器类型:通用

I'm using a Java application which allows you to import custom files. On import, these files are loaded into memory.

The problem is that the files I want to import are very big, this causes an OutOfMemory exception. The crash log also informs me that the VM was started with the java parameter "-Xmx512m", I want to alter this to "-Xmx1024m" so that I got double the memory available.

The problem is that this application is using it's own JRE folder and that there's a launcher written in C which is calling the jvm.dll file. In any way, java.exe or javaw.exe are never called and thus I cannot set these parameters myself (if I delete these executables it doesn't matter, can still run the application - this is not the case with the dll).

So, my question is, can I set this VM parameter in an other way? I'm even willing to alter the JRE files if there is no other way.

Update: Found some extra info:

jvm_args: -Djava.system.class.loader=com.company.loader.NativeClassLoader -Xmx160m -Xms160m -Xincgc

java_command: unknown

Launcher Type: generic

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江南烟雨〆相思醉 2024-09-06 04:19:57

您最好尝试使用标准 JVM 来消除启动器。看看您是否能弄清楚 Java 是用什么参数启动的——它可能有助于转储启动器和任何相关的配置文件。

然后你自己调用java就可以了。

这可能根本不起作用,具体取决于启动器正在执行的其他操作。

编辑:

尝试:

java -Djava.system.class.loader=com.company.loader.NativeClassLoader -Xmx160m -Xms160m -Xincgc

从命令行针对真实的 JVM。由于 NativeClassLoader 或 java 加载器设置的其他内容,它很可能会失败。

另外,您可能会丢失它尝试启动的实际 java 类(我不知道“NativeClassLoader”是否需要实际的主类)。

在不了解更多关于 C 类加载器的情况下,我不知道是否有人可以帮助你。也许您可以联系供应商?您可以转储 .exe 文件并查看是否有任何识别文本 - 如果您能找出它的来源,您也许能够找到其中的文档,告诉您如何将参数转发到 JVM

You would probably be better off attempting to eliminate the launcher use a standard JVM. See if you can figure out what parameters Java is being launched with--it might help to dump the launcher and any associated configuration files.

Then you just call java yourself.

This may not work at all depending on what else the launcher is doing.

edit:

try:

java -Djava.system.class.loader=com.company.loader.NativeClassLoader -Xmx160m -Xms160m -Xincgc

from the command line against a real JVM. There is a good chance it will fail because of the NativeClassLoader or other stuff set up by the java loader.

Also you may be missing the actual java class it is trying to start (I don't know if that "NativeClassLoader" needs the actual main class or not).

Without knowing more about the C class loader, I don't know if anyone can help you much. Perhaps you could contact the vendor? You might dump the .exe file and see if there is any identifying text--if you could figure out where it came from, you might be able to find docs on it telling you how to forward parameters to the JVM

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文