Open program and send data to it
So.. I wanna make a program to be executed remotely on another computer. Like i command from my computer to open a video file at my laptop and then send data to it like "Enter" key so that the window will be maximized.
Could u guys post some documentation links step by step of what should i do?
thanks a lot!
ps: i tried to do this with php exec() function but it backfired n there i explained a little more about my problem hope it helps! :D http://www.codingforums.com/showthread.php?t=285649
Using Java's RMI would probably be the easiest approach. Here's a tutorial from oracle with the overview of the RMI methodologies and an example: http://docs.oracle.com/javase/tutorial/rmi/index.html
You'll still need to go over the documentation of the KMPlayer with a fine tooth comb as well. It should have documented the command line functionality, and even better if you can pipe commands to a running gui through the process itself.
The fun part is this: it may not even be this complex to perform. With many media servers nowadays they have built in RSTP servers (I think that's the protocol it uses). This means they would have a listener on a socket for the source machine which you can open to and send commands to the running RSTP directly. You'll need to check the player's docs for information about this, and learn the RSTP communication RFC as well (there should be a link on wiki to the rfc as well). Some apps like VLC also have a built in remote control interface to take this layer away, although I've never attempted to use it.
And before you ask, if you have a running RSTP for the player, yes you could use PHP as well. Although for anything interactive especially in a local lan I'd suggest you don't use a web based language for that task.
Fou-lu let's start with basics first pls. How do i open a video file with kmplayer? All i've seen googleing* was opening a video with default video player. So.. besides changing the system's default player how can i make kmplayer (or any other program) open a file using Java ofc :)
thanks a lot!
ps: can i use sockets instead of those java rmi?
The sockets and RMI are two different things. The RMI would use sockets, but its designed to communicate between two different machines. Think like a chat client.
Java is quite capable of opening sockets.
I can't tell you how to open a file with the KMPlayer, I just don't use it. VLC and Media player both accept a filename in the argument when launching it, so I presume KMPlayer would as well.
Fou-Lu could u tell me if java applets could do what that php exec() couldn't?
Unless you create an RMI, than the applet would only work on the client loading it. Applets are Client side executed as opposed to PHP which is Server side. You also need to sign the applet if you intend to act with privilege on the remote machine. The applet is like HTML is to the browser.
So yes, you can use the applet on the client, but no you cannot connect remotely to it directly like that.
Since i'm a noob and i was quite in a hurry i could do that basically using sockets n JFrame.
Did that by watching chat services tutorial.
1 side was me writing commands.
On the other side my laptop running it.
But i got stuck on an issue.
I created the method showFolders(); // to receive all the folders from my laptop to my pc.
So whats the best to to display that for me? I thought about something like buttons containing those folder names but since there are many folder i couldn't scrollable the getContentPane();
Do you have any better idea? Or help fix solve this problem. :(
What i want is like a width=500 height=400 JFrame to display buttons like :
scrollable since there r many titles so that i could click on one of them to be played on my laptop.
thanks in advance :D
ps (edit1) : AWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW MANNN java's gui so boring!! wish i could use css on it. :P
ps (edit2) : Solved it simply using Sockets. thanks
You sorta can use CSS, but they are hard properties in Java. You're better off using a LookAndFeel manager instead. Customizing the actual L&F is quite a bit of work in Java; its not simple like CSS and HTML is (but that's all HTML/CSS' job is, so I think that's a fair trade).
You can see some screenshots and download links for a few themes here: http://geeknizer.com/best-java-swing...casual-top-10/
Scrolling in Java gui is very simple. Simply add the scrollable content to a JScrollPane and add that panel to the frame instead of the large component. Without customizing a thing, the JScrollPane's job is to determine the viewport size you have and add scrollable content to it.
Fou-Lu i've found a better but painfull way to do that using using php and java sockets. It worked like a charm. Thanks for your help!
|All times are GMT +1. The time now is 09:58 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.