1

I was wondering if it's possible to send commands from a website to a java program being ran on a computer.

Basically what I'm doing is creating a robot, but I want control over it when I'm away from my computer. So what I was thinking, was that if I could send it commands (Like 'Stop' or 'Start') from a website, I could use my smartphone to control it.

If you know a way that might work or another method that's similar please let me know, thanks!

1
  • this might help Commented Mar 26, 2012 at 21:16

3 Answers 3

1

What I've done in the past is built the Java robot into a Java EE webapp, then deployed the webapp on Tomcat. Tomcat is a Java-based web server. It's a web server, but there's also no reason you can't run arbitrary code inside it, like a robot.

Another alternative is to embed a web server into the robot, and have the robot serve up pages itself. An example of an embedded HTTP server is JETTY.

Using the above two approaches, the web pages and Robot can communicate with each other directly through Java code. It's a single process and a single JVM running both.

A third alternative is to connect the Java robot process with the web server process via sockets or another form of IPC. This could be tricky, but decouples nicely.

Sign up to request clarification or add additional context in comments.

Comments

0

one starting point is: RPC the wikipedia article will guide you through other options and names that can help you. If it is really that basic. Socket Programming is the right way.

Comments

0

I was wondering if it's possible to send commands from a website to a java program being ran on a computer.

This equivalent to asking if 2 programs can communicate via network.
The answer is yes. It is obvious, right? I mean how do you connect to your website in the first place? Eh?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.