ranganath.tm
ranganath.tm

Reputation: 93

Launch VLC Player through Java

I want to launch my VLC player through a Java program, can any one help me? Thanks in advance.

Upvotes: 5

Views: 9889

Answers (5)

user285594
user285594

Reputation:

Use VLCJ. Here is the new link

Upvotes: 4

Dot NET
Dot NET

Reputation: 4897

You'll need to specify an absolute path to the program, which might be a problem if you do not know where VLC is stored.

Upvotes: 0

Oskar Kjellin
Oskar Kjellin

Reputation: 21880

Vlc is located on different places depending on your system, but this is for 64 bit

ProcessBuilder pb = new ProcessBuilder("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe", "file to start with vlc");
Process start = pb.start();

and this should work for x86:

ProcessBuilder pb = new ProcessBuilder("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe", "file to start with vlc");
Process start = pb.start();

Upvotes: 3

davorp
davorp

Reputation: 4236

public class Test {
   public static void main(String[] args) throws IOException, InterruptedException {
      Runtime.getRuntime().exec("\"E:\\Program Files\\VideoLAN\\VLC\\vlc.exe\"");

      System.out.println("VLC started.");

   }
}

Upvotes: 0

ŁukaszBachman
ŁukaszBachman

Reputation: 33735

You might want to try this sample of code:

Runtime.getRuntime().exec("path_to_your_VLC_exe");

Unfortunately you will need to have an absolute path to your executable file, which sometimes cannot be obtained.

Look here for more examples: http://www.rgagnon.com/javadetails/java-0014.html

Upvotes: 0

Related Questions