I am using QtJambi port of Qt to Java and when launching my application it requires the corresponding dll files.
Loading library: 'qtjambi.dll'...
- using 'java.library.path'
at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(Unknown
at com.trolltech.qt.internal.NativeLibraryManager.loadLibrary(Unknown Source)
at com.trolltech.qt.Utilities.loadJambiLibrary(Unknown Source)
at com.trolltech.qt.QtJambi_LibraryInitializer.<clinit>(Unknown Source)
... 7 more
Caused by: java.lang.RuntimeException: Library 'qtjambi.dll' wasn't found in PATH
Now, what would be the best way to configure my project (in IntelliJ IDEA) so that it would automatically use the provided dll files?
I don't want to modify the PATH or something like that, because I want this to be project-only solution, unrelated to the OS settings.
Thank you
Set the Java system property java.library.path -- i.e.,
-Djava.library.path=/wherever/the/dll/is
Set this in the run configuration you use to launch your software.
Related
I'm trying to run the GeoTools ImageLab.java exmaple. It works fine inside Eclipse and I'm using Maven as in the instructions. I'm trying to load a GeoTIFF. But when I use Eclipse to build a runnable jar file and run that from a DOS command line I get:
Jun 11, 2018 6:49:57 PM it.geosolutions.imageio.gdalframework.GDALUtilities loadGDAL
WARNING: Failed to load the GDAL native libs. This is not a problem unless you need to use the GDAL plugins: they won't be enabled.
java.lang.UnsatisfiedLinkError: no gdaljni in java.library.path
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.UnsupportedOperationException: Trying to get a reader from an unknown format.
at org.geotools.coverage.grid.io.UnknownFormat.getReader(UnknownFormat.java:53)
at org.geotools.tutorial.raster.ImageLab.displayLayers(ImageLab.java:103)
at org.geotools.tutorial.raster.ImageLab.getLayersAndDisplay(ImageLab.java:87)
at org.geotools.tutorial.raster.ImageLab.main(ImageLab.java:61)
The JNI reference makes me think I need a gdal dll file, but I'm having trouble finding one if that's the case.
All help appreciated! Thanks in advance.
If you are using the gt-imageio-ext-gdal module then you will need to make sure that the JVM can see your gdal libraries and that they are the exact version expected by the module. There are detailed instructions on how to install that on the related GeoServer page.
However, for a simple GeoTiff there is no need for GDAL as this is handled by the gt-geotiff module.
Finally, if you are trying to build a single jar application you should make sure you have read and understood this FAQ entry.
I am running my Java-FX application via webstart by tomcat server.
After signing and versioning of jars I having this problem when am accessing it through web browser.
I am using jnlp and version protocol to start the application through tomcat server.
ExitException[ 3]com.sun.deploy.net.FailedDownloadException: Unable to load resource:
(httP://127.0.0.1:8080/gyms/lib/commons-collections-3.2.1.jar?version-id=1.0.1, 1.0.1)
at sun.plugin2.applet.JNLP2Manager.downloadResources(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.prepareLaunchFile(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
It seems you are using a jnlp-file with a line like this:
<jar href="commons-collections-3.2.1.jar" version="1.0.1" />
So you are using the version-based download protocol. This will result in the server looking for a file called commons-collections-3.2.1__V1.0.1.jar which apparently is not there.
Bottom line: do not specify two conflicting version-numbers in your jnlp. Decide wether you want to use versioned download and omit the version-number in the href-attribute or use simple download and omit the version-attribute.
Problem is solved because I am using Java 1.7.51 update and also i am usin third api which is not supported in java 8 which is also installed in my desktop.
The program(x86) should not have any version of java greater than java 7 as the application is taking java/bin from x86 only.
that is why that failed download exception is coming at run time.
I'm taking over this guy application and he left me pretty much nothing, even the coding is not commented. With luck (and a bit of time), I was able to improve the app and make it run like a charm on my computer.
But I'm having a problem, which is annoying and prevent me from upgrading the app. My app can run fine on any machines installed with java version 1.7.0_21, but when I update to newer version (for now it's 1.7.0_60), the app can not run, it just keeps having this stupid error and I can not do anything to fix it.
Here is the error log:
RenderJob.run: internal exception
java.lang.UnsatisfiedLinkError: com.sun.prism.d3d.D3DContext.nSetBlendEnabled(JZ
Z)I
at com.sun.prism.d3d.D3DContext.nSetBlendEnabled(Native Method)
at com.sun.prism.d3d.D3DContext.initState(D3DContext.java:84)
at com.sun.prism.d3d.D3DResourceFactory.<init>(D3DResourceFactory.java:5
7)
at com.sun.prism.d3d.D3DPipeline.createResourceFactory(D3DPipeline.java:
150)
at com.sun.prism.d3d.D3DPipeline.getD3DResourceFactory(D3DPipeline.java:
156)
at com.sun.prism.d3d.D3DPipeline.findDefaultResourceFactory(D3DPipeline.
java:182)
at com.sun.prism.d3d.D3DPipeline.getDefaultResourceFactory(D3DPipeline.j
ava:204)
at com.sun.prism.GraphicsPipeline.getDefaultResourceFactory(GraphicsPipe
line.java:97)
at com.sun.javafx.tk.quantum.QuantumRenderer$3.run(QuantumRenderer.java:
143)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at com.sun.prism.render.RenderJob.run(RenderJob.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Quantu
mRenderer.java:98)
at java.lang.Thread.run(Unknown Source)
I found another issue which is similar
Unable to deploy JavaFX applicaiton with external libraries in a JAR
but I can not apply that in my case since this program/framework need to run from a .bat file (which is command line actually) to creat a bunch of report files and folders.
Wich JavaFX version you have attached to your app?
I suspect the attached JavaFX version is not compatible with 1.7.0_60. I had some equal issues with that.
But the exception is new to me (its some internal prism stuff)
It has been my experience that the JFXRT jar is tightly coupled to the JRE/JDK version.update that it comes bundled with (in the case of oracles jvm). This means that the application needs to be ran on a jvm version.update as it was pulled from. You should be able to work around this by using the prescribed methods of building found here, http://docs.oracle.com/javafx/2/deployment/packaging.htm.
I've looked through a number of the UnsatisfiedLinkError threads on here and nothing seems to quite fit my problem.
I am trying to get this api working: 7ZipBind
However I am having an issue, and cant get the thing to work. I am running some of its example code from the commandline like so:
C:>java -classpath
"/sevenzipTest.jar;/sevenzipjbinding-AllWindows.jar;\sevenzipjbinding.jar"
com.poc.sevenzip.SevenZipSimple c:\archive\test.zip
However when I try to run it I get the error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Users\XXXX\AppData\Local\Temp\SevenZipJBinding-9640553\lib7-Zip-JBinding.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 net.sf.sevenzipjbinding.SevenZip.initSevenZipFromPlatformJARIntern(SevenZip.java:428)
at net.sf.sevenzipjbinding.SevenZip.initSevenZipFromPlatformJAR(SevenZip.java:235)
at net.sf.sevenzipjbinding.SevenZip.ensureLibraryIsInitialized(SevenZip.java:578)
at net.sf.sevenzipjbinding.SevenZip.openInArchive(SevenZip.java:567)
at com.poc.sevenzip.SevenZipSimple.runZip(SevenZipSimple.java:25)
at com.poc.sevenzip.SevenZipSimple.main(SevenZipSimple.java:64
What I am confused about, is why it says it cant locate the libraries (dll files), when the libraries are stored within the <file_path>/sevenzipjbinding-AllWindows.jar file... I am obviously not doing something correct here, and was hoping some1 can give me some pointers.
Cheers
The bug fix was released. Please, use version 1.06rc or above.
Download URL:
All versions
4.65-1.06rc-extr-only
The following instructions are for Windows x86 and 7 Zip JBinding version 4.65-1.05 RC. Download the following DLLs.
libstdc++-6.dll
libgcc_s_dw2-1.dll
gpsvc.dll
sysntfy.dll
Add the DLLs into the Windows-x86 directory in sevenzipjbinding-AllPlatforms.jar. Then append the following lines to sevenzipjbinding-lib.properties in the Windows-x86 directory in the jar.
sevenzipjbinding.libname.3=gpsvc.dll
sevenzipjbinding.libname.4=libgcc_s_dw2-1.dll
sevenzipjbinding.libname.5=libstdc++-6.dll
sevenzipjbinding.libname.6=sysntfy.dll
Instead of modifying the jar file, one could put the DLLs in the PATH (not classpath).
In order to figure this out, I extracted lib7-Zip-JBinding.dll from sevenzipjbinding-AllPlatforms.jar. I then opened the file in Dependency Walker.
In my project I want to capture image from my webcam.
I configured step by step following the instructions from this "OpenCV-JavaCV : eclipse project configuration windows 7" blog post.
After configuration is finished, i tested samples codes and the application found my webcam
SETUP: Setting up device 0
SETUP: Namuga 1.3M Webcam
SETUP: Couldn't find preview pin using SmartTee
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.
and then i got an error which is .dll error.
I use windows 7 x64.
Exception in thread "Thread-2" java.lang.UnsatisfiedLinkError: C:\Users\Administrator\AppData\Local\Temp\javacpp153028723186\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:418)
at com.googlecode.javacpp.Loader.load(Loader.java:368)
at com.googlecode.javacpp.Loader.load(Loader.java:315)
at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.googlecode.javacpp.Loader.load(Loader.java:334)
at com.googlecode.javacpp.Loader.load(Loader.java:315)
at com.googlecode.javacv.cpp.opencv_core$CvArr.<clinit>(opencv_core.java:158)
at com.googlecode.javacv.VideoInputFrameGrabber.grab(VideoInputFrameGrabber.java:158)
at GrabberShow.run(GrabberShow.java:24)
at java.lang.Thread.run(Unknown Source)
How can i solve this problem?
Check whether your Opencv version and JavaCv versions are matching each other. You can check that on the readme file on javacv-bin it specifically say about the required version of the opencv.
Unsatisfied link means that not all native code libraries required by jniopencv_core.dll could be found.
Did you deploy them all or just jniopencv_core.dll?
I faced this problem on Windows XP and Windows 7, and this is how I fixed it on both platforms, using Netbeans 7.2:
Install all required software:
FFmpeg (32-bit shared): Zeranoe FFmpeg offers win32 builds. Download and extract ffmpeg-20121020-git-04bf2e7-win32-shared.7z. Place its content at C:\ffmpeg.
Note: make sure C:\ffmpeg\bin is a valid path.
OpenCV 2.4.2 (32-bit): download OpenCV-2.4.2.exe and extract it. Place its content at C:\opencv.
Note: make sure C:\opencv\build\x86\vc10\bin is valid path.
JavaCV 0.2: download javacv-0.2-bin.zip and extract it. Move the extracted folder to C:\javacv-bin.
Microsoft Visual C++ redistributable package (32-bit): download and install vcredist_x86.exe.
Configure the environment:
Edit the environment variable PATH and append the following paths at the end:
C:\ffmpeg\bin;C:\opencv\build\x86\vc10\bin
Now you ready to create a new Netbeans project and test your application. But before you compile it,dDon't forget to right-click the Libraries folder at the pProjects window* and click Add Jar/FOLDER to select all the .jar files located at C:\javacv-bin.
Make sure you have the vm arg -Djava.library.path=<path-to-native> that points to the directory with your dlls.