ashish2199 / Aidos

A beginner friendly project with aim of creating our own version of Bomberman.
GNU General Public License v3.0
41 stars 27 forks source link

Java handle os binding #52

Closed Windspar closed 4 years ago

Windspar commented 6 years ago

Tested on Antergos Linux (Arch Linux)

ashish2199 commented 6 years ago

I am unable to run the game now on windows. 👎 Please correct and send a new pull request.

This is cause of problem Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:\C:\Users\Ashish\Documents\NetBeansProjects\Aidos\src\Resources\img\sprites_without_border.png

Executing C:\Users\Ashish\Documents\NetBeansProjects\Aidos\dist\run1052909223\Bomberman.jar using platform C:\Program Files\Java\jdk1.8.0_65\jre/bin/java
Exception in Application start method
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$156(LauncherImpl.java:182)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ExceptionInInitializerError
    at bomberman.scenes.Sandbox.init(Sandbox.java:68)
    at bomberman.scenes.Sandbox.setupScene(Sandbox.java:103)
    at bomberman.Bomberman.start(Bomberman.java:14)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$149(WinApplication.java:191)
    ... 1 more
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:\C:\Users\Ashish\Documents\NetBeansProjects\Aidos\src\Resources\img\sprites_without_border.png
    at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
    at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
    at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
    at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
    at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
    at java.nio.file.Paths.get(Paths.java:84)
    at bomberman.utils.ImageUtils.loadImage(ImageUtils.java:13)
    at bomberman.Renderer.<clinit>(Renderer.java:35)
    ... 12 more
Exception running application bomberman.Bomberman
Java Result: 1
Windspar commented 6 years ago

Sorry . Don't have window os to test it on. But it helping learn how java does it.

Okay. Hopeful this solve it. Using Path.toUri() to get file path.

ashish2199 commented 4 years ago

Closing due to build fail.