Including nonfree module in eclipse openCV 3.0 project - eclipse

I want to use some functionality from nonfree library so I added javacv to my maven project and I have installed opencv_contrib package.
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId>
<version>1.1</version>
</dependency>
As a result I have opencv_xfeatures2d.class as a part of opencv-3.0.0-1.1.jar library.
I have following import:
import static org.bytedeco.javacpp.opencv_xfeatures2d.*;
in my project. The library is added properly because following
SURF surf = new SURF();
line (ctrl + left mouse button) it redirects me to proper function inside opencv_xfeatures2d file. But when I try to compile project I get following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no
jniopencv_xfeatures2d in java.library.path at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864) at
java.lang.Runtime.loadLibrary0(Runtime.java:870) at
java.lang.System.loadLibrary(System.java:1122) at
org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:597) at
org.bytedeco.javacpp.Loader.load(Loader.java:438) at
org.bytedeco.javacpp.Loader.load(Loader.java:381) at
org.bytedeco.javacpp.opencv_xfeatures2d.(opencv_xfeatures2d.java:19)
at java.lang.Class.forName0(Native Method) at
java.lang.Class.forName(Class.java:348) at
org.bytedeco.javacpp.Loader.load(Loader.java:413) at
org.bytedeco.javacpp.Loader.load(Loader.java:381) at
org.bytedeco.javacpp.opencv_xfeatures2d$SURF.(opencv_xfeatures2d.java:489)
at mypr.rec.Clsm.Cmpr(Clsm.java:18) at
mypr.mn.Main.main(Main.java:21) Caused by:
java.lang.UnsatisfiedLinkError:
/tmp/javacpp8449996504597/libjniopencv_xfeatures2d.so:
/usr/local/lib/libopencv_calib3d.so.3.0: undefined symbol:
ippicvJumpIndexForMergedLibs at
java.lang.ClassLoader$NativeLibrary.load(Native Method) at
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938) at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821) at
java.lang.Runtime.load0(Runtime.java:809) at
java.lang.System.load(System.java:1086) at
org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:580) ... 10 more
The strange thing is that it says about jniopencv_xfeatures2d instead of opencv_xfeatures2d. What am I doing wrong?

Related

How to configure titan over hbase in java eclipse?

using the following commands as given in the tutorial :
http://s3.thinkaurelius.com/docs/titan/0.5.0/hbase.html
TitanGraph graph = TitanFactory.build()
.set("storage.backend","hbase")
.open();
used the maven dependency :
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
<artifactId>titan-hbase</artifactId>
<version>${titan.version}</version>
</dependency>
Following error is shown
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.thinkaurelius.titan.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:42)
at com.thinkaurelius.titan.diskstorage.Backend.getImplementationClass(Backend.java:479)
at com.thinkaurelius.titan.diskstorage.Backend.getStorageManager(Backend.java:413)
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1320)
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94)
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:135)
at pluradj.titan.tinkerpop3.example.JavaExample2.main(JavaExample2.java:26)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.MasterNotRunningException
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)
... 9 more
If possible can you tell the same for cassandra also.
Look here at how to set your runtime classpath in Eclipse: How do I set the runtime classpath in Eclipse 4.2?
It appears your runtime classpath is missing jars due to the NoClassDefFoundError exception. For this specific error, locate the hbase lib directory from your hbase install and add that to your classpath.
If you use Cassandra, you'll need to set your classpath appropriately for Cassandra.
Titan's HBase client config accepts arbitrary keys from hbase-site.xml
(if it's on the CLASSPATH) and I recommend putting that in your path as well.

Java XMPP clint with smack 4.1 NoClassDefFoundError:

I am trying to write XMPP Clint using smack 4.1.1. I have added smack jar files into build path. I am using eclipse IDE to write the code.
However, when I am trying to run application I get NoClassDefFoundErrors. I fixed some of these errors adding xpp3, jxmpp and minidns jar files into the build path. Yet, I am getting the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: org/jxmpp/util/cache/ExpirationCache
at org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver.<clinit>(MiniDnsResolver.java:46)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.jivesoftware.smack.SmackInitialization.loadSmackClass(SmackInitialization.java:213)
at org.jivesoftware.smack.SmackInitialization.parseClassesToLoad(SmackInitialization.java:193)
at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:163)
at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:148)
at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:116)
at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:96)
at org.jivesoftware.smack.ConnectionConfiguration.<clinit>(ConnectionConfiguration.java:38)
at JabberSmackAPI.login(JabberSmackAPI.java:29)
at JabberSmackAPI.main(JabberSmackAPI.java:76)
Caused by: java.lang.ClassNotFoundException: org.jxmpp.util.cache.ExpirationCache
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)
... 12 more
How to fix this issue?
In the internet, it is advised to use gradle or maven for building the same. If so, can you help me how to use the same? I have never used them before.
As per below stack trace
Caused by: java.lang.ClassNotFoundException: org.jxmpp.util.cache.ExpirationCache
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)
It seem You are missing jxmpp-util-cache-0.5.0-alpha2.jar in your class path. Download and add this jar to your lib/ directory of your application .
In the internet, it is advised to use gradle or maven for building the
same. If so, can you help me how to use the same?
Create a meven project in eclipse .If you are new to meven project refer
How to create a Java project with Maven
And add Below dependencies to pom.xml of your meven build project
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smack-java7</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smack-tcp</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smack-im</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smack-extensions</artifactId>
<version>4.1.0</version>
</dependency>
For more details refer this link

