Java class PdfFormFiller after compilation error - java

I have a problem with compiling this java project https://github.com/nkitsul/pdfformfiller2
mkdir PdfFormFiller
cd PdfFormFiller/
git clone https://github.com/nkitsul/pdfformfiller2.git .
cd lib/
wget https://github.com/itext/itextpdf/releases/download/5.5.0/itext-5.5.0.zip
unzip itext-5.5.0.zip
cd ..
mkdir bin
javac -cp lib/itextpdf-5.5.0.jar PdfFormFiller.java -d bin/
java -cp ./bin PdfFormFiller.PdfFormFiller
After that I get this:
Exception in thread "main" java.lang.NoClassDefFoundError: com/itextpdf/text/DocumentException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getMethod0(Class.java:2774)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: com.itextpdf.text.DocumentException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
What am I doing wrong?
My OS - Debian wheezy java version "1.7.0_55" OpenJDK Runtime
Environment (IcedTea 2.4.7) (7u55-2.4.7-1~deb7u1) OpenJDK 64-Bit
Server VM (build 24.51-b03, mixed mode)
javac 1.7.0_55

Add the iText JAR file to the runtime classpath
java -cp ./bin:lib/itextpdf-5.5.0.jar PdfFormFiller.PdfFormFiller

Related

Can't run JAR files because of outdated JRE but updating it does nothing

I tried to open the jar with "java -jar blah.jar".
this is the outcome:
java -jar Desktop/lambertone2.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: main/Main has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56) .
I went to Oracle site to download the latest JRE but it doesn't change anything.
All this happened some day ago where the update section of java told me to erase java because it was obsolete, so i removed it and reinstalled it.
if i use the command java --version it says me that the command is unsupported.
if i use javac --version it says that it is version 10.

maven version exception on mac

When I execute "mvn --version" I get this error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:144)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Maven version I installed is maven 3.3.3
My java version is:
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
echo $PATH returns:
/Library/Maven/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
How to solve the problem of Maven?
$JAVA_HOME should be pointing to 1.8.0_65 as in your case.
If you want it to permanently change the value of JAVA_HOME, you will have to add the command to your ~/.profile file. Below are instructions on how to accomplish this instead:
Open up Terminal.app (Applications → Utilities → Terminal)
Type:
emacs .profile
Add this to the end of the .profile file:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
export JAVA_HOME;
Note that JAVA_HOME should be the path of your JDK directory.
Save and exit emacs (ctrl-x, ctrl-s; ctrl-x, ctrl-c)
Open a new Terminal window (cmd-n) and type:
$JAVA_HOME/bin/java -version

Classpath for ojdbc6.jar not detected after being added to .bashrc in ubuntu

i have added the ojdbc6.jar and the ojdbc6_g.jar file in the .bashrc but i keep getting the driver error:
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at jdbcdisplay.main(jdbcdisplay.java:17)
I have added the following Classpath to the .bashrc file for the ojdbc6.jar file:
export CLASSPATH=".:/home/shawnreese/Downloads/ojdbc6.jar:/home/shawnreese/Downloads/ojdbc6_g(1).jar"
The jar files are not even detected.They just keep showing the same error.On performing echo ${CLASSPATH} i get the jar file of opencsv.jar added in .bashrc.
.:/home/shawnreese/Downloads/opencsv-2.3/deploy/opencsv-2.3.jar
I am using java version:
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
and Oracle 11g Release 2.

Axis2 : XmlSchema class not found

