java lwjgl eclipse set up error - java

Error
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in
java.library.path at java.lang.ClassLoader.loadLibrary(Unknown
Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at
java.lang.System.loadLibrary(Unknown Source) at
org.lwjgl.Sys$1.run(Sys.java:73) at
java.security.AccessController.doPrivileged(Native Method) at
org.lwjgl.Sys.doLoadLibrary(Sys.java:66) at
org.lwjgl.Sys.loadLibrary(Sys.java:95) at
org.lwjgl.Sys.(Sys.java:112) at
org.lwjgl.opengl.Display.(Display.java:132) at
ColoredTriangle.start(Test3d.java:12) at Test3d.main(Test3d.java:71)
I added jar and native library. still its not working. i dont know why. image attached
How to fix it?

Re-try doing it, also maybe there's so something wrong with your path setup, try doing it with this: http://lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_Eclipse

I don't undestand how this solution worked.
But just add this in the start of the main function or something.
System.setProperty("org.lwjgl.librarypath", new File("Path to library/natives/youros").getAbsolutePath());
Note: I got this solution from somewhere else.

Related

Exported a project and getting this error

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:95)
at org.lwjgl.Sys.<clinit>(Sys.java:112)
at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
at renderEngine.DisplayManager.createDisplay(DisplayManager.java:23)
at engineTester.MainGameLoop.main(MainGameLoop.java:45)
this is the error that i get saying that there is no lwjgl how could i fix this
I got this error after I exported the project since when i had it in the jde it worked just fine
java -jar Ecosistembio.jar -Djava.library.path=C:\Users\User\Desktop\Eco\lib
This is the command i have tried using thought its to no result
Your path no have the necessary dependency(artifact) for the Ecosistembio.jar.
Check this https://stackoverflow.com/a/6092576/10354937

How to remove this Exception "Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_objdetect in java.library.path"

I'm working on Face Recognition Project by using OpenCV 2.4.9, JavaCV 0.7,JAVA version 8 and Eclipse IDE... I am getting these Exceptions continuously.. Is there something wrong in the follwoing code? It's not my complette code...
Please Someone help me as soon as possible...
import com.googlecode.javacpp.Loader;
import com.googlecode.javacv.cpp.opencv_objdetect;
Loader.load(opencv_objdetect.class);
Exceptions:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_objdetect in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:586)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_objdetect.<clinit>(opencv_objdetect.java:91)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.googlecode.javacpp.Loader.load(Loader.java:561)
at FaceRecognizer.<init>(FaceRecognizer.java:56)
at FaceRecognizer.main(FaceRecognizer.java:112)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\XYX\AppData\Local\Temp\javacpp183187286948746\jniopencv_objdetect.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:700)
... 8 more
This page gives a description of how to get an OpenCV Java sample running. There should be two things that you need to do:
You need to call System.LoadLibrary specifying the OpenCV DLLs that it uses
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Make sure the DLL in somewhere where it can be found by the JVM. There are a few ways if doing that. I don't use Eclipse but this seems to give a good explanation. Alternatively, a simple bodge just to get things working is to drop the DLL into the windows\system32 directory
Finally there may be an issue if you are running a 64 bit JVM but trying to use a 32 bit DLL. If you are still having trouble make sure you are using matching JVM and DLL.
It looks like one of the java libraries that you are using in your project is using jni calls that uses dll files. Do you have the library installed correctly? It looks like it is called opencv or something that is related to jniopencv_objdetect.dll

exception when using tesseract ocr by java

