-3

Can you program external application from Java app.?

I know this is a wierd question but lately I really need to do it.

So the lets say I have "VLC" player or MPC or whatever it is, I want to be able to create a Java/C++ application or whatever it is to control the application such as play the video, pause the video and stuff.

If it possible please let me know and how.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • Would be easy if your application provides a command line interface. Otherwise, it depends ... – πάντα ῥεῖ Jul 15 '13 at 07:06
  • 1
    *"create a Java/C++ application or whatever it is"* It would be better to clarify the language choice. Java can achieve that (poorly) using the `java.awt.Robot` but you would typically look to something closer to the OS, like C++, for this type of functionality. – Andrew Thompson Jul 15 '13 at 07:08
  • yeah, lets assume the application doesn't have command line interface, and about the Robot so i can click buttons on an external app with it ? – user2580624 Jul 15 '13 at 07:11

4 Answers4

3

It's certainly possible with VLC. Look here: http://wiki.videolan.org/Java_bindings as well as here: how to control VLC by java

For MPC, I don't know of any resources that can be used to do so. You can at least launch it to the best of my knowledge.

Community
  • 1
  • 1
Mark M
  • 1,580
  • 10
  • 22
0

To start (execute) an external application you should use Runtime.getRuntime().exec(params); or ProcessBuilder class.

http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html

See Execute external program in java for more information.

To send key strokes to another application you could use the "Robot" class (http://docs.oracle.com/javase/6/docs/api/java/awt/Robot.html).

Community
  • 1
  • 1
bkausbk
  • 2,740
  • 1
  • 36
  • 52
0

What is expected is to have access to interface to do these operations, you can get some references from http://caprica.github.io/vlcj/ This is java api for controlling the VLC instance embedded in AWT.

Himanshu Bhardwaj
  • 4,038
  • 3
  • 17
  • 36
  • sadly i know about vlcj but i want something for other applications too, such as "internet download manager" – user2580624 Jul 15 '13 at 07:08
  • Can you explain a bit more, What you want for other applications? – Himanshu Bhardwaj Jul 15 '13 at 07:12
  • if you know Internet Download manager there is an option to add mass url, i wanna create an app to do that. also for MPC i want to be able to forward or backward the video... i know its not easy but i really wanna do this – user2580624 Jul 15 '13 at 07:14
0

I have found this site that describes how to run external programms from java http://www.rgagnon.com/javadetails/java-0014.html

Stimpy
  • 1
  • 1
  • 6