I have compiled and made an executable jar file for db2triples program. I am using the following command for executing the jar file.
java -cp target/dependency/*.jar:target/db2triples-1.0.3-SNAPSHOT.jar net.antidot.semantic.rdf.rdb2rdf.main.Db2triples
The main class has not been defined in the MANIFEST.MF file, therefore, I am explicitly defining it in the command.
The net.antidot.semantic.rdf.rdb2rdf.main.Db2triples is the location of the main class in the target/classes directory.
I am using Windows operating system.
Update:
After using semicolon the following error crops up:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2693)
at java.lang.Class.privateGetMethodRecursive(Class.java:3040)
at java.lang.Class.getMethod0(Class.java:3010)
at java.lang.Class.getMethod(Class.java:1776)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.ParseException
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)
... 7 more
You need to either run the command from the target/classes directory or add the target/classes directory to your -cp list.
Related
I built a jar file named jar1 using maven.
I am using the above jar in a standalone Java application. When I run this app, I get this error:
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:238)
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:192)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:316)
at java.util.jar.JarVerifier.update(JarVerifier.java:228)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:383)
at java.util.jar.JarFile.getInputStream(JarFile.java:450)
at sun.misc.URLClassPath$JarLoader$2.getInputStream(URLClassPath.java:776)
at sun.misc.Resource.cachedInputStream(Resource.java:77)
at sun.misc.Resource.getByteBuffer(Resource.java:160)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
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 Hello.main(Hello.java:6)
How can I fix this issue? Pls help!
I can launch a JNLP file from Cygwin but not MS-DOS on the same machine. I am using javaws and getting the error to the effect that javaw.exe not found. I read http://javatechniques.com/blog/launching-java-webstart-from-the-command-line/. that one can use java compiler to do the launch So I tried that as well that looks something like this:
c:\Program Files\Java\jdk1.8.0_60\jre\bin>java -classpath
"C:\Program Files\Java\jdk1.8.0_60\jre\lib\javaws.jar;
C:\Program Files\Java\jdk1.8.0_60\jre\lib\deploy.jar"
-Djnlpx.home="C:Program Files\Java\jdk1.8.0_60/jre/bin"
-Djnlpx.jvm="C:\Program Files\Java\jdk1.8.0_60\jre\bin\javaw.exe"
-Djnlpx.remove=true
-Djnlpx.splashport=-1
com.sun.javaws.Main c:\tmp2\new_3.jnlp
And when I do that I get this error:
Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/deploy/util/DeploySysRun
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.sun.deploy.util.DeploySysRun
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)
... 7 more
I would appreciate any help.
Thanking you
When i run command ./runExamples.sh on terminal it throws an exception. I have checked that Java is installed and class path is already set. How to resolve this?
Starting examples app with java from environment variable PATH...
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.optaplanner.examples.common.app.CommonApp.<clinit>(CommonApp.java:36)
at org.optaplanner.examples.app.OptaPlannerExamplesApp.main(OptaPlannerExamplesApp.java:72)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
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)
... 2 more
You miss the slf4j.jar in your classpath. download and add it.
I have created an map-red job which uses the apache-commons-cli library shipped with the hadoop under $HADOOP_HOME/lib/.
Now, if I create a jar and then try to run my job using
./hadoop -jar myjob.jar
I get the below exception:
Warning: $HADOOP_HOME is deprecated.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/CommandLineParser
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
at java.lang.Class.getMethod0(Class.java:2764)
at java.lang.Class.getMethod(Class.java:1653)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.CommandLineParser
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:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357
I can see that common-cli-xxx.jar is present in my $HADOOP_HOME/lib dir. I don't know what wrong I am doing here.
Type just hadoop in your terminal if it does not show list of all the hadoop command,
you can check whether
export PATH=$PATH:$HADOOP_HOME/bin
export HADOOP_HOME=/usr/local/hadoop
lines are added to your .bashrc
i am geting following error
Am i missing some jar file?
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.slf4j.impl.JCLLoggerFactory.getLogger(JCLLoggerFactory.java:69)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:243)
at org.smslib.helper.Logger.<init>(Logger.java:34)
at org.smslib.Service.<init>(Service.java:93)
at SendMessage.doIt(SendMessage.java:28)
at SendMessage.main(SendMessage.java:82)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 6 more
Java Result: 1
Yes, you need the Apache Logging JAR file on your classpath. Download it here: http://commons.apache.org/downloads/download_logging.cgi
Adding the jar files to ant lib will make them available for ant's java process and not your applications java process. Setting your application's classpath correctly must work.