Open Windows Media Player through Java program

I need to open a video and some music in windows media player... but I don't know how....Can anybody help?
[121 byte] By [lardmana] at [2007-11-26 15:53:18]
# 1
I don't usually use Windows Media Player, but when I do, I usually click on the correct icon in the start menu.
CaptainMorgan08a at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 2
I need to open it through my program...sorry... forgot that little detail.
lardmana at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 3
> I need to open it through my program...Well you should say so! It's not too difficult. I little searching on google should show you how to do it.
CaptainMorgan08a at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 4
> I> little searching on google should show you how to do> it.I searched for it, and can't find it...
lardmana at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 5
Try looking into the [url= http://72.5.124.55/j2se/1.5.0/docs/api/java/lang/Runtime.html]Runtime[/url] class.
CaptainMorgan08a at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 6
If any body can give me some more detailed explinations, they might get some duke dollars...
lardmana at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 7

> If any body can give me some more detailed

> explinations, they might get some duke dollars...

No one cares about Duke Dollars, and no one is going to spoon-feed you. If you want to get better, then you need to figure out how to do things on your own. I gave you the class to need to look into, along with a link to the documentation. If you can't figure out how to use it by reading the documentation, then search on google for some examples.

CaptainMorgan08a at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 8

> No one cares about Duke Dollars, and no one is going

> to spoon-feed you. If you want to get better, then

> you need to figure out how to do things on your own.

> I gave you the class to need to look into, along

> with a link to the documentation. If you can't

> figure out how to use it by reading the

> documentation, then search on google for some

> examples.

Calm down buddy... just trying to get some answers.

lardmana at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 9
> Calm down buddy... just trying to get some answers.I was calm. I was just trying to tell you that my answer is the best you're probably going to get.
CaptainMorgan08a at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 10

I hav implemented windows media player using JSP....i am sending code

However for java program i do not know

<html>

</body>

<!-- begin embedded WindowsMedia file... -->

<table border='0' cellpadding='0' align="left">

<tr><td>

<OBJECT id='mediaPlayer' width="320" height="285"

classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'

codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'

standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>

<param name='fileName' value="c:\abc.wmv">

<param name='animationatStart' value='true'>

<param name='transparentatStart' value='true'>

<param name='autoStart' value="true">

<param name='showControls' value="true">

<param name='loop' value="true">

<EMBED type='application/x-mplayer2'

pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'

id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1'

bgcolor='darkblue' showcontrols="true" showtracker='-1'

showdisplay='0' showstatusbar='-1' videoborder3d='-1' width="320" height="285"

src="c:\abc.wmv" autostart="true" designtimesp='5311' loop="true">

</EMBED>

</OBJECT>

</td></tr>

<!-- ...end embedded WindowsMedia file -->

<!-- begin link to launch external media player... -->

<tr><td align='center'>

<a href="http://servername/path/to/media.file" style='font-size: 85%;' target='_blank'>Launch in external player</a>

<!-- ...end link to launch external media player... -->

</td></tr>

</table>

</body>

</html>

Vikash.SunJavaa at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 11
You can see here how to open html in IE. http://forum.java.sun.com/thread.jspa?threadID=5119336You can use the same idea to open media files in WMP.
Rodney_McKaya at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 12
Do you need to open Media Player, or do you need to open the default application for playing video and audio files? In case of the latter you can use the Desktop class to launch the file.
keeskista at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 13

Hey Everybody,

Please use this code to start media player from Java

public class mplayer

{

public static void main(String file[]) throws Exception

{

Runtime r=Runtime.getRuntime();

/*wmplayer is the command name and put one space after command name and then type the file name or pass the runtime arguments.*/

r.exec("wmplayer "+s1[0]);

}

}

java_is_easya at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 14

Hey Everybody,

Please use this code to start media player from Java

public class mplayer

{

public static void main(String file[]) throws Exception

{

Runtime r=Runtime.getRuntime();

/*wmplayer is the command name and put one space after command name and then type the file name or pass the runtime arguments.*/

r.exec("wmplayer "+args[0]);

}

}

java_is_easya at 2007-7-8 22:13:44 > top of Java-index,Java Essentials,Java Programming...
# 15
You Runtime.exec() the executable wmplayer.exeex.start wmplayer.exe "C:/MyMovies/shape.mpeg"start wmplayer.exe "C:/MyMusic/The Arcade Fire - Black Mirror.mp3"-- http://www.rgagnon.com/howto.html
RealHowToa at 2007-7-21 16:36:13 > top of Java-index,Java Essentials,Java Programming...
# 16

A related question that I have, is if you open another program using Runtime, can you control it further. I know that it can be launched and closed as I've seen much code that can do this by google search, but can you do other things to the program especially, can you give the app focus?

If I can get it the focus, then with the robot can do lots of manipulations to the app.

petes1234a at 2007-7-21 16:36:13 > top of Java-index,Java Essentials,Java Programming...