iTextpdf Java compatibility - java

I need to encrypt a pdf document and decided to use itext Version 5.4.0 for this, and everything went well for my local test on my machine(with JAVA 1.8.0), but now I need to move the work to an oracle database 11gR2, and when I load the jar files (iText and bouncycastle) I keep getting the same error: ORA-29534:referenced object could not be resolved. I'm using the loadjava command for this:
loadjava -u SYSTEM/SYS_PWD#SID -o -r -v -f -noverify -synonym -g public itextpdf-5.1.0.jar
I've tried using SYS as well, but still getting the same error code.
I don't know if this has something to do with the JVM, the database uses JAVA 1.5.0.
I've searched about iText java requirements but couldn't found anything
useful, I'll be grateful with any help I can get.

I was able to upload, compile and use the libraries in the .jar files using the same command but with other parameter, and it compiled; the command I used is :
loadjava -u SYS/[pwd]#[SID] -r -v -f -genmissing -s -grant public [file].jar
Hope this can help someone in need out there!

Related

Running some parquet-tools commands using Java -jar

In order to see the content of my parquet file, I tried running some parquet-tools commands using version 1.9.1 and version
1.6.1 and was quite surprised to see that the newer parquet-tools doesn't
work for me at all:
I want to run the parquet-tool using java -jar command. Bellow the commands I tried and the result obtained
java -jar parquet-tools-1.9.1-SNAPSHOT.jar meta /tmp/test.parquet
java -jar parquet-tools-1.9.1-SNAPSHOT.jar cat /tmp/test.paruet
The obtained result for both commands:
org/apache/hadoop/conf/Configuration
org/apache/hadoop/fs/Path
Can someOne guides me with sample example to resolve this.
Thansk in advance

Can't run a example by Doop - Framework for Java Pointer Analysis

I am trying to using Doop framework. I am following this link: https://bitbucket.org/yanniss/doop
I downloaded the code and compiled it successfully. but when I am trying to Running Doop by the following command
$ DOOP_HOME>./bin/doop -a context-insensitive -j ./lib/asm-debug-all-4.1.jar
in my case, it is :
./doop -a context-insensitive -j ../lib/asm-debug-all-5.0.3.jar
But, unfortunately, I got an error.
vuquangvinh#vuquangvinh-VPCEA24FM:~/tutorial/DoopFramework/code/doop/bin$ ./doop -a context-insensitive -j ../lib/asm-debug-all-5.0.3.jar
:: loading settings :: url = jar:file:/home/vuquangvinh/tutorial/DoopFramework/code/doop/lib/ivy-2.3.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
The EXTERNALS directory is invalid: null
I have no idea what is happening. I have tried, but this framework seems to be not popular. Anyone can help me!
Many thanks!
As stated in the documentation the tool expects several environment variables DOOP_HOME, DOOP_OUT, DOOP_HOME and DOOP_EXTERNALS to be set and it simply complains that DOOP_EXTERNALS is not set.
Instead of setting the environment variable you can also pass the externals directory via command line option --externals <the directory>.

How to set up JAssimp?

