This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Executing VLC in Java swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Executing VLC in Java swing" Watch "Executing VLC in Java swing" New topic

Executing VLC in Java swing

Adrian Lee
Ranch Hand

Joined: May 10, 2007
Posts: 71
Hi everyone. I'm not really sure whether this topic is appropriate in this forum. Please pardon me if I'm wrong.

I'm currently able to play media files using VLC in my swing program. However, it isn't working out as I wanted it to be. I'm hoping that anyone who has been using VLC in their program/project can help me understand why or how can I resolve this.

I'm building a GUI program that allows user to open and play media files(eg. movie file, music files). If its a music file, the player will not be visible and the music will play in the program UI without being noticed.

I've managed to do this by adding some command lines for it to work through Terminal*.


When I tried to make it as executable and run in java swing, It isn't running like in the Terminal. While running the program, the music will be played but with the player visible.

Attached below is the code that I've placed in my program.

Attached in file is exactly the same command line that I've used in Terminal*.

I'm using:
Fedora Core 6
VLC media player 0.8.6a
Eclipse 3.2

Thanks in advance.

Adrian Lee
[ July 20, 2007: Message edited by: Adrian Lee ]
Manuel Moons
Ranch Hand

Joined: Mar 05, 2002
Posts: 229
First of all I have to say that I do not have an immediate solution for your problem.

I am wondering however why you are not using the Java API for VLC (JVLC). Maybe this will help you to have some more control over VLC.

But if you really want to do it like you are doing at the moment, some questions come to mind. Have you tried running the .sh script itself (without java program)? Does it work correctly?

Have you tried using the runtime without the .sh script? You can also execute the vlc command directly, maybe that solves the problem.

Sorry that I cannot be more helpful.
Adrian Lee
Ranch Hand

Joined: May 10, 2007
Posts: 71
Hi Manuel. Thanks for the reply.

Sorry, I don't quite understand the installation/usage of JVLC. I've downloaded the file "org.videolan.jvlc-0.9.0-20070225-linux-x86_64.jar" from and extracted it but I don't quite understand how it works.

I've found another way to start the vlc player to play in the background. However, I've no control over it as it's using a dummy interface.

// in .sh file
vlc -I dummy --key-quit='ESC' mms://

Will be grateful if you can give me any links that can help me understand more on JVLC.

I'm still looking for ways to play music files hidden and controlling of the player..
Manuel Moons
Ranch Hand

Joined: Mar 05, 2002
Posts: 229
Hello Adrian,

Take a look at the following link for an example on how to use JVLC.

JVLC example

Again, I have only played with JVLC for a short while. I'am not sure that it fits your needs. But it seems interesting!
Adrian Lee
Ranch Hand

Joined: May 10, 2007
Posts: 71
Thanks Manuel. I will look on that.
I agree. Here's the link:
subject: Executing VLC in Java swing
Similar Threads
Questions regarding Swing
The MMAPI Player class.
Problems playing some wav audio formats using MMAPI (WTK22)
Cool software, cool logo!
MKV player for OS X