Devlion Memo

どことなくそれっぽい大学生の日記

ArchLinuxでaurから入れたWebcamStudioが動かない

以下のようなエラーメッセージが出て、起動できなかった。

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/sun/jna/Library
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at webcamstudio.exporter.vloopback.VideoDevice.openDevice(VideoDevice.java:113)
    at webcamstudio.exporter.vloopback.VideoDevice.loadInfo(VideoDevice.java:107)
    at webcamstudio.exporter.vloopback.VideoDevice.(VideoDevice.java:103)
    at webcamstudio.exporter.vloopback.VideoDevice.getDevices(VideoDevice.java:82)
    at webcamstudio.exporter.vloopback.VideoDevice.getInputDevices(VideoDevice.java:41)
    at webcamstudio.components.OutputPanel.paintWSCamButtons(OutputPanel.java:990)
    at webcamstudio.components.OutputPanel.(OutputPanel.java:169)
    at webcamstudio.WebcamStudio.(WebcamStudio.java:120)
    at webcamstudio.WebcamStudio$35.run(WebcamStudio.java:3107)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
    at java.awt.EventQueue.access$300(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:706)
    at java.awt.EventQueue$3.run(EventQueue.java:704)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Library
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 35 more

どうやらクラスを検索するパスの設定がうまく行っていないらしい。

そこで、ここから、jna.javaファイルをダウンロードし、/usr/share/javaディレクトリ以下に配置する。

次に、ここからソースコードを取ってきて、manifest.mfファイルに以下の内容を追記する。

Class-Path: ../libraries/AbsoluteLayout-7.0.jar ../libraries/AppFramework-1.03.jar ../libraries/commons-cli-1.2.jar ../libraries/commons-codec-1.6.jar ../libraries/commons-httpclient-3.1.jar ../libraries/commons-io-2.2.jar ../libraries/commons-lang3-3.1.jar ../libraries/jcl-over-slf4j-1.6.5.jar ../libraries/jffmpeg-1.1.0.jar ../libraries/jna-platform-3.2.7.jar ../libraries/jna-3.2.7.jar ../libraries/jsr305-0.1~+svn49.jar ../libraries/jtwitter.jar ../libraries/log4j-1.2.16.jar ../libraries/mail.jar ../libraries/netty-3.2.6.Final.jar ../libraries/slf4j-api-1.6.5.jar ../libraries/slf4j-log4j12-1.6.5.jar ../libraries/swing-worker-1.1.jar ../libraries/zxing-core.jar ../libraries/zxing-javase.jar /usr/share/java/jna.jar

最後に、

ant clean jar

を実行すれば、dist以下に正常に起動するjarファイルが作成される。
あとは、AURからインストールしたWebcamStudio.jarファイルと置き換えてしまえば良い。