Assimp is a library used for importing 3D models into your application. It is written for C++, but there is a port for java called jassimp. For the past 5 or 6 hours I've been trying to set up jassimp in Eclipse and cannot get it to work. I downloaded the win-binaries version of assimp here, which also includes ported versions of it like jassimp. I will now posts the steps I have taken to get jassimp to function in hopes that someone will be able to identify an error.
I've mainly followed the "tutorial" shown here, which basically consists of the two parts under "HOW TO BUILD."
Keep in mind, I didn't and still don't really know what any of those commands mean. Anyways, I had to install MinGW since I'm not using Linux and because I could not find the equivalent in DOS commands. After changing the paths to point to the same places his did, my command looked like this:
gcc jassimp.cpp -I "C:/Program Files/java/jdk1.8.0/include" -I "C:/Program Files/java/jdk1.8.0/include/win32" -lassimp -shared -fPIC -o libjassimp.so
I ran it, but there was a problem I encountered::
jassimp.cpp:3:28: fatal error: assimp/cimport.h: No such file or directory
#include <assimp/cimport.h>
"Okay," I thought. "Well, those -I commands probably include files or something, so maybe I should look for the header file that's missing and include it via -I!" Thus, I looked through the jassimp folder for a "cimport.h" file, and what do you know, I found it in a folder called include. I then proceeded to change my command to
gcc jassimp.cpp -I "C:/Program Files/java/jdk1.8.0/include" -I "C:/Program Files/java/jdk1.8.0/include/win32" (new->)-I "C:/assimp-3.1.1-win-binaries/include/"(<-new) -lassimp -shared -fPIC -o libjassimp.so
Upon running it, I was very surprised to see that I got another error:
C:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lassimp
"Hmmm..." I thought. After some googling, I found this answer. So, I went ahead and did what he did, and strangely enough, I saw that it was looking in some random folders for files called libassimp.dll, assimp.dll.a, libassimp.a, etc... "Hey, you shouldn't be looking in those folders!" I screamed.
"So how do I get it to look in the right location?" I wondered. Luckily, I found this answer. "Hmmm... he put -L and then the location of his library and then called -l< library >..." As I was thinking about how I was going to modify my command, I realized I was missing a little detail: what's the library I'm even trying to point to? Well, in the --verbose command, it looked like a file with a general name of assimp.lib or assimp.dll. And so, I searched the jassimp folder in hopes of finding a similar file. I found one named assimp.dll in a folder called bin64. I then changed my command once again:
gcc jassimp.cpp -I "C:/Program Files/java/jdk1.8.0/include" -I "C:/Program Files/java/jdk1.8.0/include/win32" -I "C:/assimp-3.1.1-win-binaries/include/" (new->)-L "C:/assimp-3.1.1-win-binaries/bin64"(<-new) -lassimp -shared -fPIC -o libjassimp.so
Running it gave me this error:
C:/assimp-3.1.1-win-binaries/bin64/assimp.dll: file not recognized: File format not recognized
So, I decided to build assimp as if I was using it for c++ in order to hopefully get a functional .dll file (I was really desperate...). I followed this (http:// assimp.sourceforge.net/lib_html/cmake_build.html) tutorial for building it, which uses CMake. Eventually, I built the project using CMake, which apparently just sets it up for use in Visual Studio, opened it in Visual Studio 2013, and built a release version of it from there. This gave me a .dll file which I then changed my command to point to:
gcc jassimp.cpp -I "C:/Program Files/java/jdk1.8.0/include" -I "C:/Program Files/java/jdk1.8.0/include/win32" -I "C:assimp-3.1.1-win-binaries/include/" (new->)-L "C:/assimp build/code/Release/"(<-new) -lassimp -shared -fPIC -o libjassimp.so
Well, at least it gave me a different error:
C:\Users\Nick\AppData\Local\Temp\ccgtrCg8.o:jassimp.cpp:(.eh_frame$_ZN7JNIEnv_9NewObjectEP7_jclassP10_jmethodIDz+0x13): undefined reference to `__gxx_personality_v0'
C:\Users\Nick\AppData\Local\Temp\ccgtrCg8.o:jassimp.cpp:(.eh_frame+0x14b): undefined reference to `__gxx_personality_v0'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\Users\Nick\AppData\Local\Temp\ccgtrCg8.o: bad reloc address 0x14b in section `.eh_frame'
Googled it and just changed gcc to g++ and lo and behold, I got a file called libjassimp.so. Part 1 done. Or so I thought.
Time for part 2, which was relatively easier, so I'll just say I successfully ended up with a jassimp.jar file.
Time to put it all into my Eclipse project, which just consisted of me adding the jar file to the build path and attaching the libjassimp.so to the jar's native location. Upon trying to use one of the classes from jassimp, I came upon this little guy:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jassimp in java.library.path
I don't feel like explaining my thought process for this next part, so long story short, I changed the output file name in my command as such:
from
-o libjassimp.so
to
-o jassimp.dll
Genius, right? Running it with the new native file, I am now stuck with this:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\MyName\workspace\jassimp\lib\native\jassimp.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
Google says using -m64 will compile a .dll to be 64-bit, so I tried
g++ jassimp.cpp ... -m64 -o jassimp.dll
And, not very surprisingly, I got this error while trying to compile it from the command line:
jassimp.cpp:1:0: sorry, unimplemented: 64-bit mode not compiled in
If I messed up anywhere, I would have to guess it was when I changed the name output file from .so to .dll, but I don't know what else to do. I also could've messed up anywhere else.
Anyways, I'm stuck, and I honestly don't know what else I can do here. There doesn't seem to be many posts on this topic, but it seems that some other people have gotten it to work and I am just stupefied by it, since I don't know any other process other than mine that they could have taken. There is one solution I've read, which is using a 32-bit jvm/jdk/jre/whatever, but I read that a 64-bit computer is more efficient than 32-bit so I don't want to do that.
Got it working. Turns out I was using a 32-bit version of MinGW which was why I was compiling a 32-bit .dll. I also did not need to build assimp with CMake or Visual Studio: I could have simply used the assimp.lib and assimp.dll files located in the win-binaries assimp folder. The final command is here:
g++ jassimp.cpp -I "C:/Program Files/java/jdk1.8.0/include" -I "C:/Program Files/java/jdk1.8.0/include/win32" -I "C:/Users/Nick/Desktop/java libraries/assimp-3.1.1-win-binaries/include/" -L "C:/Users/Nick/Desktop/java libraries/assimp-3.1.1-win-binaries/bin64" -L "C:/Users/Nick/Desktop/java libraries/assimp-3.1.1-win-binaries/lib64" -lassimp -shared -fPIC -o -m64 jassimp.dll
The -m64 is unnecessary, but I put it there just to make sure that the dll compiles as 64 bit. Also, when I used the new jassimp.dll in Eclipse, I got an unsatisfied link error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\MyName\workspace\myproject\lib\jassimp-native\jassimp.dll: Can't find dependent libraries
I fixed this by putting the assimp.dll file from assimp-3.1.1-win-binaries/bin64 into my system32 folder.
Hopefully this helps someone.
And if you have any questions, feel free to ask.

Mac launcher script for Java app

I need to launch a Jar file with a portable JRE. It works on Windows thanks to launch4j, it works on Ubuntu thanks to me, but not on Mac ..... and I can't test it.
The path tree of application:
abcmap/
launcher.command
bin/
abcmap.jar
jre/
bin/
java
Thinking it's like Unix system, I tried this (without specify bash):
./bin/jre/bin/java -Xms512m -Xmx1024m -jar ./bin/abcmap.jar
But this error appear:
MacBook-Pro:~ frcstnt$ /Applications/abcmap-mac/abcmap.command;
exit;
/Applications/abcmap-mac/abcmap.command: line 1:
bin/jre/bin/java: No such file or directory
logout
All files are rwx for all,
All files are UTF8 without BOM
I tried to change end of line to Unix and to "Old Mac" with Notepad++,
Archives are available on my website:
http://abc-map.fr/download/
https://translate.google.fr/translate?hl=fr&sl=fr&tl=en&u=http%3A%2F%2Fabc-map.fr%2F
Someone can help me please?
Edit: I think my problem is in the launcher, maybe encoding or bad command ?
Edit: Thanks to the Wim's answer it works. This is the script:
#!/bin/bash
SCRIPTDIR=$(dirname $0)
cd $SCRIPTDIR
${SCRIPTDIR}/bin/jre/bin/java -jar ${SCRIPTDIR}/bin/abcmap.jar
The path ./bin/jre/bin/java will be resolved relative to the current directory, not relative to the location of the command file. Try what happens if you run the command from the directory where the command is located.
I think I've found thanks to Wim Deblauwe. I use this:
#!/bin/bash
SCRIPTDIR=$(dirname $0)
cd $SCRIPTDIR
${SCRIPTDIR}/bin/jre/bin/java -jar ${SCRIPTDIR}/bin/abcmap.jar
Find the script dir, go to this dir and start operations.
It seems like you maybe don't even have the Java Runtime Evironment installed. You should try running java -version or at least java -h or java --help.
If you output is something like the following:
java: command not found
You should download and install the latest JRE and try again.
If, however, you see your java version, try first using cd to go to the directory of your jarfile and then use:
java -jar -otheroptionshere jarfile.jar
I hope this helps! Tell me, if you still got issues.

Where is java installed on my mac?

I am having trouble finding where java is installed on my mac. I am trying to downgrade from java 1.8 to java 1.7.
When I run the command /usr/libexec/java_home it returns /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home
but the trouble is when I go to the Library folder there is no Java folder. I've tried navigating there in terminal and it says -bash: cd: Java: No such file or directory
How can I get the Java folder to show? I was thinking maybe it is hidden. Or what other commands can I use that will point me to where Java is installed?
Try:
which java
This should give you the path of the java binary. It might be a link to another file, which you'll be able to check with:
ls -l `which java`
In your case Java doesn't seem to have been removed completely.
Go to /Library/PreferencePanes/JavaControlPanel.prefPane and remove it from command line. You might need sudo access.
Also remove the JavaAppletPlugin from /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
Again sudo access is necessary

Categories

Resources