is JNI overkill

S

SirThanxALot

Hello,

I want to call Winamp (more generally, an executable) from within a java
app. Is it really neccessary to use the whole JNI thing-a-ma-jig or is
there an also easy hack?

And is it possible to pass command line options like one would use in a
command prompt such as
'snip' winamp somefile.mp3 'snip'

any suggestions?
many thanx
srtnxalt
 
S

SPG

Hi,

If you are not too bothered about interacting with the exe from the java app
(IE, just launching it, and waiting for it to finish, etc) then have a look
at:

Process proc = Runtime.exec("winamp", new String[] {"somefile.mp3"});

Have a look at the JAVA API docos for this and you will see you are able to
get the in/out/err stream, and wait for the process to finish etc..

HTH

Steve
 
S

SirThanxALot

Process proc = Runtime.getRuntime().exec("program" + " " + args) did the
trick in Runtime,getRuntime().exec(String, String[]) the array is meant
to give environmental settings such as path etc, not for arguments

kind regards,
srtnxalt
Hi,

If you are not too bothered about interacting with the exe from the java app
(IE, just launching it, and waiting for it to finish, etc) then have a look
at:

Process proc = Runtime.exec("winamp", new String[] {"somefile.mp3"});

Have a look at the JAVA API docos for this and you will see you are able to
get the in/out/err stream, and wait for the process to finish etc..

HTH

Steve


Hello,

I want to call Winamp (more generally, an executable) from within a java
app. Is it really neccessary to use the whole JNI thing-a-ma-jig or is
there an also easy hack?

And is it possible to pass command line options like one would use in a
command prompt such as
'snip' winamp somefile.mp3 'snip'

any suggestions?
many thanx
srtnxalt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top