Just getting started learning how to write a Java extension to
libreoffice (on Debian fwiw).

--- <total aside>
I find Eclipse and
https://github.com/smehrbrodt/libreoffice-starter-extension.git and
https://github.com/LibreOffice/loeclipse.git

to be overly opaque and hard to fathom for my liking (I've had to live
on command lines a lot, and this environment seems generally more
debuggable and controllable (got stuck moving a class around in the
first project above)),
--- </total aside>

so the raw LO sdk is what I'm trying to ride now.

Got stuck needing a simple fix, for the following bug:

$ ... set up LO sdk as per ./setsdkenv_unix ...
$ cd sdk/examples/DevelopersGuide/FirstSteps
$ make FirstStepsExamples
...

$ make FirstUnoContact.run
"/usr/bin/java" -Dcom.sun.star.lib.loader.unopath="/opt/l/libreoffice/program" 
-jar 
/home/me/lo/llo/out/libreoffice5.2_sdk/LINUXexample.out/class/FirstStepsExamples/FirstUnoContact.jar
Exception in thread "main" java.lang.NoClassDefFoundError: 
com/sun/star/lib/loader/Loader$1
   at com.sun.star.lib.loader.Loader.getCustomLoader(Loader.java:177)
   at com.sun.star.lib.loader.Loader.main(Loader.java:127)
Caused by: java.lang.ClassNotFoundException: com.sun.star.lib.loader.Loader$1
   at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
   ... 2 more
make: *** [FirstUnoContact.run] Error 1
Makefile:96: recipe for target 'FirstUnoContact.run' failed


So this is a simple problem, the makefile includes most required files
into the jar file, but not the missing
"com/sun/star/lib/loader/Loader$1.class"

The current settings/std.mk recipe includes each required file from the
same directory, one by one, but omits this one. Just adding all the
files from that dir (which are all needed to be in the jar file) is
better (will catch any additions/ removals in future versions
automatically).

Here's the git diff patch which makes things work properly:

diff --git a/settings/std.mk b/settings/std.mk
index 9fe1e79..ac2d4aa 100644
--- a/settings/std.mk
+++ b/settings/std.mk
@@ -82,12 +82,5 @@ JAVAMAKER="$(OO_SDK_HOME)/bin/javamaker"
 REGMERGE="$(OO_SDK_URE_BIN_DIR)/regmerge"
 
 SDK_JAVA_UNO_BOOTSTRAP_FILES=\
-    -C $(CLASSES_DIR) $(SQM)com/sun/star/lib/loader/Loader.class$(SQM) \
-    -C $(CLASSES_DIR) $(SQM)com/sun/star/lib/loader/Loader$$Drain.class$(SQM) \
-    -C $(CLASSES_DIR) 
$(SQM)com/sun/star/lib/loader/Loader$$CustomURLClassLoader.class$(SQM) \
-    -C $(CLASSES_DIR) $(SQM)com/sun/star/lib/loader/Loader$$Drain.class$(SQM) \
-    -C $(CLASSES_DIR) 
$(SQM)com/sun/star/lib/loader/InstallationFinder.class$(SQM) \
-    -C $(CLASSES_DIR) 
$(SQM)com/sun/star/lib/loader/InstallationFinder$$StreamGobbler.class$(SQM) \
-    -C $(CLASSES_DIR) $(SQM)com/sun/star/lib/loader/WinRegKey.class$(SQM) \
-    -C $(CLASSES_DIR) 
$(SQM)com/sun/star/lib/loader/WinRegKeyException.class$(SQM) \
+    -C $(CLASSES_DIR) $(SQM)com/sun/star/lib/loader/$(SQM) \
     -C $(CLASSES_DIR) $(SQM)win/unowinreg.dll$(SQM)


If you need a different format, for this or future patches,
please let me know.

NOTE: Currently I'm just working in a local lo sdk directory created
from the distribution tar file. I intend to clone a full sdk repo when I
have adequate network access to do so. IN OTHER WORDS, the git hashes
above are most likely incorrect/ not related to the actual repo - please
tell me how to create a "repo neutral" patch.

Thanks,
Zenaan

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to