What files does JDIC need to run? - java

I'm trying to call JDIC from my application, but I can't get it to run. What files do I need and where? From what I've been able to gather from their site, I basically need to put jdic.jar in classpath... however there is also a lib folder with jdic.jar with a bit different size, and jdic_native_applet.jar, jdic_stub_unix.jar, jdic_stub_windows.jar and several folders with what I gather are platform specific files.
I get this exception when instantiating AssociationService:
java.lang.ClassNotFoundException: org.jdesktop.jdic.filetypes.internal.AppAssociationReaderFactory_windows
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 java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at org.jdesktop.jdic.filetypes.AssociationService.<init>(Unknown Source)
at QuickTest.main(QuickTest.java:101)
I've tried last "official" release and last alpha release. I'm running Java 6 and Win7 64bit. Does JDIC even work under Win7 (or 64bit, although I use 32bit Java)? I see no release after 2006, and no activity in the project after about 2008... while Win7 came in 2009.
I know that parts of JDIC, like Desktop, were included in Java 6, however that doesn't seem to be the case with file associations.
And if it doesn't, are there any (hopefully cross-platform) alternatives for managing file associations? There are some things for Windows only that I tried, but that requires running native commands with administrator privileges which I don't know how to pull, apart from asking user to run my app as administrator and then use Runtime.exec()...
If there are no alternatives to JDIC, I'm interested if anyone has managed to handle file associations well with cross-platform installers?
UPDATE: OK, figured part of it... everything from windows folder needs to be in root folder. However now I get this exception which brings me back to my original question:
Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Sources\TheWorkspace\Test\jdic.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at org.jdesktop.jdic.init.JdicManager$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.jdesktop.jdic.init.JdicManager.loadLibrary(Unknown Source)
at org.jdesktop.jdic.filetypes.internal.WinRegistryWrapper.<clinit>(WinRegistryWrapper.java:36)
at org.jdesktop.jdic.filetypes.internal.WinRegistryUtil.isSubKeyExist(WinRegistryUtil.java:192)
at org.jdesktop.jdic.filetypes.internal.WinRegistryUtil.isFileExtExist(WinRegistryUtil.java:910)
at org.jdesktop.jdic.filetypes.internal.WinRegistryUtil.isFileExtExist(WinRegistryUtil.java:939)
at org.jdesktop.jdic.filetypes.internal.WinAppAssociationReader.isFileExtExist(WinAppAssociationReader.java:163)
at org.jdesktop.jdic.filetypes.AssociationService.getFileExtensionAssociation(Unknown Source)
at QuickTest.main(QuickTest.java:103)

Can you recheck the java you are using to run this? The error typically occurs when trying to load a 32-bit dll from a 64-bit java. jdic does work for us on 64-bit Windows 7 with 32-bit java.

Related

leiningen cannot run because of java class not found exception

I recently--as in, today--became interested in learning to program with clojure. Now after having installed the latest version of java's jdk and downloading the leiningen script, I followed the installation instructions for the latter, specifically those given at: http:/www.lispcast.com/clojure-ubuntu.
Now, after the running lein version and downloading the relevant jar file, the program exits with an error about a class not being found. The error in question reads as follows:
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)>
at clojure.lang.RT.classForName(RT.java:2168)
at clojure.lang.RT.classForName(RT.java:2177)
at clojure.lang.RT.loadClassForName(RT.java:2196)
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:419)
at clojure.core$load$fn__5677.invoke(core.clj:5893)
at clojure.core$load.invokeStatic(core.clj:5892)
at clojure.core$load.doInvoke(core.clj:5876)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core__init.load(Unknown Source)
at clojure.core__init.(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at clojure.lang.RT.classForName(RT.java:2168)
at clojure.lang.RT.classForName(RT.java:2177)
at clojure.lang.RT.loadClassForName(RT.java:2196)
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:419)
at clojure.lang.RT.doInit(RT.java:461)
at clojure.lang.RT.(RT.java:331)
at clojure.main.(main.java:20)
Caused by: java.lang.ClassNotFoundException: java/sql/Timestamp
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at clojure.lang.RT.classForName(RT.java:2168)
at clojure.lang.RT.classForNameNonLoading(RT.java:2181)
at clojure.instant$loading__5569__auto____6869.invoke(instant.clj:9)
at clojure.instant__init.load(Unknown Source)
at clojure.instant__init.(Unknown Source)
... 23 more
My java 9 jdk is installed in /usr/lib/jvm/java-9-oracle/bin/java, with my JAVA_HOME variable set to /usr/lib/jvm/java-9-oracle but I tried /usr/lib/jvm/java-9-oracle/bin as well, just in case. I am running xubuntu 16.04.3, if this is of any importance. I did try setting the default java jdk back to the openjdk which is bundled with xubuntu but this also was to no avail.
As an aside, the entire problem originated because I tried running the REPL
in intellij after installing the cursive plugin, which didn't work. I then surmised that it might be because I had not installed leiningen beforehand (I thought that the IDE and cursive would have this bundled along). However, the actual information on what intellij and clojure require to run successfully has eluded me, since much of the information is rather 'scattered' and I'm not sure whether I missed something along the way.
In any case, I am having quite a hard time of getting everything to work--probably because I'm not yet that savvy when it comes to these kinds of issues, having only been on a linux distro for a short while as well as being completely unfamiliar with clojure. If I'm missing something obvious, I apologize, but it stands to reason that something can only be obvious once it is shown to be so.
Any and all suggestions will be greatly appreciated.
That looks like a problem caused by Java 9's new concept of "modules": Clojure expects to be able to access java.sql.Timestamp, but it can't. I haven't kept up with Java development or Clojure development, so I can't say for sure that's your problem, but it looks that way to me. Try with an earlier JDK.
If you cant downgrade your JAVA version, run lein upgrade 2.8.1 or the latest Leiningen would do. Leiningen has been updated to include support for Java 9.

