简体   繁体   中英

exported .jar file runs way slower than in eclipse

I'm making a little game in Java. In eclipse, everything works fine; I get a solid 140 fps. But when I export it to a runnable Jar file, It gets way slower (60 - 70 fps). The weird thing is, that when I open the Jar, and Eclipse is running, it stays at 140 fps; when I close Eclipse, it suddenly drops to 60.

I tried to change the parameters while exporting, nothing worked.

The images for the game are stored in a second folder called 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. 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? If its a texture or similar maybe load it in to memory beforehand.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM