?
Solved

invoke winamp from java program

Posted on 2001-07-24
10
Medium Priority
?
315 Views
Last Modified: 2009-12-16
Hi,
   Can anyone show me how to invoke winamp program to play the speify song form a java program? Where should I start?
0
Comment
Question by:mkngau
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 9

Accepted Solution

by:
Ovi earned 150 total points
ID: 6316018
public class AppRunner {
     public static void main(String[] args) {
          String app = "c:\\Progra~1\\Winamp\\Winamp.exe";
    try {
         Process process = Runtime.getRuntime().exec(app);
    } catch(Exception e) {}
     }
}
0
 
LVL 9

Expert Comment

by:Ovi
ID: 6316023
Or, if your PATH system variable points to the winamp directory, you can modify the string app into simply "winamp.exe". Here is an example of starting Winamp with the G:\\ as start pats ("my cdRom drive")

public class AppRunner {
     public static void main(String[] args) {
          String app = "c:\\Progra~1\\Winamp\\winamp.exe g:\\";
    try {
         Process process = Runtime.getRuntime().exec(app);
    } catch(Exception e) {}
     }
}
0
 
LVL 92

Expert Comment

by:objects
ID: 6316032
I think in fact if your Windoze installation is already setup so to open your sound files with winamp (ie. the file type is associated with winamp).
Then you don't even need to specify winamp explicitly, the OS will fire it up automagically.
Save you hardcoding the Winamp location, and also means if you change your player in the future you don't need to modify your application.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 92

Expert Comment

by:objects
ID: 6316035
Try:

String file = "song.mp3";
Process process = Runtime.getRuntime().exec("start "+file);
0
 
LVL 6

Expert Comment

by:kotan
ID: 6316047
There are a few of command line option for Winamp:

Try,

C:\path\to\winamp\winamp.exe /ADD C:\mp3\whatever.mp3
(Adds C:\mp3\whatever.mp3 to the playlist of a running Winamp, if Winamp is running, otherwise it opens Winamp and plays it outright)

C:\path\to\winamp\winamp.exe /NEW
(Creates a new instance of Winamp, even if Winamp is already running)

C:\path\to\winamp\winamp.exe C:\mp3\file.mp3
(Plays the file C:\mp3\file.mp3, regardless of whether or not Winamp is open)

C:\path\to\winamp\winamp.exe /CLASS="myclassname"
(Opens Winamp with a different Window Class name "myclassname")
0
 

Author Comment

by:mkngau
ID: 6316637
Thanks for your help.
But how if I want to remote the winamp to play a song in another pc?
0
 
LVL 92

Expert Comment

by:objects
ID: 6316721
Well why didn't you ask that in the first place?
So do you want winamp to start up on another pc?
Or do you want to play a song located on another pc?

0
 

Author Comment

by:mkngau
ID: 6320481
Sorry...the requirement has changed so I need to modify my code.
  What I need to do is, run the program in machine A to invoke song in Machine B(winamp and mp3 files is on Machine B) thru internet or LAN. Is it possible.
0
 
LVL 6

Expert Comment

by:kotan
ID: 6320495
You can use RMI method to do that.
0
 

Author Comment

by:mkngau
ID: 6320609
Can u show me how to do that? Now I manage to invoke the winamp in server using servlet...but how if I want to remote another client machine?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question