i am trying to use tesseract ocr and ive got this exception while running it on eclipse.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
at net.sourceforge.tess4j.util.LoadLibs.copyJarResourceToDirectory(Unknown Source)
at net.sourceforge.tess4j.util.LoadLibs.extractTessResources(Unknown Source)
at net.sourceforge.tess4j.util.LoadLibs.<clinit>(Unknown Source)
at net.sourceforge.tess4j.TessAPI.<clinit>(Unknown Source)
at net.sourceforge.tess4j.Tesseract.init(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at Run.main(Run.java:42)
exception throwing code is -
Tesseract instance = Tesseract.getInstance();
try {
String captcha = instance.doOCR(image);
System.out.println(captcha);
first line is 40.
it used to say 40 in the problem but now after playing with it it says 42.
ive got tess4j.jar , jai_imageio , jna.jar as referenced libs.
what do i need to do to make the OCR work?
`org/apache/commons/io/FileUtils`
It appears as if you don't have Apaches commons-io.jar. You can find it: http://commons.apache.org/proper/commons-io/
It seems you need to download the Commons IO package and add it to your class path.
Add Commons IO as referenced libs too.

Trying to make java application (Executable Jar) that uses OpenCV portable. Getting unsatisfied link error

I have made a application to grab video from a webcam and detect motion using OpenCV and JavaCV. I am trying to export as an executable jar using eclipse. The program runs fine in eclipse as does the exe jar on the computer I coded the program on.
What I am trying to accomplish is to make the exe Jar run on computers that don't have OpenCV installed. Basically what I would consider a portable application. When I run the exe jar on a different computer that has nothing installed other than the JRE I get unsatisfied link errors seen below.
Exception in thread "Video Thread" java.lang.UnsatisfiedLinkError: C:\Users\JohnD\AppData\Local\Temp\javacpp91062429652918\jniopencv_core.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:566)
at com.googlecode.javacpp.Loader.load(Loader.java:489)
at com.googlecode.javacpp.Loader.load(Loader.java:431)
at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:136)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.googlecode.javacpp.Loader.load(Loader.java:453)
at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:97)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.googlecode.javacpp.Loader.load(Loader.java:453)
at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:85)
at com.googlecode.javacv.OpenCVFrameGrabber.start(OpenCVFrameGrabber.java:174)
at VideoPanel.run(VideoPanel.java:163)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: no opencv_core244 in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
at com.googlecode.javacpp.Loader.load(Loader.java:481)
... 13 more
I have looked for a solution to what I am doing wrong. Most of the topics I have come across with unsatisfied link errors like the ones I am receiving have been trying to get it to run the first time through within there IDE, which is not the case here. I would think my dependencies are correct in the libraries in the build path since I can get it to run perfectly when I am on the computer that has everything installed but I still believe I am doing something wrong with the build.
Again I am trying to make it so the Jar can run on computers where OpenCV/JavaCV is not installed. Any help would be greatly appreciated.
If opencv is not installed in the target machine, than you need to deliver the necessary opencv's dll file and set the corresponding library path, opencv is a precondition of javacv
for example:
jar yourapp.jar -Djava.library.path="/path/to/OpenCV/library"
also check this answer

jpcap installation error

I installed jpcap library when i run my program I got this error. I am sure that add jpcap.jar and jpcap.dll to correct directory but i do not know what is the problem!
anyone know what is the erorr?
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\Java\jre7\bin\jpcap.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at jpcap.JpcapCaptor.<clinit>(JpcapCaptor.java:251)
at EWMAStableIP.getNumOfNewIPs(EWMAStableIP.java:106)
at EWMAStableIP.initial(EWMAStableIP.java:343)
at Frame.initialize(Frame.java:78)
at Frame.<init>(Frame.java:52)
at Frame$1.run(Frame.java:39)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
When you load native library like .so on Linux or .dll on Windows using System.loadLibrary() it looks for those shared library in both PATH environment variable and java.libarary.path system property, if it doesn't find shared library it throws "Exception in thread "main" java.lang.UnsatisfiedLinkError: no in java.library.path". now trick is that in Windows it picks up dll form System32 folder and most of the time System32 exits in path so we don't usually come up with this problem. anyway if you are repeatedly getting this Error than you can try following step which may help you to resolve java.lang.UnsatisfiedLinkError in your java application.
Try Following these steps :
1) Check your PATH for Java , whether it contains required dll or not.
2) Verify your java.library.path in case you have set it for required dll.
3) Run your java application with command : java -Djava.library.path= "your dll path"
4) Try specifying base name for the library and loading library using System.loadLibaray("name) where name is without dll.
5) Linux loads dynamic linked library(.so) from LD_LIBRARY_PATH so you may want to have your shared library directory included in LD_LIBRARY_PATH e.g.
6) load library by providing absolute path like "C:/WINNT/system32/digest.dll"
export LD_LIBRARY_PATH=/shared library (.so)
Main point is JVM should find your dll and providing explicitly path with -Djava.library.path always help me.
Some other points worth noting while working with System dependent libraries:
1) They make java code platform dependent.
2) System.loadLibrary() is equivalent to Runtime.getRuntime.loadLibary().
3) load System.loadLibary(libary) in static initalizer block so that it only gets loaded when containing class gets loaded and
avoid reloading of it.
Another worth noting point is the actual error message java.lang.UnsatisfiedLinkError throws:
if it shows "Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path" means JVM is not able to locate and load library.
if it shows thread "main" java.lang.UnsatisfiedLinkError: com......' i.e. prints class or method name than may be something is wrong with library itself like half copied dll.
Some time you may also get
Exception in thread "main" java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: digest.dll
at java.lang.Runtime.load0(Runtime.java:767)
at java.lang.System.load(System.java:1003)
to solve this just provide absolute path for library and you will be fine.
That’s all on how to fix Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path" , share your experience if you have faced this java.lang.UnsatisfiedLinkError before.
Refered here
Probably you run 64-bit jpcap on a 32-bit wincap ..
Please reinstall wincap and ensure that jpcap and wincap both have the same 'bits' with jdk.

Categories

Resources