I'm trying to generate Java classes with WSDL2Java. I run the simplest example and get errors.
$ jar tvf XmlSchema-1.4.7.jar | grep org/apache/ws/commons/schema/XmlSchema.class
14803 Wed Sep 22 17:28:44 CEST 2010 org/apache/ws/commons/schema/XmlSchema.class
$ ./bin/wsdl2java.sh -classpath $(echo lib/*.jar | tr ' ' ';') -uri HelloWorld.wsdl
Using AXIS2_HOME: /C/Documents and Settings/ixos/axis2-1.6.2
Using JAVA_HOME: /C/Program Files/Java/jdk1.7.0_07/
Retrieving document at 'samples/wsdl/Axis2SampleDocLit.wsdl'.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/XmlSchema
at org.apache.axis2.description.WSDLToAxisServiceBuilder.<init>(WSDLToAxisServiceBuilder.java:103)
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.<init>(WSDL11ToAxisServiceBuilder.java:226)
at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.<init>(WSDL11ToAllAxisServicesBuilder.java:63)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:166)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.lang.ClassNotFoundException: org.apache.ws.commons.schema.XmlSchema
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 6 more
The libraries are in the path and now I'm stuck and don't know to do next. Google isn't helpful at all ...
CLASSPATH
lib/XmlSchema-1.4.7.jar;lib/activation-1.1.jar;lib/antlr-2.7.7.jar;lib/apache-mime4j-core-0.7.2.jar;lib/axiom-api-1.2.13.jar;lib/axiom-dom-1.2.13.jar;lib/axiom-
impl-1.2.13.jar;lib/axis2-adb-1.6.2.jar;lib/axis2-adb-codegen-1.6.2.jar;lib/axis2-ant-plugin-1.6.2.jar;lib/axis2-clustering-1.6.2.jar;lib/axis2-codegen-1.6.2.ja
r;lib/axis2-corba-1.6.2.jar;lib/axis2-fastinfoset-1.6.2.jar;lib/axis2-java2wsdl-1.6.2.jar;lib/axis2-jaxbri-1.6.2.jar;lib/axis2-jaxws-1.6.2.jar;lib/axis2-jibx-1.
6.2.jar;lib/axis2-json-1.6.2.jar;lib/axis2-kernel-1.6.2.jar;lib/axis2-metadata-1.6.2.jar;lib/axis2-mtompolicy-1.6.2.jar;lib/axis2-saaj-1.6.2.jar;lib/axis2-soapm
onitor-servlet-1.6.2.jar;lib/axis2-spring-1.6.2.jar;lib/axis2-transport-http-1.6.2.jar;lib/axis2-transport-local-1.6.2.jar;lib/axis2-xmlbeans-1.6.2.jar;lib/bcel
-5.1.jar;lib/commons-cli-1.2.jar;lib/commons-codec-1.3.jar;lib/commons-fileupload-1.2.jar;lib/commons-httpclient-3.1.jar;lib/commons-io-1.4.jar;lib/commons-logg
ing-1.1.1.jar;lib/geronimo-annotation_1.0_spec-1.1.jar;lib/geronimo-jaxws_2.2_spec-1.0.jar;lib/geronimo-jta_1.1_spec-1.1.jar;lib/geronimo-saaj_1.3_spec-1.0.1.ja
r;lib/geronimo-stax-api_1.0_spec-1.0.1.jar;lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar;lib/httpcore-4.0.jar;lib/jalopy-1.5rc3.jar;lib/jaxb-api-2.1.jar;lib/jaxb-
impl-2.1.7.jar;lib/jaxb-xjc-2.1.7.jar;lib/jaxen-1.1.1.jar;lib/jaxws-tools-2.1.3.jar;lib/jettison-1.0-RC2.jar;lib/jibx-bind-1.2.jar;lib/jibx-run-1.2.jar;lib/jsr3
11-api-1.0.jar;lib/juli-6.0.16.jar;lib/log4j-1.2.15.jar;lib/mail-1.4.jar;lib/mex-1.6.2-impl.jar;lib/neethi-3.0.2.jar;lib/regexp-1.2.jar;lib/tribes-6.0.16.jar;li
b/woden-api-1.0M9.jar;lib/woden-impl-commons-1.0M9.jar;lib/woden-impl-dom-1.0M9.jar;lib/wsdl4j-1.6.2.jar;lib/wstx-asl-3.2.9.jar;lib/xalan-2.7.0.jar;lib/xml-reso
lver-1.2.jar;lib/xmlbeans-2.3.0.jar
The problem is with your jdk (1.7): axis2 doesn't get along with it. Download the jdk 1.6 library and link it in your eclipse, then re-try.

error install jigsaw on linux with java

I'm trying to install Jigsaw on Linux. I have installed on my machine JDK.here is the message of java -version:
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
I followed your instructions but when I execute install.sh I receive:
./install.sh: 5: cd: can't cd to Jigsaw
Errore: impossibile trovare o caricare la classe principale Install
So I choose the manual way exporting CLASSPATH but when I execute java Install here it is the message
Jigsaw/2.2.6 setup.
updating /home/mazzy/Scaricati/Jigsaw/Jigsaw/config/http-server.props ... Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/jigsaw/http/httpd
at Install.install(Install.java:134)
at Install.main(Install.java:210)
Caused by: java.lang.ClassNotFoundException: org.w3c.jigsaw.http.httpd
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 2 more

Categories