Nov 27, 2013 Replies: 24 jFX.ShowExternalDocument method allows you to open external documents with the default installed app. It expects a single parameter which is the document or resource Uri (link). You can use File.GetUri to get the Uri of a local file. For example to open a local PDF document: Code: Copy fx.ShowExternalDocument(File.GetUri("C:\Users\H\Documents", "Document.pdf")) You can also use it with a non-local resource: Code: Copy fx.ShowExternalDocument("http://www.b4x.com") Caveats: - This method doesn't throw any error if the resource cannot be opened. - You cannot use this method with assets files (files added to the Files tab). It will only fail in Release mode when the files are packaged inside the jar. You can use File.Copy to copy it from the assets folder and then open it. This method was added in V1.00 beta 6. Click to expand...
jFX.ShowExternalDocument method allows you to open external documents with the default installed app. It expects a single parameter which is the document or resource Uri (link). You can use File.GetUri to get the Uri of a local file. For example to open a local PDF document: Code: Copy fx.ShowExternalDocument(File.GetUri("C:\Users\H\Documents", "Document.pdf")) You can also use it with a non-local resource: Code: Copy fx.ShowExternalDocument("http://www.b4x.com") Caveats: - This method doesn't throw any error if the resource cannot be opened. - You cannot use this method with assets files (files added to the Files tab). It will only fail in Release mode when the files are packaged inside the jar. You can use File.Copy to copy it from the assets folder and then open it. This method was added in V1.00 beta 6.
merlin2049er Well-Known Member Licensed User Longtime User Dec 5, 2013 #2 Can this be used to open up a folder? I'll give it a try.
Erel B4X founder Staff member Licensed User Longtime User Dec 6, 2013 #3 Yes. It should work: Code: Copy fx.ShowExternalDocument(File.GetUri(File.DirApp, ""))
merlin2049er Well-Known Member Licensed User Longtime User Dec 6, 2013 #4 Oh OK, is there an equivalent way to open a folder in b4a?
merlin2049er Well-Known Member Licensed User Longtime User Dec 8, 2013 #6 OK, I'll worked around it. Last edited: Dec 16, 2013
jmon Well-Known Member Licensed User Longtime User Dec 16, 2013 #7 Hi, I am trying to open set a jpg file to an imageView. The Jpg file is on a server (Windows), but I get an error: Code: Copy java.io.FileNotFoundException: file:\vfx-server-wds\WebServer\intranet\data_users\team1_jo.jpg (The filename, directory name, or volume label syntax is incorrect) This is my code: Code: Copy img.SetImage(fx.LoadImageSample(File.GetUri("//vfx-server-wds/WebServer/intranet/data_users", ""), _ RS.GetString("teams.team_name").ToLowerCase & "_" & RS.GetString("user.nick").ToLowerCase & ".jpg", 32, 32)) The file is there. Can someone help me find what's wrong here?
Hi, I am trying to open set a jpg file to an imageView. The Jpg file is on a server (Windows), but I get an error: Code: Copy java.io.FileNotFoundException: file:\vfx-server-wds\WebServer\intranet\data_users\team1_jo.jpg (The filename, directory name, or volume label syntax is incorrect) This is my code: Code: Copy img.SetImage(fx.LoadImageSample(File.GetUri("//vfx-server-wds/WebServer/intranet/data_users", ""), _ RS.GetString("teams.team_name").ToLowerCase & "_" & RS.GetString("user.nick").ToLowerCase & ".jpg", 32, 32)) The file is there. Can someone help me find what's wrong here?
Erel B4X founder Staff member Licensed User Longtime User Dec 16, 2013 #8 Please start a new thread for this question. It is not related to this thread.
A ashrafidkaidek Member Licensed User Longtime User Apr 4, 2014 #9 when i try: fx.ShowExternalDocument(File.GetUri("C:\Users\H\Documents", "Document.pdf")) I got the error "undeclared variable fx" ... pls let me know how fx should be declared Last edited: Apr 4, 2014
when i try: fx.ShowExternalDocument(File.GetUri("C:\Users\H\Documents", "Document.pdf")) I got the error "undeclared variable fx" ... pls let me know how fx should be declared
Erel B4X founder Staff member Licensed User Longtime User Apr 4, 2014 #10 Is this a UI app? fx is part of the default template. You can declare it yourself if it was deleted with: Code: Copy Dim fx As jFX
Is this a UI app? fx is part of the default template. You can declare it yourself if it was deleted with: Code: Copy Dim fx As jFX
A ashrafidkaidek Member Licensed User Longtime User Apr 5, 2014 #11 Is this supported for B4A V2.7? because it is not working for me!
Erel B4X founder Staff member Licensed User Longtime User Apr 6, 2014 #12 No. Only in B4J. This is B4J sub-forum.
J javiers Active Member Licensed User Longtime User Apr 21, 2014 #13 Hi Erel, is it possible to display a PDF in WebView using this feature?
Erel B4X founder Staff member Licensed User Longtime User Apr 21, 2014 #14 No. You can use it to open pdf documents with the default pdf viewer.
J javiers Active Member Licensed User Longtime User Apr 21, 2014 #15 Erel said: No. You can use it to open pdf documents with the default pdf viewer. Click to expand... Thanks!
Erel said: No. You can use it to open pdf documents with the default pdf viewer. Click to expand... Thanks!
mc73 Well-Known Member Licensed User Longtime User Oct 22, 2014 #16 Tried using this method from inside a non-UI app, with no luck. I get: Code: Copy Program started. java.lang.RuntimeException: java.lang.NoClassDefFoundError: javafx/application/Application at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82) at anywheresoftware.b4a.BA.raiseEvent(BA.java:84) at b4j.example.main.main(main.java:28) Caused by: java.lang.NoClassDefFoundError: javafx/application/Application at anywheresoftware.b4j.objects.JFX.ShowExternalDocument(JFX.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:606) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:227) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Program terminated (StartMessageLoop was not called). at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93) ... 3 more Caused by: java.lang.ClassNotFoundException: javafx.application.Application at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 16 more Is it only for a UI app?
Tried using this method from inside a non-UI app, with no luck. I get: Code: Copy Program started. java.lang.RuntimeException: java.lang.NoClassDefFoundError: javafx/application/Application at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82) at anywheresoftware.b4a.BA.raiseEvent(BA.java:84) at b4j.example.main.main(main.java:28) Caused by: java.lang.NoClassDefFoundError: javafx/application/Application at anywheresoftware.b4j.objects.JFX.ShowExternalDocument(JFX.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:606) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:227) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Program terminated (StartMessageLoop was not called). at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93) ... 3 more Caused by: java.lang.ClassNotFoundException: javafx.application.Application at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 16 more Is it only for a UI app?
Erel B4X founder Staff member Licensed User Longtime User Oct 22, 2014 #17 Yes. You cannot use jFX from a non-UI application. You can use jShell library to start other applications.
Yes. You cannot use jFX from a non-UI application. You can use jShell library to start other applications.
MikeH Well-Known Member Licensed User Longtime User Mar 23, 2015 #18 Erel said: Yes. It should work: Code: Copy fx.ShowExternalDocument(File.GetUri(File.DirApp, "")) Click to expand... Can`t get this to work in OSX but works fine in Windows. I`ve tried different folders, different Macs, no change. Anyone point me in the right direction please?
Erel said: Yes. It should work: Code: Copy fx.ShowExternalDocument(File.GetUri(File.DirApp, "")) Click to expand... Can`t get this to work in OSX but works fine in Windows. I`ve tried different folders, different Macs, no change. Anyone point me in the right direction please?
Erel B4X founder Staff member Licensed User Longtime User Mar 24, 2015 #19 Use jShell and run "open" with the path as a parameter.
Kevin Well-Known Member Licensed User Longtime User Apr 13, 2015 #20 I have made an app in B4J and I got some feedback from someone using Linux and Mac. On Linux (and maybe Mac), trying to open web pages or send emails apparently does not work. This does work on Windows though. Code: Copy fx.ShowExternalDocument("https://mysite.com") fx.ShowExternalDocument("mailto:[email protected]") Apparently the mailto link is opening a blank browser window? She seems pretty tech-savvy so I don't believe it to be something like a lack of default application but I am not 100% sure.
I have made an app in B4J and I got some feedback from someone using Linux and Mac. On Linux (and maybe Mac), trying to open web pages or send emails apparently does not work. This does work on Windows though. Code: Copy fx.ShowExternalDocument("https://mysite.com") fx.ShowExternalDocument("mailto:[email protected]") Apparently the mailto link is opening a blank browser window? She seems pretty tech-savvy so I don't believe it to be something like a lack of default application but I am not 100% sure.