JDIC需要运行哪些文件?

发布于 2024-10-11 18:06:57 字数 2876 浏览 5 评论 0原文

我试图从我的应用程序调用 JDIC,但无法让它运行。我需要什么文件以及在哪里?从我从他们的网站收集到的信息来看,我基本上需要将 jdic.jar 放在类路径中...但是还有一个 lib 文件夹,其中包含 jdic.jar 的大小略有不同,以及 jdic_native_applet.jar、jdic_stub_unix。 jar、jdic_stub_windows.jar 和我收集的几个文件夹是特定于平台的文件。

我在实例化 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)

我尝试了最后一个“官方”版本和最后一个 alpha 版本。我运行的是 Java 6 和 Win7 64 位。 JDIC甚至可以在Win7(或64位,尽管我使用32位Java)下工作吗?我在 2006 年之后没有看到任何版本,并且在大约 2008 年之后该项目没有任何活动...而 Win7 是在 2009 年出现的。

我知道 JDIC 的某些部分(例如 Desktop)包含在 Java 6 中,但这似乎不是具有文件关联的情况。

如果没有,是否有任何(希望是跨平台的)替代方案来管理文件关联?我尝试过一些仅适用于 Windows 的东西,但这需要运行本机命令具有我不知道如何获取的管理员权限,除了要求用户以管理员身份运行我的应用程序然后使用 Runtime.exec() ...

如果没有 JDIC 的替代品,我很感兴趣是否有人管理过能够很好地处理跨平台安装程序的文件关联?

更新:好的,计算出其中的一部分... Windows 文件夹中的所有内容都需要位于根文件夹中。然而现在我得到了这个异常,这让我回到了原来的问题:

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)

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一笔一画续写前缘 2024-10-18 18:06:57

你能重新检查一下你用来运行这个的java吗?该错误通常发生在尝试从 64 位 java.util.dll 加载 32 位 dll 时。 jdic 确实可以在带有 32 位 java 的 64 位 Windows 7 上为我们工作。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文