[Problem] Java app is not starting up properly

Hello, I have a Java app (NS-USBLoader) that doesn’t fully work.
The app works perfectly fine if I launch it via commands on the console, ex: java -jar nsusbloader.jar

Now, if I create a .desktop entry launching it with the same command, the app will not launch.
I created a bash script to see if it would get launched there, but all I get is:

Jan 19, 2024 7:49:58 PM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @2669b199'
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
	at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.lang.ExceptionInInitializerError
	at nsusbloader.NSLMain.start(NSLMain.java:43)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
	at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
	at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:316)
	... 1 more
Caused by: java.lang.StringIndexOutOfBoundsException: Range [3, 2) out of bounds for length 2
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
	at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4602)
	at java.base/java.lang.String.substring(String.java:2715)
	at java.base/java.lang.String.substring(String.java:2688)
	at nsusbloader.AppPreferences.<init>(AppPreferences.java:35)
	at nsusbloader.AppPreferences.<clinit>(AppPreferences.java:25)
	... 10 more


I asked the developer on github, but he doesn’t know what could be wrong. Is this a Clear Linux issue or Java’s? I’m using the java-basic bundle.

EDIT: The app does work well in X11 (using Wayland here), since I’m not sure this is a Clear Linux specific issue I did not submit it’s github.

Have you tried setting an absolute path for the .jar’s location? unity - java file will not launch from .desktop file - Ubuntu 12.04 LTS - Ask Ubuntu , I made a .desktop file, it seems to be running properly on wayland

i@clr~ $ cat /home/i/.local/share/applications/NS-USBLoader.desktop
[Desktop Entry]
Type=Application
Name=NS-USBLoader
Exec=java -jar /home/i/Downloads/ns-usbloader-7.1.jar
1 Like

Indeed, I tried the latest version and it’s working… it was a problem with the app itself that it didn’t work in the 7.0 version due to a bug in the locales processing, 7.1 does work flawlessly. Thank you for your answer!