VLCJ: Packaged Jar cant load libvlc library when double-clicked but runs perfectly through console

StackOverflow https://stackoverflow.com/questions/13788897

  •  06-12-2021
  •  | 
  •  

Frage

I have a problem with vlc.I am using Eclipse and have made a small application to play video files using vlcj framework.Inside Eclipse everything works fine but when I make jar executable file through Eclipse and double-clicking it (on Windows 64: Tested only on this platform) nothing happens .Then I'm trying using "cd myjarfilepath" and then "java -jar myjarname.jar" and everything works fine.Why this is happening and how to solve it?

Thanks in advance to stackoverflow's community .

Edit:

In Path Location: C:\Users\user\Documents\31\Latest_Win64\Needed I have the following files:

plugins(directory)  
axvlc.dll  
axvlc.dll.manifest  
libvlc.dll  
libvlc.dll.manifest  
libvlccore.dll  
npvlc.dll  
npvlc.dll.manifest  
vlc.exe.manifest  

In my classpath i have included the following files:

jna-3.5.1.jar  
platform-3.5.1.jar  
vlcj-2.2.0.jar  
vlcj-2.2.0-javadoc.jar  
vlcj-2.2.0-sources.jar  
War es hilfreich?

Lösung

This sounds like an issue loading the needed VLCj files. Not only are dlls required but the plugin directory is also required. As the execution location moves around from inside eclipse to back in the file system, the path to these files may be getting set incorrectly.

It sounds like you have it working within eclipse. This would indicate to me that what you have should work. Firstly, I would recommend acquiring the VLC dlls, etc., by providing this as a VM argument such as shown below, rather that setting it in code. Remember to comment out any loading you are doing in your code so that you are relying on the command line argument.

-Djna.library.path={Application Location}/lib
example: -Djna.library.path=C:/myapp/lib


Directory Contents:
lib
-- libblc.dll
-- libvlc5.dll
-- {etc}
/plugins
   /3dnow
   /access
   {etc}

If you are still having issues, add the following argument to put VLCj into debug mode. This can be very helpful to determine where things are failing.

-Dvlcj.log=DEBUG

Hope that helps.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top