[Solved] Establish a Link Between LibreOffice/ java program

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
Kouen
Posts: 7
Joined: Sat May 02, 2020 7:29 pm

[Solved] Establish a Link Between LibreOffice/ java program

Post by Kouen »

Hello!, this is my first post, I am A newbie in development upon Libreoffice / Open Office, I am a follower of the projects LibreOffice and Open Office since 2015, i have found that it is a very versatile software in which anyone could build on top of it. I don´t know the mechanics of the forum because i am new to it too (i made a mistake by not reading properly the survival guide. i have done so this time, sorry for my rush, and if i annoyed someone).
Let me rephrase my post:
I am looking forward to establish a connection between Libreoffice and an external java program.
The steps i Followed just in case it helps someone to avoid my mistakes:
Installed Java x86 on a x64 machine
Installed NetBeans as an IDE
Installed LibreOffice x 86 (Path without spaces just in case)
Installed SDK (Path without spaces just in case)
ran Setenvironmentvariable batch file from SDK folder
Added Libraries (CLASSes juh, jurt, ridl and so on according to the developer manual) to the project
Set the path to CLASS_PATH environment variable
https://docs.oracle.com/javase/6/docs/t ... asses.html
https://docs.oracle.com/javase/6/docs/t ... spath.html
set the UNO_PATH environment variables. It should be pointing to the LO \program\classes or the loader in sdk\classes\com\sun\star\lib\loader?
EDIT:SOLVED https://ws024.juntadeandalucia.es/ae/descargar/4318
set multiple OO variables according to the manual of development guide System Variables
Ran Netbeans and installed the plugin for open office
set the main class as the loader (Libraries are there)
// Set netbeans default options ----> -Dcom.sun.star.lib.loader.unopath="C:\LibreOffice\program"
opened the swriter.java located on the SDK
It seems that the problem would be related to a missing class or a wrong path.
so far i have set system wide variables that store:
CLASSPATH [LO\program\classes]
Netbeans_default_options [-Dcom.sun.star.lib.loader.unopath="C:\LO\program"]
OFFICE_HOME [LO root folder]
OO_SDK_CAT_HOME [mingwfolderforcat]
OO_SDK_CPP_HOME[mingwfolderforcpp]
OO_SDK_HOME [LO\sdk] (SDK) root folder
OO_SDK_JAVA_HOME [JDK Root Folder]
OO_SDK_MAKE_HOME[mingwfolderformake]
OO_SDK_NAME [SDK root folder]
OO_SDK_SED_HOME[mingwfolderforsed]
OO_SDK_URE_JAVA_DIR [LO\program\classes]
OO_SDK_ZIP_HOME [mingwfolderforzip]
PATH[javajre\bin;javajdk\bin;LO\program\classes;LO\LOsdkfolder\cli]
UNO_PATH [LO\program]
but i am unable to make it work. Any help will be really appreciated.
Thanks in advance for any help.
Kind regards.
Kouen.
Testing some changes on my system. I will post as soon as i restart my machine.
Is there a way to Inject a flag Named Enable_JAVA in the netbeans compiler? i am looking at the source code of LO, or it is just i am missing the shot?
PS: Please excuse my english, bad english. My native language is Spanish Bad Spanish :D

EDIT: Mild Success, If i run the java program with shift f6 it works. But if i run the solution F6, it doesnt work!
Last edited by robleyd on Fri May 15, 2020 3:55 am, edited 6 times in total.
LibreOfFice 6.3.6 on Windows 10
Kouen
Posts: 7
Joined: Sat May 02, 2020 7:29 pm

Re: Trying to Establish a LInk Between Libreoffice and a jav

Post by Kouen »

I have started an apache OpenOffice new project.
selected apache open office client application.
setted my main class to the loader "com.sun.star.lib.loader.Loader"
ran it and says:

ant -f D:\\Example\\java2\\OfficeUNOClientApp -Dnb.internal.action.name=run run
init:
deps-jar:
Created dir: D:\Example\java2\OfficeUNOClientApp\build
Updating property file: D:\Example\java2\OfficeUNOClientApp\build\built-jar.properties
Created dir: D:\Example\java2\OfficeUNOClientApp\build\classes
Created dir: D:\Example\java2\OfficeUNOClientApp\build\empty
Created dir: D:\Example\java2\OfficeUNOClientApp\build\generated-sources\ap-source-output
Compiling 5 source files to D:\Example\java2\OfficeUNOClientApp\build\classes
warning: [options] bootstrap class path not set in conjunction with -source 1.6
Note: D:\Example\java2\OfficeUNOClientApp\src\com\sun\star\lib\loader\Loader.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
compile:
run:
com.sun.star.lib.loader.Loader::getCustomLoader: cannot add UNO jar files: java.lang.ClassNotFoundException: com.sun.star.comp.helper.UnoInfo
BUILD SUCCESSFUL (total time: 2 seconds)
LibreOfFice 6.3.6 on Windows 10
Kouen
Posts: 7
Joined: Sat May 02, 2020 7:29 pm

Re: Trying to Establish a LInk Between Libreoffice and a jav

Post by Kouen »

I initialized t to run a batch file
soffice.exe --accept=socket,host=localhost,port=1333;urp;
and then it brings me another error
ant -f D:\\Example\\java2\\OfficeUNOClientApp -Dnb.internal.action.name=run run
init:
Deleting: D:\Example\java2\OfficeUNOClientApp\build\built-jar.properties
deps-jar:
Updating property file: D:\Example\java2\OfficeUNOClientApp\build\built-jar.properties
compile:
run:
com.sun.star.lib.loader.Loader::getCustomLoader: cannot add UNO jar files: java.lang.ClassNotFoundException: com.sun.star.comp.helper.UnoInfo
BUILD SUCCESSFUL (total time: 0 seconds)
LibreOfFice 6.3.6 on Windows 10
Kouen
Posts: 7
Joined: Sat May 02, 2020 7:29 pm

Re: Trying to Establish a LInk Between Libreoffice and a jav

Post by Kouen »

LibreOfFice 6.3.6 on Windows 10
Kouen
Posts: 7
Joined: Sat May 02, 2020 7:29 pm

Re: Trying to Establish a LInk Between Libreoffice and a jav

Post by Kouen »

Solved!!!!! you Must set the jar files one by one and also the folder of the library!!

Regards
LibreOfFice 6.3.6 on Windows 10
tom7.1
Posts: 1
Joined: Fri Apr 23, 2021 12:10 pm

Re: [Solved] Establish a Link Between LibreOffice/ java prog

Post by tom7.1 »

Please could you explain what exactly you did.

Thanks,
tom7.1
Libreoffice 7.2.1, Ubuntu 20.04 and Windows 10
Post Reply