B4J Question Ubuntu Linux error when trying to show file location

Nokia

Active Member
Licensed User
Longtime User
I am getting an error when on linux when I try to launch this code from my app.

B4X:
fx.ShowExternalDocument(File.GetUri(strDecDirLoc, ""))

error:
java.lang.ClassNotFoundException: com.sun.deploy.uitoolkit.impl.fx.HostServicesFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.sun.javafx.application.HostServicesDelegate.lambda$getInstance$0(HostServicesDelegate.java:52)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.HostServicesDelegate.getInstance(HostServicesDelegate.java:45)
at javafx.application.HostServices.<init>(HostServices.java:52)
at javafx.application.Application.getHostServices(Application.java:334)
at anywheresoftware.b4j.objects.JFX.ShowExternalDocument(JFX.java:84)
at b4j.example.main._miveiwdec_action(main.java:1325)
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:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.BA$2.run(BA.java:165)
at com.sun.javafx.application.PlatformImpl.lambda$null$117(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$118(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$null$450(GtkApplication.java:139)
at java.lang.Thread.run(Thread.java:745)
main._miveiwdec_action (java line: 1325)
java.lang.NullPointerException
at javafx.application.HostServices.showDocument(HostServices.java:127)
at anywheresoftware.b4j.objects.JFX.ShowExternalDocument(JFX.java:84)
at b4j.example.main._miveiwdec_action(main.java:1325)
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:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.BA$2.run(BA.java:165)
at com.sun.javafx.application.PlatformImpl.lambda$null$117(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$118(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$null$450(GtkApplication.java:139)
at java.lang.Thread.run(Thread.java:745)

any body have any ideas?

also with this work on Mac OS X as well...
 

Nokia

Active Member
Licensed User
Longtime User
Are you using OpenJDK? Can you test it with Oracle JRE?

yes I am using openJDK.

do I have to uninstall openJDK in order to user Oracle JRE?

I am kinda new to linux, do you have a good link to instructions for installing Oracle JRE?
 
Upvote 0

Nokia

Active Member
Licensed User
Longtime User
Upvote 0

billzhan

Active Member
Licensed User
Longtime User
nohup path_to_java/bin/java -jar somejar.jar > nohup.out &

You need to specify the full path to the unpacked java.
B4X:
cd /path/to/{somejar.jar}  # make sure the File.dirapp is the Objects folder
nohup  /home/{yourname}/{JRE-8u102}/bin/java -jar {somejar.jar} > nohup.out &
 
Upvote 0

Nokia

Active Member
Licensed User
Longtime User
You need to specify the full path to the unpacked java.
B4X:
cd /path/to/{somejar.jar}  # make sure the File.dirapp is the Objects folder
nohup  /home/{yourname}/{JRE-8u102}/bin/java -jar {somejar.jar} > nohup.out &

I home I am under standing and this right..

is this the command:

B4X:
 cd /home/nokia/Desktop/ nohup /home/nokia/jre1.8.0.102/bin/java -jar  myjarfile.jar > nohup.out &

nothign happens.. if I take the & of the end it just changed dir..
 
Upvote 0

Nokia

Active Member
Licensed User
Longtime User
I home I am under standing and this right..

is this the command:

B4X:
 cd /home/nokia/Desktop/ nohup /home/nokia/jre1.8.0.102/bin/java -jar  myjarfile.jar > nohup.out &

nothign happens.. if I take the & of the end it just changed dir..


ok.. I got it to work and not going to test the

B4X:
 fx.ShowExternalDocument(File.GetUri(strDecDirLoc, ""))
 
Upvote 0

Nokia

Active Member
Licensed User
Longtime User
ok.. I got it to work and not going to test the

B4X:
 fx.ShowExternalDocument(File.GetUri(strDecDirLoc, ""))

ok.. it seems to work but how ever.. it opens firefox and not any kind of file explorer.. any other ideas?
 
Upvote 0

Nokia

Active Member
Licensed User
Longtime User
You can use jShell instead and start whichever program you like.

I am having a hard time trying to get the jshell to open an app on linux, do you have an example on how to put the parameters?
 
Upvote 0
Top