LeapMotion Java Example - Adding External Library - java

I am trying to make a java program to see it leapmotion libraries are working with Java.
I work on Eclipse (however, it didn't worked on NetBeans as well.) I created my project. Then created a subfolder named "libs" and put "LeapJava.jar" into it. An under libs folder there is a "armeabi" folder and "libLeapJava.so" and "libLeap.so" files in it. Under project properties > java build path I added LeapJava.jar as library and in my source file I did
static {
System.loadLibrary("LeapJava");
}
It didn't work for me. I still get
Native code library failed to load.
java.lang.UnsatisfiedLinkError: no LeapJava in java.library.path
These are all I tried. Can you help me with solving this problem please?

https://community.leapmotion.com/t/java-development-no-leapjava-in-java-library-path/315/5
I met with the same problem and I followed the tip from the above website:
I faced the same problem and I copied all the files from LeapMotionSDK/lib/x64 to the root directory of my netbeans project. This solved the problem.
So my solution is add those files to your classpath.
I am on Windows 8.1 and using netbeans IDE. Running on 64bit JRE.
It works for me and I hope that could help you.

Related

Issue with JavaFX file in Intellij

I'm fairly new to using JavaFX and have been tinkering with it on my own in a few simple projects.
I have to collaborate with a few others for a main project, where I am seeing this conflicting issue:
I'm having an issue with the src.zip file of javafx. On my standalone projects, I do not encounter this issue. However, since working with others, this error has appeared. Prior to this, I was getting a Kotlin plugin issue, where I had to completely disable Kotlin.
Error:java: C:\Users\nolan\Javalibs\javafx-sdk-11.0.2\lib\src.zip
I'm unsure of what this issue might mean, so any help would be appreciated.
Thank you.
I had the same problem too and discovered it was because I added the JavaFX 11 SDK to Intellij incorrectly. I initially had the added library point to just the directory /lib. Since this directory includes both the jars and src.zip, Intellij will try to run both and produce the error.
To solve this, when Intellij prompts you to "Select Library Files," you need to explicitly select the files within the /lib directory which will then be added as shown here. This will also allow proper inspection of the source code without Intellij having to decompile the class file when ctrl + left clicking a class name.
Figured this out. I extracted the src.zip in the appropriate directory (deleting the zip as well), then had to change my VM Path to include:
--module-path "C:\yourpathto\javafx-sdk-11.0.2\lib;out\production" --add-modules=javafx.controls,javafx.fxml
I forgot to add ;out\production to the Module path.
A quick rebuild then solved this issue.

Adding OCR library causes error in Eclipse

I have some trouble adding an OCR library to an existing Eclipse project. I already tried to add the Tess4J and J4L java wrappers for Tesseract-OCR and the Asprise jar-file without success. The problem is each time i want to run an application, eclipse prints javaw usage message (same issue described here: Trouble compiling any java code in Eclipse). I can run application by removing the libraries from the build path, so I'm pretty sure my java-setup is correct. In addition I already tried restarting windows, reinstalling java and eclipse with no success either. I hope somebody has a solution or at least some advice for my problem.
Finally I found a solution. There is some unclear incompatibility between J4L (or Asprise) OCR and H2 Database Engine. Removing H2's .jar file from the build path resolved the issue.

NoClassDefFoundError with Mapsforge 0.4.0 and Eclipse, cannot build

I am trying to setup a new Android project with Mapsforge. I know that people have been getting this issue because the library requires Java 7 to build. However, I am using Build-Tools verson 20, which uses Java 7. I also have the latest updated version of the Eclipse tools. In fact, I am on a clean install of the Android Developer Kit.
So far, I have imported mapsforge-core, mapsforge-map, mapsforge-map-android, mapsforge-map-awt, and mapsforge-map-reader.
I then tried to initialize a MapView using the following code:
AndroidGraphicFactory.createInstance(thisApp);
This results in the following error.
java.lang.NoClassDefFoundError: org.mapsforge.map.android.graphics.AndroidGraphicFactory
I looked in the referenced libraries, and the AndroidGraphicFactory class is defined within org.mapsforge.map.android.graphics and shows up. When looking at the jar file within /bin/dexedLibs\, the classes.dex file exists, but there is next to nothing else.
I followed the steps suggested by this answer, but the error persists.
Any ideas as to why this might be?
You need put the jar file into the libs/ folder insted of add reference on java build path.

How do I add this Change Log library to my current Android project in Eclipse?

Okay, so I'm having difficulties implementing this Change log library into my android app in eclipse: https://github.com/gabrielemariotti/changeloglib
I tried using the clone url and importing the library into eclipse and then going into the properties of my android project and adding it as a library but that didn't work. I do not have Maven installed nor do I know anything about it. Is there a way I can just get a jar of this library somewhere? Can someone please help me? Thank you!
Its most likely not setup as an Android Library project and that is why it can't be accessed that way.
You can create the jar yourself though by using: https://stackoverflow.com/a/11289115/1784299 eclipse itself or running the jar command in a terminal. (Eclipse might be a little more user friendly if you don't use the terminal.
I would however highly recommend learning how to incorporate Maven in your projects because it is a huge time saver. If you migrate to Android Studio then Maven will become your best friend.
I answer here to help other devs with the same issue.
The library is built with the Android Studio folder structure.
I highly recommend to use the gradle build system to work.
Hovewer, you can build it locally with Eclipse.
All required steps are described here:
https://github.com/gabrielemariotti/changeloglib/blob/master/doc/BUILD.md#reference-this-project-as-a-library-in-eclipse.
It can be valid for a lot of libraries.
Eclipse uses src and res as source folders. Android Studio instead uses src/main/java and src/main/res as source folders.
So you have to mark the java folder as source (right click on folder -> Build-Path -> use as source folder)

KSOP2 Librarary class not found exception

I've used KSOP2 in my project and it worked all these days. Recently I bought a new machine and moved my project to new machine and imported the ksoap library to project etc etc and when I try to run the application I get following error in the emulator
Caused by: java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
this is the place where exception is thrown.
SoapObject request = new SoapObject(namesapce, methodname);
has is something to do with 64 bit machines??
How come the app that worked all these days stopped working all of a sudden?? Can someone enlighten me please. I'm stuck with this. Thanks for your time in advance.
I had similar problem, simply I forgot to check checkbox on kosoap2 library in Java Build Path options, Order And Export tab :)
I managed to solve the problem by
Creating a folder "libs" in the project
Copying the external jars in to the folder
Refresh the folder
Go to properties -> Build path -> Add Jar (not external JAR)
Clean the project
Restart Eclipse
Boom it worked for me. Hope it'll help others too.
This may be related to the latest Android plugin and tools (r17). I read somewhere that external jar files need to be run through the dx --dex tool (because of the different binary format of Java binaries in Android), but it didn't work for me. What I ended up doing was adding the project as source instead of compiled binaries (by linking to the source from the project and adding it as a source folder.) This way Eclipse builds it properly and Android finds it during runtime.

Categories