When deploying my game in a .jar, it runs fine with no errors on Linux / Mac.
However on Windows, (specifically testing Windows 10 as of yet), I get these errors on launch and then a blank screen in my JFrame:
Exception in thread "PooledThread7" java.lang.IllegalStateException: Buffers have not been created
at sun.awt.windows.WComponentPeer.getBackBuffer(Unknown Source)
at java.awt.Component$FlipBufferStrategy.getBackBuffer(Unknown Source)
at java.awt.Component$FlipBufferStrategy.flip(Unknown Source)
at java.awt.Component$FlipBufferStrategy.show(Unknown Source)
at engine.Game$Render.render(Game.java:250)
at engine.Game$Render.run(Game.java:167)
at engine.PooledThread.run(ThreadPool.java:89)
and
java.io.FileNotFoundException: res\maps\map.txt (The system cannot find the path specified)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileWriter.<init>(Unknown Source)
at engine.testMapCreator.init(testMapCreator.java:69)
at engine.Game.init(Game.java:126)
at engine.Game.main(Game.java:80)
So it appears Windows is not liking my thread pool rendering, and for some reason while it finds the map files inside a .jar on Linux, it does not find them when on Windows.
... So much for "Write once, Run anywhere", right? What could be the problems?
edit: This is how I am reading the map.txt files:
InputStream is = Game.class.getResourceAsStream("/map.txt")
Scanner scanner = new Scanner(is);
(for loops to iterate over the data)
For the first error probably adding -Dsun.java2d.d3d=false
to the command line will help (disable usage of Direct3D for 2D rendering). Eg:
java -Dsun.java2d.d3d=false -jar some.jar
As for the second one, we would need to see how you write the files (FileWriter is mentioned), it might be eg that you don't have res\\maps
directory.
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.