On 08/18/2016 03:51 PM, Zenaan Harkness wrote:
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"

Happened to get fixed just yesterday for LO 5.2.1, <https://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-5-2-1&id=fa729e8cf6e3b3e00f0a031d4fc7d7183f4e073d> "Add missing 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.

Yeah, your fix looks much better indeed. Please see <https://wiki.documentfoundation.org/Development/gerrit> for how to send a patch for review.

--
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