• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Running media player from the program

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.i just want to run a mediaplayer from my program.How can i do this in java.IN C/C++ we have System command that fullfills the purpose.How can i perform the same function from java
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi faisal siraj ,

you can run media player by two ways
1 using processbuilder object this works only with java1.5

PrcocessBuilder pb=new ProcessBuilder("spceify path of wmplayer");
now call (i am not explaining other features of processbuilder like how to set directory and how to set environment variable because i also dont know and no one from java ranch explain me!!! )
pb.start();
it will start media palyer

start method returns process object using this object you can controll that process like closing ,destroying etc.

for java1.4

use runtime class
code
Runtime r=Runtime.getRuntime();
now usig this runtime object call exe method
r.exec("specify path of wmpalyer");

ok by....







 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic