On my macOS Catalina I am having trouble connecting to the office executable. Currently I am trying to run the SWriter.java example from the SDK in Netbeans.
When I run the command: % make SWriter.run … from the directory of the examples in the SDK it works. It opens a document and performs some text manipulations.
But when I create a project in the Netbeans IDE with just the SWriter.java class and try to run it, I get the error that it can not find the office executable.
Recently I have read online that there are maybe some more security settings on the Apple macOS Catalina but they weren’t clear about what they would be.
Questions:
- Is somebody successfully programming
LibreOffice in a graphical Java IDE
on macOS Catalina like Netbeans, Eclipse or
maybe Xcode? - Are you aware of
additional settings to be made
concerning the use of a graphical
Java IDE and security on macOS Catalina? - And do you maybe know why my Java
program is not connecting to the
office executable?
Explanation:
In one Terminal window I start LibreOffice with the following command:
% /Applications/LibreOffice.app/Contents/MacOS/soffice --accept="socket,host=127.0.0.1,port=8100;urp;StarOffice.ServiceManager"
In another window I see the port 8100 is available:
% netstat -na | grep -i 8100
tcp4 0 0 127.0.0.1.8100 *.* LISTEN
Then I run the example SWriter.java from the command line:
% make SWriter.run
"/Library/Java/JavaVirtualMachines/openjdk-14.jdk/Contents/Home/bin/java" -Dcom.sun.star.lib.loader.unopath="/Applications/LibreOffice.app/Contents/MacOS" -jar /Users/<user>/LibreOffice6.4_SDK/MACOSXexample.out/class/JavaTextExamples/SWriter.jar
Connected to a running office ...
Opening an empty Writer document
Inserting a text table
Write text in the table headers
Insert something in the text table
Inserting colored Text
Insert the text frame
done
Then I wanted to start the Netbeans IDE… I used a Terminal window where I sourced the SDK environment first:
% source .bash_profile
************************************************************************
*
* SDK environment is prepared for MacOSX
*
* SDK = /Users/<user>/Downloads/LibreOffice6.4_SDK
* Office = /Applications/LibreOffice.app
* Make = /usr/bin
* Zip = /usr/bin
* cat = /bin
* sed = /usr/bin
* C++ Compiler = /usr/bin
* Java = /Library/Java/JavaVirtualMachines/openjdk-14.jdk/Contents/Home
* SDK Output directory = /Users/<user>/LibreOffice6.4_SDK
* Auto deployment = YES
*
************************************************************************
Following I started the Netbeans IDE application from the same command line:
% open -a "/Applications/NetBeans/NetBeans 11.app"
Once in this Netbeans environment I created a new project with the libraries of: /Applications/LibreOffice.app/Contents/Resources/java which for instance contains the unoil.jar and created a copy of the SWriter.java class inside the project.
When I run it I get the following error:
run:
com.sun.star.comp.helper.BootstrapException: no office executable found!
at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:338)
at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:302)
at javaapplication2libreoffice.JavaApplication2libreoffice.main(JavaApplication2libreoffice.java:29)
/Users/<user>/Library/Caches/NetBeans/11.0/executor-snippets/run.xml:111: The following error occurred while executing this line:
/Users/<user>/Library/Caches/NetBeans/11.0/executor-snippets/run.xml:68: Java returned: 1
BUILD FAILED (total time: 1 second)
Please any help would be much appreciated.