diff --git a/scripting/java/build.xml b/scripting/java/build.xml
index adf4b872c4d4..02975b2d4e7f 100755
--- a/scripting/java/build.xml
+++ b/scripting/java/build.xml
@@ -75,6 +75,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,10 +102,13 @@
+ debug="${debug}" optimize="${optimize}" deprecation="off">
+
+
+
diff --git a/xmlhelp/source/com/sun/star/help/makefile.mk b/xmlhelp/source/com/sun/star/help/makefile.mk
index 373e8f6c67dc..730121fd7168 100644
--- a/xmlhelp/source/com/sun/star/help/makefile.mk
+++ b/xmlhelp/source/com/sun/star/help/makefile.mk
@@ -104,6 +104,7 @@ JAVACLASSFILES = \
JARFILES = ridl.jar jurt.jar unoil.jar juh.jar
.IF "$(SYSTEM_LUCENE)" == "YES"
XCLASSPATH!:=$(XCLASSPATH)$(PATH_SEPERATOR)$(LUCENE_CORE_JAR)$(PATH_SEPERATOR)$(LUCENE_ANALYZERS_JAR)
+COMP=fix_system_lucene
.ELSE
JARFILES += lucene-core-2.3.jar lucene-analyzers-2.3.jar
.ENDIF
@@ -116,3 +117,12 @@ CUSTOMMANIFESTFILE = MANIFEST.MF
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+
+.IF "$(JARTARGETN)"!=""
+$(JARTARGETN) : $(COMP)
+.ENDIF
+
+fix_system_lucene:
+ @echo "Fix Java Class-Path entry for Lucene libraries from system."
+ @$(SED) -r -e "s#^(Class-Path:).*#\1 file://$(LUCENE_CORE_JAR) file://$(LUCENE_ANALYZERS_JAR)#" \
+ -i ../../../../../$(INPATH)/class/HelpLinker/META-INF/MANIFEST.MF