Executable Scala Jar from Eclipse using Java main class

I am trying to create an executable Jar from my Scala project. Therefore, I followed a tutorial. It suggested creating a Java main class within eclipse, which calls the Scala entry point. This works fine when executing within eclipse. After adding this class I was able to export an executable jar. However, it wont work with
java -jar myjar.jar
I made sure to activate "Package required library into jar" when exporting. My Java main class looks like this (where Driver is also located in the package core)
package core;
public class Main {
public static void main(String[] args) {
Driver.main(args);
}
}
And when executing the exported char the follwing error is thrown, which I can debug:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NoClassDefFoundError: scala/collection/Seq
at core.Driver$.main(Driver.scala:14)
at core.Driver.main(Driver.scala)
at core.Main.main(Main.java:5)
... 5 more
Caused by: java.lang.ClassNotFoundException: scala.collection.Seq
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)
You could use the One-jar application to guarantee all the necessary jars are in the jarfile, I suspect the scala-lang jars are not in it or in the classpath of the command line.
Maven: https://code.google.com/p/onejar-maven-plugin/
SBT: https://github.com/sbt/sbt-onejar
If you aren't using either maven or SBT I would suggest switching to them as well as they are the main supported build systems in Scala

JOGL throwing ClassNotFoundException?

I've seen this question brought up a couple of times on this website, but never really seen a clear answer, so excuse me from repeating it. While programming with JOGL and Java3D I've encountered some errors. I was trying to create a project that I might eventually put on the Android App Store. I began the project just using Java3D and JOGL and putting them in the system library on my mac, where they worked fine. Then to try to make the project portable I moved the J3D and JOGL files inside the project so they could be compiled into a jar file that would be runnable without needing to install j3d and JOGL. But then every time I ran the project it threw this error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GL
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:73)
at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:61)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:90)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:832)
at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:274)
at javax.media.j3d.GroupRetained.<init>(GroupRetained.java:155)
at javax.media.j3d.TransformGroupRetained.<init>(TransformGroupRetained.java:116)
at javax.media.j3d.TransformGroup.createRetained(TransformGroup.java:114)
at javax.media.j3d.SceneGraphObject.<init>(SceneGraphObject.java:114)
at javax.media.j3d.Node.<init>(Node.java:172)
at javax.media.j3d.Group.<init>(Group.java:549)
at javax.media.j3d.TransformGroup.<init>(TransformGroup.java:87)
at src.Project.<clinit>(Project.java:47)
at src.ProjectPanel.<clinit>(ProjectPanel.java:8)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GL
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 java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 17 more
I'm using Eclipse as an IDE, and have the jogl-all.jar and gluegen-rt.jar files in the classpath of the project, as well as all of the require j3d jars, but it cannot find the GL.class file for some reason.
Thanks in advance for help.
When you export your application as a Runnable JAR use the
+ Library handling:
Copy required libraries into a sub-folder next to the generated JAR
or
+ Library handling:
Package required libraries into generated JAR
More information is available in the jogamp jogl wiki:
http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE
http://jogamp.org/wiki/index.php/JogAmp_JAR_File_Handling
Also you will need to use the java -jar yourapp.jar command line option to run your application.

Import LWJGL.jar error

I'm getting a new error:
Starting up
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at org.lwjgl.Sys$1.run(Sys.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:68)
at org.lwjgl.Sys.loadLibrary(Sys.java:84)
at org.lwjgl.Sys.<clinit>(Sys.java:101)
at org.lwjgl.opengl.Display.<clinit>(Display.java:128)
at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
at java.security.AccessController.doPrivileged(Native Method)
at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
at GameStarter$.main(SnakeGame.scala:43)
at GameStarter.main(SnakeGame.scala)
I have imported the lwjgl.jar libary.
This is not a problem with Scala. lwjgl consists of a part written in Java and another part that is native. The native part should be found in form of a dll (Windows) or so (*nix) file. You should put this path in the java.library.path property.
See the faq: http://lwjgl.org/faq.php#faq1