Java Module Issues

Hey I am making a game in java using slick and run into all these errors. It works on my friend's computer but not on mine. I've tried on both mac and pc.
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
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 Game.start(Game.java:37)
at Main.main(Main.java:5)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
What does above exception mean??
I do have it in my class path.
The error message explains it all, you dont have a LWJGL on your classpath. You need to install it so as to get it working on your system.
Also you need to point the jvm to the location where the native files are located using a command line parameter -Djava.library.path="path/to/natives". JarSplice is an alternative to this
You may check this for details
The lwgjl native library cannot be found and loaded. Set the path to the folder where lwjgl.dll (if on Windows, on Mac probably liblwjgl.so) is located, with -D, for instance
java -Djava.library.path=C:\Java\ljwgl\libs com.mypackage.MyProgram
The library files must have a permission to be executed. Some computers may be configured to suppress any execution from USB stick so check.
If still does not work, try to call System.load(String fullFilePath) from your code, pointing to the location where the file clearly exists. If this works at the end, you can use this function to load library without name alterations and path assumptions. If does not, it may be wrong achitecture (64 vs 32 bit, permission problems (not executable) or the library file is just broken.

Javafx application can not launch when migrating from java 7u21 to higher version

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.

JavaCV-OpenCV error

I want to capture my webcam on a easy way into Java.
I followed this tutorial with JavaCV and OpenCV: http://ganeshtiwaridotcomdotnp.blogspot.com/2011/12/opencv-javacv-eclipse-project.html
I get this error when trying some example code:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Francis\AppData\Local\Temp\jniopencv_core7109340164936655704.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1003)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:403)
at com.googlecode.javacpp.Loader.load(Loader.java:342)
at com.googlecode.javacpp.Loader.load(Loader.java:316)
at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.googlecode.javacpp.Loader.load(Loader.java:335)
at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:96)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.googlecode.javacpp.Loader.load(Loader.java:335)
at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:91)
at com.googlecode.javacv.OpenCVFrameGrabber.start(OpenCVFrameGrabber.java:171)
at beeldherkenningp1.CaptureImage.captureFrame(CaptureImage.java:13)
at beeldherkenningp1.BeeldherkenningP1.main(BeeldherkenningP1.java:37)
But al my jar's are included, Microsoft Visual C++ 2010 Redistributable Package is installed, extracted OpenCV into root and my system Path is set correct... (tryed already several times to reinstal the Visual C++ Redistributable Package). (x64 bit, does it matter Netbeans is x86?)
Or does anybody know an other lib that easily captures a cam in java?
Thanks a lot!
I am the one who wrote the tutorial that you're following.
Exception in thread "main" java.lang.UnsatisfiedLinkError:
C:\Users\Francis\AppData\Local\Temp\jniopencv_core7109340164936655704.dll:
Can't find dependent libraries
It looks like the dll library is not in environment variable path because you didn't properly added the path of opencv. Or this might be issue because you have installed both x64 and x86 version of thet Visual C++ redistribuables that Romain is saying.
I suggest you to follow the steps I described here JavaCV : eclipse project configuration windows ? and Add the following to System Path ?
Configure path
64-bit version of the JDK:
[installation path]\build\common\tbb\intel64\vc10\;C:\opencv\build\x64\vc10\bin\;
32-bit version of the JDK:
[installation path]\build\common\tbb\ia32\vc10\;C:\opencv\build\x86\vc10\bin\;
Here [installation path] might be "C:\opencv"
Hope this helps.
UPDATE:
An easier and simpler step to configure JavaCV is available. Please check the link below:
http://ganeshtiwaridotcomdotnp.blogspot.com/2017/01/javacv-configuration-in-windows.html

7Zip-JBinding UnsatisfiedLinkError

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.

Categories