gregchao Active Member Licensed User Longtime User Jul 18, 2021 #1 I am unable to run this code on the MAC. It works fine in Windows. From the documentation, https://www.b4x.com/android/forum/threads/xlutils-creating-ms-word-documents.131732/#content it should work. Any help is welcome. B4X: Copy Dim wd As WordUtils wd.Initialize Dim doc As WordDocument = wd.CreateDocument doc.Append($"[p]Word document with two lines. This is the second line.[/p]"$) Dim f As String = doc.SaveAs(File.DirApp, "1.docx", True)
I am unable to run this code on the MAC. It works fine in Windows. From the documentation, https://www.b4x.com/android/forum/threads/xlutils-creating-ms-word-documents.131732/#content it should work. Any help is welcome. B4X: Copy Dim wd As WordUtils wd.Initialize Dim doc As WordDocument = wd.CreateDocument doc.Append($"[p]Word document with two lines. This is the second line.[/p]"$) Dim f As String = doc.SaveAs(File.DirApp, "1.docx", True)
William Lancee Well-Known Member Licensed User Longtime User Jul 18, 2021 #2 I don't have a Mac, so this is very tentative, but xlutils uses powershell to interact with Excel. I do know that there is a powershell for the Mac, but there may be parameters that are slightly different. https://docs.microsoft.com/en-us/po...-powershell-core-on-macos?view=powershell-7.1 Last edited: Jul 18, 2021 Upvote 0
I don't have a Mac, so this is very tentative, but xlutils uses powershell to interact with Excel. I do know that there is a powershell for the Mac, but there may be parameters that are slightly different. https://docs.microsoft.com/en-us/po...-powershell-core-on-macos?view=powershell-7.1
EnriqueGonzalez Expert Licensed User Longtime User Jul 18, 2021 #3 William Lancee said: ut xlutils uses powershell to interact with Excel. Click to expand... this is incorrect, xlutils uses powershell to create pdfs from word but thats the only part that requieres powershell, the rest is java based apis. gregchao said: it should work. Any help is welcome. Click to expand... what is the error ? or what happens when it fails? Upvote 0
William Lancee said: ut xlutils uses powershell to interact with Excel. Click to expand... this is incorrect, xlutils uses powershell to create pdfs from word but thats the only part that requieres powershell, the rest is java based apis. gregchao said: it should work. Any help is welcome. Click to expand... what is the error ? or what happens when it fails?
gregchao Active Member Licensed User Longtime User Jul 18, 2021 #4 It is very difficult to debug on MAC because you have to run compiled code. I first run the code in windows and it works fine. The code is bare bones too. After the coversion to MAC, no file is created. The program continues to function. Upvote 0
It is very difficult to debug on MAC because you have to run compiled code. I first run the code in windows and it works fine. The code is bare bones too. After the coversion to MAC, no file is created. The program continues to function.
EnriqueGonzalez Expert Licensed User Longtime User Jul 18, 2021 #5 gregchao said: It is very difficult to debug on MAC because you have to run compiled code. Click to expand... no, if you have them on the same lan then use b4j bridge. Remote debugging with B4J-Bridge B4J v1.80 adds support for remote debugging using B4J-Bridge, a tool similar to the beloved B4A-Bridge. The purpose of B4J-Bridge is to allow you to connect the IDE to a remote machine such as a Mac computer or a Raspberry Pi board and to easily debug your app on the remote machine. The... www.b4x.com Upvote 0
gregchao said: It is very difficult to debug on MAC because you have to run compiled code. Click to expand... no, if you have them on the same lan then use b4j bridge. Remote debugging with B4J-Bridge B4J v1.80 adds support for remote debugging using B4J-Bridge, a tool similar to the beloved B4A-Bridge. The purpose of B4J-Bridge is to allow you to connect the IDE to a remote machine such as a Mac computer or a Raspberry Pi board and to easily debug your app on the remote machine. The... www.b4x.com
Erel B4X founder Staff member Licensed User Longtime User Jul 18, 2021 #6 @Enrique Gonzalez R answers are 100% correct. Only wd.PowerShellConvertToPdf and wd.OpenWord will not work on Mac (or Windows if MS Word is not installed). Upvote 0
@Enrique Gonzalez R answers are 100% correct. Only wd.PowerShellConvertToPdf and wd.OpenWord will not work on Mac (or Windows if MS Word is not installed).
gregchao Active Member Licensed User Longtime User Jul 19, 2021 #7 I was able to get some clues through java error code when I try to run on the mac. When I try to run the following code: B4X: Copy Dim wd As WordUtils wd.Initialize Dim doc As WordDocument = wd.CreateDocument 'doc.Append($"[p]Word document with two lines. This is the second line.[/p]"$) Dim ff As String = doc.SaveAs(MainPg.outputpath, MainPg.outputbasename & ".docx", True) I get the following error which seems to indicate that there is a problem with "wd.CreateDocument". Any help would be appreciated. B4X: Copy Diagnostic XML Bean debug log file created: /var/folders/lw/hzlx04kx1430kh11qbh95kcr0000gn/T/xmlbeandebug10945634728781600448.log wordutils._createdocument (java line: -1) java.lang.ExceptionInInitializerError at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLSCHEMA.TypeSystemHolder.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLSCHEMA.TypeSystemHolder.<clinit>(Unknown Source) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLLANG.TypeSystemHolder.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLLANG.TypeSystemHolder.<clinit>(Unknown Source) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLCONFIG.TypeSystemHolder.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLCONFIG.TypeSystemHolder.<clinit>(Unknown Source) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source) at b4j/org.apache.poi.schemas.ooxml.system.ooxml.TypeSystemHolder.<init>(Unknown Source) at b4j/org.apache.poi.schemas.ooxml.system.ooxml.TypeSystemHolder.<clinit>(Unknown Source) at b4j/org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1$Factory.getTypeLoader(Unknown Source) at b4j/org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1$Factory.newInstance(Unknown Source) at b4j/org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentCreate(Unknown Source) at b4j/org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(Unknown Source) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) at java.base/java.lang.reflect.ReflectAccess.newInstance(Unknown Source) at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Unknown Source) at java.base/java.lang.Class.newInstance(Unknown Source) at b4j/anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(Unknown Source) at b4j/b4j.example.wordutils._createdocument(Unknown Source) at b4j/b4j.example.print$ResumableSub_B4xpage_Appear.resume(Unknown Source) at b4j/b4j.example.print._b4xpage_appear(Unknown Source) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source) at b4j/anywheresoftware.b4a.keywords.Common.CallSub4(Unknown Source) at b4j/anywheresoftware.b4a.keywords.Common.access$0(Unknown Source) at b4j/anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Unknown Source) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) Caused by: org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS compiled schema: Could not locate compiled schema resource org/apache/xmlbeans/metadata/system/sXMLTOOLS/index.xsb (org.apache.xmlbeans.metadata.system.sXMLTOOLS.index) - code 0 at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.<init>(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.initFromHeader(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<clinit>(Unknown Source) ... 51 more Upvote 0
I was able to get some clues through java error code when I try to run on the mac. When I try to run the following code: B4X: Copy Dim wd As WordUtils wd.Initialize Dim doc As WordDocument = wd.CreateDocument 'doc.Append($"[p]Word document with two lines. This is the second line.[/p]"$) Dim ff As String = doc.SaveAs(MainPg.outputpath, MainPg.outputbasename & ".docx", True) I get the following error which seems to indicate that there is a problem with "wd.CreateDocument". Any help would be appreciated. B4X: Copy Diagnostic XML Bean debug log file created: /var/folders/lw/hzlx04kx1430kh11qbh95kcr0000gn/T/xmlbeandebug10945634728781600448.log wordutils._createdocument (java line: -1) java.lang.ExceptionInInitializerError at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLSCHEMA.TypeSystemHolder.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLSCHEMA.TypeSystemHolder.<clinit>(Unknown Source) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLLANG.TypeSystemHolder.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLLANG.TypeSystemHolder.<clinit>(Unknown Source) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLCONFIG.TypeSystemHolder.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLCONFIG.TypeSystemHolder.<clinit>(Unknown Source) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source) at b4j/org.apache.poi.schemas.ooxml.system.ooxml.TypeSystemHolder.<init>(Unknown Source) at b4j/org.apache.poi.schemas.ooxml.system.ooxml.TypeSystemHolder.<clinit>(Unknown Source) at b4j/org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1$Factory.getTypeLoader(Unknown Source) at b4j/org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1$Factory.newInstance(Unknown Source) at b4j/org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentCreate(Unknown Source) at b4j/org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(Unknown Source) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) at java.base/java.lang.reflect.ReflectAccess.newInstance(Unknown Source) at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Unknown Source) at java.base/java.lang.Class.newInstance(Unknown Source) at b4j/anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(Unknown Source) at b4j/b4j.example.wordutils._createdocument(Unknown Source) at b4j/b4j.example.print$ResumableSub_B4xpage_Appear.resume(Unknown Source) at b4j/b4j.example.print._b4xpage_appear(Unknown Source) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source) at b4j/anywheresoftware.b4a.keywords.Common.CallSub4(Unknown Source) at b4j/anywheresoftware.b4a.keywords.Common.access$0(Unknown Source) at b4j/anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Unknown Source) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) Caused by: org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS compiled schema: Could not locate compiled schema resource org/apache/xmlbeans/metadata/system/sXMLTOOLS/index.xsb (org.apache.xmlbeans.metadata.system.sXMLTOOLS.index) - code 0 at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.<init>(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.initFromHeader(Unknown Source) at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<init>(Unknown Source) at b4j/org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<clinit>(Unknown Source) ... 51 more
Erel B4X founder Staff member Licensed User Longtime User Jul 19, 2021 #8 Does it happen when you run from the IDE? Or when it is packaged? Upvote 0
gregchao Active Member Licensed User Longtime User Jul 19, 2021 #9 I actually tried two ways: 1. I tried to get b4j-bridge working. I put jdk-14.0.2.jdk in /libray/java/javaVirtualMachine but I did not know what to do with javafx folders. I tried putting the javafx folders in the same directory. I got the b4j-bridge working but when I ran my program, I got the error: Error: JavaFX runtime components are missing, and are required to run this application At that point, I abandoned that approach. 2. Next, I tried using the MacSigner. The error code was generated after I hit the "Link" button and running it using "run.command" Upvote 0
I actually tried two ways: 1. I tried to get b4j-bridge working. I put jdk-14.0.2.jdk in /libray/java/javaVirtualMachine but I did not know what to do with javafx folders. I tried putting the javafx folders in the same directory. I got the b4j-bridge working but when I ran my program, I got the error: Error: JavaFX runtime components are missing, and are required to run this application At that point, I abandoned that approach. 2. Next, I tried using the MacSigner. The error code was generated after I hit the "Link" button and running it using "run.command"
EnriqueGonzalez Expert Licensed User Longtime User Jul 19, 2021 #10 gregchao said: e but I did not know what to do with javafx folders Click to expand... you are mixing a lot of stuff and hinders our ability to help you. if you want to use b4j bridge then download the jdk from here: B4JPackager11 - the simplest way to distribute UI apps Better to start with the integrated packager: https://www.b4x.com/android/forum/threads/integrated-b4jpackager11-the-simple-way-to-distribute-standalone-ui-apps.117880/ B4JPackager11 is a B4J non-ui program that builds a package with your app jar and an embedded modularized Java runtime. It... www.b4x.com if you want to do it with the macSigner then follow the instructions here: MacSigner - Building notarized Mac packages It is mostly impossible to run non-notarized and unsigned apps on new versions of Mac. MacSigner tool will help you with the various steps required to convert the app jar to a notarized and signed app package. Requirements Mac computer. Apple developer account ($99 per year). Java The java... www.b4x.com where clearly says what to do with the javafx folder. Upvote 0
gregchao said: e but I did not know what to do with javafx folders Click to expand... you are mixing a lot of stuff and hinders our ability to help you. if you want to use b4j bridge then download the jdk from here: B4JPackager11 - the simplest way to distribute UI apps Better to start with the integrated packager: https://www.b4x.com/android/forum/threads/integrated-b4jpackager11-the-simple-way-to-distribute-standalone-ui-apps.117880/ B4JPackager11 is a B4J non-ui program that builds a package with your app jar and an embedded modularized Java runtime. It... www.b4x.com if you want to do it with the macSigner then follow the instructions here: MacSigner - Building notarized Mac packages It is mostly impossible to run non-notarized and unsigned apps on new versions of Mac. MacSigner tool will help you with the various steps required to convert the app jar to a notarized and signed app package. Requirements Mac computer. Apple developer account ($99 per year). Java The java... www.b4x.com where clearly says what to do with the javafx folder.
gregchao Active Member Licensed User Longtime User Jul 19, 2021 #11 I think I did the MacSigner process correctly and the last post still is valid. I downloaded the jdk from the B4jpackager11 and tried to put it /library/java/javaVirtualMachine but I get the error: "jdk-14.1.1" is damaged and can't be opened. when I try to run java from the terminal. There must be a more complicated process to installing the JDK that I do not know about. Upvote 0
I think I did the MacSigner process correctly and the last post still is valid. I downloaded the jdk from the B4jpackager11 and tried to put it /library/java/javaVirtualMachine but I get the error: "jdk-14.1.1" is damaged and can't be opened. when I try to run java from the terminal. There must be a more complicated process to installing the JDK that I do not know about.
Erel B4X founder Staff member Licensed User Longtime User Jul 20, 2021 #12 You must download Java 14 with its components as explained here: https://www.b4x.com/android/forum/threads/macsigner-building-notarized-mac-packages.130890/#content Upvote 0
You must download Java 14 with its components as explained here: https://www.b4x.com/android/forum/threads/macsigner-building-notarized-mac-packages.130890/#content
gregchao Active Member Licensed User Longtime User Jul 20, 2021 #13 Yea!!! Got B4j-Bridge working on my MAC!!! 1. Installed JDK - Downloaded Java 14 as recommended above. Double clicked on .tar file. Then, moved the three programs to Computer/MAC SSHD/library/java/javaVirtualMachine. This effectively installed JDK on my MAC 2. Ran B4j-bridge - Opened Terminal. "cd" to b4j-bridge.jar location. Ran "java -jar -b4j-bridge.jar" 3. Ran B4j - Connected to bridge in B4j. Ran program. Code to create MS Word is now working great. Erel, Thank you for your patience. Enrique, thank you for suggesting B4j-bridge. Upvote 0
Yea!!! Got B4j-Bridge working on my MAC!!! 1. Installed JDK - Downloaded Java 14 as recommended above. Double clicked on .tar file. Then, moved the three programs to Computer/MAC SSHD/library/java/javaVirtualMachine. This effectively installed JDK on my MAC 2. Ran B4j-bridge - Opened Terminal. "cd" to b4j-bridge.jar location. Ran "java -jar -b4j-bridge.jar" 3. Ran B4j - Connected to bridge in B4j. Ran program. Code to create MS Word is now working great. Erel, Thank you for your patience. Enrique, thank you for suggesting B4j-bridge.