I am trying to compile the xslt2-transformer extension, because I can’t find the LibreOffice extension xslt2-transformer.oxt on the web site (if anybody has it, he is welcome).
To build from source code, I proceeded like that:
$ git clone https://github.com/dtardon/xslt2-transformer.git
$ cd xslt2-transformer/
$ make
I am getting a lot of (similar) errors during build:
mkdir -p build/classes && \
javac -d build/classes -source 1.5 -target 1.5 \
-cp "external/saxon9.jar:" com/sun/star/comp/xsltfilter/Base64.java \
com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java \
com/sun/star/comp/xsltfilter/XSLTransformer.java && \
touch build/javac.done
com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java:27: error: package com.sun.star.bridge does not exist
import com.sun.star.bridge.XBridgeFactory;
^
com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java:28: error: package com.sun.star.bridge does not exist
import com.sun.star.bridge.XBridge;
^
[...]
symbol: class XConnector
location: class XSLTFilterOLEExtracter
com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java:321: error: cannot find symbol
XConnector xConnector = UnoRuntime.queryInterface(XConnector.class, x);
^
symbol: class XConnector
location: class XSLTFilterOLEExtracter
100 errors
1 warning
make: *** [build/javac.done] Error 1
I think my CLASSPATH is not up-to-date. I need to add the com.sun.star package and classes.
Since I am (currently) on OSX, my LibreOffice is installed on /Applications/LibreOffice.app and I found some classes in ./Contents/Resources/java.
So I update the CLASSPATH that way:
export CLASSPATH=/Applications/LibreOffice.app/Contents/Resources/java:$CLASSPATH
But, I have the same errors. How can I fix that?
EDIT 1 put some jar in the CLASSPATH
I tried that:
$ export CLASSPATH=/Applications/LibreOffice.app/Contents//Resources/java/ridl.jar:.
I have less errors.
EDIT 2 The build succeed!
I finally added the following jar files to the CLASSPATH:
/Applications/LibreOffice.app/Contents//Resources/java/ridl.jar
/Applications/LibreOffice.app/Contents//Resources/java/jurt.jar
/Applications/LibreOffice.app/Contents//Resources/java/juh.jar
/Applications/LibreOffice.app/Contents//Resources/java/unoil.jar
And I get the extension!
Finally, to build from source code, I proceeded like that:
git clone https://github.com/dtardon/xslt2-transformer.git
cd xslt2-transformer/
export CLASSPATH=/Applications/LibreOffice.app/Contents/Resources/java/ridl.jar:\
/Applications/LibreOffice.app/Contents/Resources/java/jurt.jar:\
/Applications/LibreOffice.app/Contents/Resources/java/juh.jar:\
/Applications/LibreOffice.app/Contents/Resources/java/unoil.jar
make
The result is build/xslt2-transformer.oxt.
Related
I download the source code of OpenJDK14 and put them in \home\yuanfang\jdk14 and after running bash configure --disable-warnings-as-errors and make images, I build OpenJDK14 successfully, The newly built JDK is in home\yuanfang\jdk14\build\linux-x86_64-server-release\jdk. By the way, I am using Ubuntu 20.04 LTS.
Then I want to debug OpenJDK14 using CLion IDE. I was using CLion 2020.2 and I take the following steps:
After open CLion I choose Create New CMake Project from Sources and choose the directory of \home\yuanfang\jdk14, which is the root directory of the jdk project.
I alter the Run/Debug Configurations to make it look like this:
CLion create a CMakeLists.txt automatically but the file doesn't work, so after googling I find find the correct CMakeLists.txt here at https://github.com/ojdkbuild/ojdkbuild/blob/master/src/java-14-openjdk/CMakeLists.txt. I then rewrite the old CMakeLists.txt using the correct one.
I download the whole repository(that is, github.com/ojdkbuild/ojdkbuild), unzip it and put it into \home\yuanfang\jdk14.
It looks like as follow, the ojdkbuild-master is the newly added folder.
I reload the CMake project, but some CMake error occurs(as follow), why can't CLion find those files? javaI googled but can't find any effective solution. Is there anything I can do or refer to? Thanks in advance.
CMake Error at CMakeLists.txt:19 (include):
include could not find load file:
/home/yuanfang/jdk14/../../resources/cmake/ojdkbuild_common.cmake
CMake Error at CMakeLists.txt:21 (include):
include could not find load file:
/home/yuanfang/jdk14/../../resources/cmake/version.cmake
CMake Error at CMakeLists.txt:93 (add_subdirectory):
add_subdirectory given source
"/home/yuanfang/jdk14/../../deps/rhino/scripting_tasks" which is not an
existing directory.
CMake Error at CMakeLists.txt:98 (ojdkbuild_add_subdirectory):
Unknown CMake command "ojdkbuild_add_subdirectory".
-- Configuring incomplete, errors occurred!
See also "/home/yuanfang/jdk14/cmake-build-debug/CMakeFiles/CMakeOutput.log".
Cannot get compiler information:
Compiler exited with error code 1: /usr/bin/cc -xobjective-c -I/home/yuanfang/jdk14/build/linux-x86_64-server-release/hotspot/variant-server/gensrc/adfiles......./loading/LibraryLoader/jar_src -g -fpch-preprocess -v -dD -E
Using built-in specs.
COLLECT_GCC=/usr/bin/cc
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
COLLECT_GCC_OPTIONS='-I' '/home/yuanfang/jdk14/build/linux-x86_64-server-release/hotspot/variant-server/gensrc/adfiles' '-I' '......'-g' '-fpch-preprocess' '-v' '-dD' '-E' '-D' '___CIDR_DEFINITIONS_END' '-mtune=generic' '-march=x86-64'
cc1obj -E -quiet -v #/tmp/cci3XM6r -imultiarch x86_64-linux-gnu -D ___CIDR_DEFINITIONS_END /tmp/compiler-file5929385022787926768 -mtune=generic -march=x86-64 -fpch-preprocess -g -fworking-directory -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -dD
cc: fatal error: cannot execute 'cc1obj': execvp: No such file or directory
compilation terminated.
[Failed to reload]
step: check out this projecdt :https://github.com/ojdkbuild/ojdkbuild.git
step: put the source code of OpenJDK14 in ojdkbuild/src/
step: copy reousrces directory and CMakelists.txt to OpenJDK14
step: recomile openjdk and import project to CLin
I am trying to compile the pentaho samples on OSX from here.
Sample1.java extends AbstractReportGenerator.java.
I have exported the CLASSPATH in the console to include the pwd:
export CLASSPATH=/Users/xxx/java-dev/pentaho/:/Users/xxx/java-dev/pentaho/lib/
I have compiled AbstractReportGenerator.java successfully using javac, into the same folder as the Sample1.java file, however when I try and compile Sample1.java it always fails with 3 errors related to AbstractReportGenerator.
Any suggestion on the cause and solution ?
Folder structure:
Working Folder >
- Sample1.java
- AbstractReportGenerator.java
- AbstractReportGenerator.class
- AbstractReportGenerator$1.class
- AbstractReportGenerator$OutputType.class
- lib
- pentaho .jar files
Command:
javac -cp "lib/*" Sample1.java
Sample1.java:41: error: cannot find symbol
public class Sample1 extends AbstractReportGenerator
^
symbol: class AbstractReportGenerator
Sample1.java:61: error: cannot find symbol
final ClassLoader classloader = this.getClass().getClassLoader();
^
symbol: method getClass()
Sample1.java:132: error: package AbstractReportGenerator does not exist
new Sample1().generateReport(AbstractReportGenerator.OutputType.PDF, outputFilename);
^
Note: Sample1.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
Try using:
javac -cp lib/*:. Sample1.java
Thanks so much for all the suggestions, after adding a target folder, this suggestion from #Roman Vottner finally worked:
javac -cp ./lib/*:./target -d ./target AbstractReportGenerator.java Sample1.java
My project runs smoothly in Eclipse, no errors at all. I ran it through local tests (that are equal to the ones in an online mooshak contest) and all checks out. But when I sumbit it online, I get a CompileTimeError.
To try to locate the problem, I attempted to use javac in Main.java, and this happened:
javac -encoding US-ASCII Main.java
Main.java:8: error: package code does not exist
import code.*;
^
Main.java:129: error: cannot find symbol
public static void addWords(Scanner in, LibSystem system, int wordCount)
{
^
symbol: class LibSystem
location: class Main
Main.java:153: error: cannot find symbol
public static void searchWord(LibSystem system, String word) {
^
Other symbol errors follow for every reference to classes from my only package, which I fully import and the header of Main, for a total of 29 errors.
Project
src
Main.java
code (package with all my other java files)
Follow these steps :-
1.) make sure LibSystem class is in classpath.
2.)Compile java files in code folder using -d option. That will create directories with classes.
javac -d . code/*.java
3.) then compile your Main class.
javac Main.java
I have my file structure as (they are in the package assigment):
prog/
src/assignment/
bin/assignment/
lib/assignment/
The files I am compiling are in src, and are being compiled to bin. The command I type is javac -d ./bin/ -cp ./bin/:./src/ -target 1.7 ./src/assignment/*.java
I have also tried javac -d ./bin/ -cp ./bin/:./src/ -target 1.7 ./src/assignment/GoodBrain.java ./src/assignment/LameBrain.java ./src/assignment/Board.java
For some reason I cannot two class files, the error message is 'cannot find symbol' (it points to the Board class and the LameBrain class).
The error message:
javac -g -d ./bin/ -cp ./src/:. -target 1.7 src/assignment/GoodBrain.java
src/assignment/GoodBrain.java:3: error: cannot find symbol
public class GoodBrain extends LameBrain{
^
symbol: class LameBrain
src/assignment/GoodBrain.java:11: error: cannot find symbol
public double rateBoard(Board board) {
^
symbol: class Board
location: class GoodBrain
2 errors
make: *** [bin/assignment/GoodBrain.class] Error 1
It is the same error for all the commands that I type in. Please tell me if I need to provide any new information
I fixed the error, it was because I forgot to include the package statement. Very dumb mistake
While trying to build a library that uses javah, I ran into a classpath issue. Apparently, the classpath is prefixed with the JDK path: please notice the final search path is wrong. How should I do instead?
elmarco#makai:~/src/sasl/java/CyrusSasl (mingw32 *%)$ CLASSPATH=$PWD javah -o javasasl.h -jni -verbose Sasl
error: cannot access Sasl
class file for Sasl not found
javadoc: error - Class Sasl not found.
[ Search Path: /usr/java/jdk1.6.0_24/jre/lib/resources.jar:/usr/java/jdk1.6.0_24/jre/lib/rt.jar:/usr/java/jdk1.6.0_24/jre/lib/sunrsasign.jar:/usr/java/jdk1.6.0_24/jre/lib/jsse.jar:/usr/java/jdk1.6.0_24/jre/lib/jce.jar:/usr/java/jdk1.6.0_24/jre/lib/charsets.jar:/usr/java/jdk1.6.0_24/jre/lib/modules/jdk.boot.jar:/usr/java/jdk1.6.0_24/jre/classes//home/elmarco/src/sasl/java/CyrusSasl ]
elmarco#makai:~/src/sasl/java/CyrusSasl (mingw32 *%)$ ls Sasl.java
Sasl.java
Thanks for your help!
(this is jdk1.6.0_24 on Fedora 14)
I usually avoid the CLASSPATH environment variable. This should work (and maybe without a problem):
javah -classpath .;<your-path> -o javasasl.h -jni -verbose Sasl
If don't need nothing but the local path, then you don't have to specify a -classpath option, . is the default value.
Note - you have to compile Sasl.java first. javah expects a class file. (Getting started)
I think it's simply a bug in how the javah outputs its actual classpath. What happens is that it has a bunch of places where it searches for built-in classes, and apart from them, it also uses the stuff in $CLASSPATH. When it prints the actual classpath used, they do something like this (pseudo code, assuming implicitEntries is a list of builtin classpath entries, and explicitEntries is a list of the the directories specified in $CLASSPATH):
print implicitEntries.join(pathSeparator) + explicitEntries.join(pathSeparator)
where it should have been
print implicitEntries.join(pathSeparator) + pathSeparator + explicitEntries.join(pathSeparator)
The following works fine for me:
$ ls
Sasl.class Sasl.java
$ javah -classpath . -o javasasl.h -jni -verbose Sasl [ Search Path: /usr/java/jdk1.6.0/jre/lib/resources.jar:/usr/java/jdk1.6.0/jre/lib/rt.jar:/usr/java/jdk1.6.0/jre/lib/sunrsasign.jar:/usr/java/jdk1.6.0/jre/lib/jsse.jar:/usr/java/jdk1.6.0/jre/lib/jce.jar:/usr/java/jdk1.6.0/jre/lib/charsets.jar:/usr/java/jdk1.6.0/jre/classes/. ]
[Creating file javasasl.h]
[search path for source files: [.]]
[search path for class files: [/usr/java/jdk1.6.0/jre/lib/resources.jar, /usr/java/jdk1.6.0/jre/lib/rt.jar, /usr/java/jdk1.6.0/jre/lib/sunrsasign.jar, /usr/java/jdk1.6.0/jre/lib/jsse.jar, /usr/java/jdk1.6.0/jre/lib/jce.jar, /usr/java/jdk1.6.0/jre/lib/charsets.jar, /usr/java/jdk1.6.0/jre/classes, /usr/java/jdk1.6.0/jre/lib/ext/dnsns.jar, /usr/java/jdk1.6.0/jre/lib/ext/localedata.jar, /usr/java/jdk1.6.0/jre/lib/ext/sunpkcs11.jar, /usr/java/jdk1.6.0/jre/lib/ext/sunjce_provider.jar, .]]
[loading ./Sasl.class]
[loading /usr/java/jdk1.6.0/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]
[loading /usr/java/jdk1.6.0/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]
[loading /usr/java/jdk1.6.0/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Class.class)]
[done in 585 ms]
$ ls
javasasl.h Sasl.class Sasl.java
Now, since the header file generation doesn't seem to work for you... are you sure you have Sasl.class in the current directory? javah works with byte code files, not Java source files.
You show here, that the source file is available ...
(mingw32 *%)$ ls Sasl.java
Sasl.java
but missing is the class file (Sasl.class).
error: cannot access Sasl
class file for Sasl not found
Compile it first.