Best framework for Java programming?
I am new to java web and I have a small project that I want to upload on my local network and only use five users.
I want to use Java swing, MySQL for database and eclipse as IDE. So what is the best framework to make network programming easier because I don't want to start from scratch.
I've read about Netty and Apache Mina and I don't know if this is good for me in my case.
source to share
see netty-vs-mina link . Your question about "best" is not really a q & format and should not be asked in this forum.
source to share
This question is 5 1/2 years old, but has not been answered or closed. That is why I am writing this assuming that the questionnaire stands for Server-Client-Model .
I would recommend checking out NetCom2 . It is an easy-to-use framework that supports high modularity for future enhancements.
The concept of this structure may seem rather odd since it is built as an "over-network" Event-Bus . Communication consists mainly of objects flying over the network and responding to it Servers / Clients.
On the server, you have to write a java program that looks like this:
public class ServerMain {
private ServerStart serverStart;
public ServerMain(int port) {
serverStart = ServerStart.at(port);
}
public void start() throws StartFailedException, ClientConnectionFailedException {
serverStart.launch();
serverStart.acceptAllNextClients();
}
}
And the potential Client will look like this:
public class ClientMain {
private ClientStart clientStart;
public ClientMain(String address, int port) {
clientStart = ClientStart.at(adress, port);
}
public void start() throws StartFailedException {
clientStart.launch();
}
}
This is how you create and run the server and client.
You can tell both the client and the server how to react to certain objects. This must be done before [clientStart / serverStart] .launch (), specifying:
clientStart.getCommunicationRegistration()
.register(MessageObject.class)
.addFirst(messageObject -> System.out.println(messageObject));
serverStart.getCommunicationRegistration()
.register(MessageObject.class)
.addFirst((session, messageObject) -> session.send(messageObject));
Now you can send something from the Client to the Server by specifying:
clientStart.send(new MessageObject());
This example is basically an echo server which is explained here .
The connection between them can be found in more detail here or here .
If you are overwhelmed by the output being produced, you can adjust it by specifying:
// Choose only one.
NetComLogging.setLogging(Logging.trace());
NetComLogging.setLogging(Logging.debug());
NetComLogging.setLogging(Logging.info());
NetComLogging.setLogging(Logging.warn());
NetComLogging.setLogging(Logging.error());
NetComLogging.setLogging(Logging.disabled());
This is explained in more detail here .
NOTINGS
Please note that this project has just ended and the documentation is still ongoing.
Also note that this framework is still in beta testing. I would not recommend it for production use, but I would look at it for personal use.
source to share