简体   繁体   English

导出的.jar文件的运行速度比Eclipse中慢

[英]exported .jar file runs way slower than in eclipse

I'm making a little game in Java. 我正在用Java做一个小游戏。 In eclipse, everything works fine; 在日食中,一切正常。 I get a solid 140 fps. 我得到稳定的140 fps。 But when I export it to a runnable Jar file, It gets way slower (60 - 70 fps). 但是,当我将其导出到可运行的Jar文件时,它会变慢(60-70 fps)。 The weird thing is, that when I open the Jar, and Eclipse is running, it stays at 140 fps; 奇怪的是,当我打开Jar并运行Eclipse时,它保持为140 fps; when I close Eclipse, it suddenly drops to 60. 当我关闭Eclipse时,它突然下降到60。

I tried to change the parameters while exporting, nothing worked. 我试图在导出时更改参数,但没有任何效果。

The images for the game are stored in a second folder called Bilder; 游戏的图像存储在另一个名为Bilder的文件夹中。 I import them like this: 我这样导入它们:

ImageIcon u = new ImageIcon(System.getProperty("user.dir") + "\\Bilder\\b.png");
    background = u.getImage();

Does anyone have an idea? 有人有主意吗?

Sometimes people make the mistake of loading the image in every time you use it. 有时,人们在每次使用图像时都会犯错,即加载图像。 If its a game constantly refreshing a texture this could lead to significant slow down with the HDD access times. 如果它的游戏不断刷新纹理,则可能导致HDD访问时间大大降低。 I was just thinking maybe Eclipse is caching the image and making it run fast, but when its not run in eclipse it takes time? 我只是想也许Eclipse正在缓存图像并使其快速运行,但是当它不在Eclipse中运行时需要时间吗? If its a texture or similar maybe load it in to memory beforehand. 如果纹理或类似纹理可能事先将其加载到内存中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Runnable Jar 文件动画运行速度比在 Eclipse 中慢 - Runnable Jar file animation runs slower than in Eclipse Hadoop MapReduce程序在Eclipse中运行良好,但在导出到.jar文件时却无法正常运行 - Hadoop MapReduce program runs fine in Eclipse but not when exported to .jar file 程序在Eclipse中运行,但是导出的可运行jar文件将无法打开? - Program runs in Eclipse, but exported runnable jar file will not open? 程序在Eclipse中可以正常运行,但是在导出到.jar文件时却不能正常运行 - program runs fine in Eclipse but not when exported to .jar file 应用程序在Eclipse中运行,导出的jar崩溃 - Application runs in Eclipse, exported jar crashes 作为 a.jar 文件的程序比在 eclipse 中运行时慢 5 倍 - Program 5x slower as a .jar file than when ran in eclipse 为什么我的.jar文件运行速度比eclipse中的程序慢? - Why is my .jar file running slower than the program in eclipse? Eclipse 程序运行速度比导出后更快 - Eclipse program runs faster than after it is exported 程序完全在Eclipse中运行,但是当导出为可运行的JAR文件时无法运行 - Program runs completely in Eclipse but does not run when exported as a Runnable JAR file jar中的HTTP连接速度比Eclipse中慢 - Http connections in jar slower than in eclipse
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM