I have successfully setup a java application that has programmatic access to VLC on a windows machine using Java. This was done using the java binding called JVLC. During this process, I encountered several difficulties and noticed that several other posts had similar problems with often no solution posted. I would therefore like to share the correct steps for setting up this project:
1. Start by downloading the JVLC jar file from the following link (at the time of this post, the version was "0.9.0-test3 date: 2008-07-27" and the file was called jvlc-core-0.9.0-SNAPSHOT-20080727.jar):
http://trac.videolan.org/jvlc/wiki/download
2. Download the matching VLC build from the nightly builds folder (it doesn't have to be this exact build but this can help avoid issues):
http://nightlies.videolan.org/build/win ... -win32.zip
3. Create a new Eclipse Java project.
4. Add a 'lib' folder to your Eclipse project.
5. Put the JVLC jar file in this folder (the file that was downloaded in step 1. It should be called jvlc-core-0.9.0-SNAPSHOT-20080727.jar).
6. Create a '3rd_party' folder.
7. Extract the vlc-0.9.0-test3-20080727-0004-win32.zip file into this folder. You should now have a project structure that looks like this:
- MyProjectName
- src
- my package 1
etc..
lib - my package 1
- src
9. Create a new class called VlcDemo.
10. Add the following code to the class:
Code: Select all
public static void main(String[] args) throws InterruptedException {
String[] param = new String[] {
"-vvv",
"--plugin-path=.\\3rd_party\\vlc-0.9.0-test3-20080727-0004\\plugins",
"--no-plugins-cache"
};
JVLC jvlc = new JVLC(param);
jvlc.play("C:\\SomeMoviePath\\AMovieName.avi");
Thread.sleep(10000) // Sleep for 10 seconds to let the movie play for a bit.
}
Select 'run', 'run configuration...'
Double click 'Java Application'
Select the 'Environment' tab
Click 'new' and enter the following information:
- Name: PATH
- Value: .\3rd_party\vlc-0.9.0-test3-20080727-0004
12. Run your project. If everything went well, you should see the movie you specified in step 10 play for about 10 seconds.
Errors I encountered that can be resolved by simply following the steps above. This hould make it easier for people who encounter these errors to find this post:
UnsatisfiedLinkError: Error looking up function 'libvlc_media_new'
- This can be solved by following the steps mentioned above. Also, if you have have been trying different solutions to this problem and other problems before reading this post, you'll want to make sure to delete any libvlc.dll that might be laying around. This was a huge problem for me as I had previously encountered several EXCEPTION_ACCESS_VIOLATIONand had read on a post that I should copy the dll file to where my app was running in order to get this to work.
- Also, if you may have read that you need to set the -Djava.library.path="path to vlc" jvm flag in order for this to work properly. I did not have to use this flag when following the steps mentioned above.
Main interface error: no interface module matched "hotkeys,none"
- Can be solved by following the above steps.
java.lang.UnsatisfiedLinkError jvlc.dll: Can't find dependent libraries
- Can be solved by following the above steps.
EXCEPTION_ACCESS_VIOLATION
- Can be solved by following the above steps.
Cheers,
Marc Stogaitis