[英]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.