RoanH / ImageScaler

Simple but powerful batch image rescaler.
GNU General Public License v3.0
22 stars 0 forks source link

Cannot launch neither exe or jar #2

Closed flleeppyy closed 4 years ago

flleeppyy commented 5 years ago

When running from batch file, since the executeable wasen't working, it threw this error: Exception in thread "main" java.util.ServiceConfigurationError: javax.imageio.spi.ImageReaderSpi: Error reading configuration file at java.util.ServiceLoader.fail(Unknown Source) at java.util.ServiceLoader.parse(Unknown Source) at java.util.ServiceLoader.access$200(Unknown Source) at java.util.ServiceLoader$LazyIterator.hasNextService(Unknown Source) at java.util.ServiceLoader$LazyIterator.hasNext(Unknown Source) at java.util.ServiceLoader$1.hasNext(Unknown Source) at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(Unknown Source) at javax.imageio.spi.IIORegistry.<init>(Unknown Source) at javax.imageio.spi.IIORegistry.getDefaultInstance(Unknown Source) at javax.imageio.ImageIO.<clinit>(Unknown Source) at me.roan.imagescaler.Main.main(Main.java:101) Caused by: java.io.FileNotFoundException: I:\osu (The system cannot find the file specified) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(Unknown Source) at java.util.zip.ZipFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source) at sun.net.www.protocol.jar.URLJarFile.<init>(Unknown Source) at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source) at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source) at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source) at sun.net.www.protocol.jar.JarURLConnection.getInputStream(Unknown Source) at java.net.URL.openStream(Unknown Source) ... 10 more

RoanH commented 5 years ago

Hi, thank you for the bug report.

It looks to me like you ran into a (known) JDK bug #4730642. It is caused by having a folder than ends on a "!" anywhere on the path to the jar or exe. Which for a game called osu! is rather unfortunate.

I once fixed this for a different program by just copying the entire program to the temporary files directory. But I don't really like that 'fix' so if possible I'd like to avoid it. Unfortunately it seems like that bug won't be fixed anytime soon as it's been around since 2002.

The easiest workaround for this problem is by simply moving the jar/exe somewhere where there is not a folder that ends on an exclamation mark on the path.

Besides that I can only think of one solution that might work without having to move the jar/exe in some way. I think I might only be able to make it work for the exe version though...

Anyway, that's the gist of what I think your issue is. Try moving the exe/jar to a path free of exclamation marks. If that doesn't work then I might have to investigate further.

RoanH commented 4 years ago

Somewhat proper handling to at least prevent the chrash will be added to version 2.3. This will also include a work around that in most cases should make it possible to launch the program without moving it.

Unfortunately it seems like that is the best I can do. The code causing this bug is located in a part of Java I don't have any control over even using custom class loaders.

The code for the work around is located here if anyone is interested.