1

So far, I've been searching far and wide on the internet for the best practice when it comes to writing a Java server with a GUI (for stopping and starting it). I know that I have to run the server in a separate thread as the GUI but I was also thinking that it my be a little less complicated if I made each piece, the server and the GUI, in its own Java program or process. If I go with the latter, how do I interact with the server from the GUI if they aren't the same application. Would I just kill the process from Java. I really need some help (or maybe a tutorial).

P.S. I'm going to write the client for other PC's and android phones in the house so I could create a simple messaging system in the network for easy copy and paste between devices so I was considering building the GUI and server in with the client so I could distribute that and it would be two way but I'm not sure if thats the right approach or not.

Thanks!

2 Answers 2

1

You sir, are looking for an Application Server, like JBoss. Interact with it using web pages as the GUI. Use HTTP as your messaging protocol (POST and GET). Use Eclipse for Java EE and read some tutorial / guide. It might be some to learn now, but you'll benefit from it later.

For your requested functionality, create a web application with a servlet for receieving HTTP requests first.

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

2 Comments

I'm not familiar with JBoss or application servers. (Sorry, I've just never used one before)
see links. it is free and the eclipse tools are great.
0

I don't think there is a 'right' way to do this. If as you say, you want to have more than one client (an app running on PCs and an app running on android phones), then you are better off going for a client-server architecture, where your server and your client are two (or more in the case of the different GUIs you want to create) different programs.

The way they can communicate is also open for you to choose. You can go low level and connect through sockets, or you could use HTTP and create web clients. If you give us a bit more context about what you want to create (server and client are way too generic words) then we could give more tailored questions.

2 Comments

Thanks for the response but when I said communicate with eachother, I meant the GUI for the server and the server itself. What I'm trying to create is an easy way to copy text between devices. So say when I find something on the internet on my phone that I want to use on my pc I can copy it from a dialog that pops up on the PC with text that was sent to it from my phone. (I know that there's applications for this already but I would like the flexibility of coding it myself. Plus I'm fairly new to Java and would like to start using more often then I do other languages)
Hey Brandon, If you don't want to use an application server and HTTP, you can experiment with sockets. See link download.oracle.com/javase/tutorial/networking/sockets

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.