I have been developing java desktop application for SMEs.
I developed a java application for a business that needs to access SQL databases on a server. The GUI is Swing based. Now it turns out we need to deploy the java jar on the server too, so that the desktops PCs can access to it remotely and we won't be installing the jar locally as usual.
What I would like to know is if there need to be significant modification to source code I need to apply (I checked out Client/Server dev with sockets, for example), or would a simple drag n drop on the server work?
Ps. Right now I have no clue on what the server is and if it is owned by the business or hosted in a datacenter.
Also, What would the alternative be in terms of connection protocol, depending on the server location?
Related
I wanted to create a Java web app with electronJS front-end. Electron would technically communicate with the Java server for loading data. The Server would be responsible for managing users and sending data stored on a database to electron.
I read about web apps that are made with java and the many servers (glasfish, tomcat, etc.) I do not really know if it's needed for my project.
My idea was to create the back-end in Java and host it on a machine that is 24h online. I don't really understand the point of Tomcat etc.
Thank you for your help (:
I have created a java application in intellij ide. The application is working well. Now that my application is ready I want to transfer my java application from my machine to server and make it live. I have one server, domain and all the basic rights in the server. Can any one help me figuring out?
I am very new in this part. I dont know anything about hosting my own website and application.
The answer depends on what technology you use. If you use application that needs to be deploy into servlet container you can deploy it onto e.g. Tomcat.
Whatever technology you use you definiately should build your application - it also depends on what building system you use.
E.g.fFor gradle, you can use gradlew build.
For maven: mvn compile.
Tell us more details about technology you use to allow us to help you.
You have a java application (Dropwizard) and first need a server to run it on, which means that it must be a server with java installed or where you can install it yourself.
Then you need to transfer the application "fat" jar (typically you find this in the target directory, depending on how you built it) to this server and start it with java -jar my-application.jar.
Then you need to make sure that the port that the application runs on is available externally. This usually means that you need to have a web server installed (commonly nginx or httpd) which redirects from port 80 or 443 to the port of your application.
Only then is you app "live".
I already have an Java application running on client site.
This application currently does not have any UI. What it does is just transforming data for the client behind the scene.
We need to regularly upgrade the application.
Now we would like to add a UI using GWT.
My question is
Can I include GWT directly into my current application, as a whole?
I mean, my current Java application start from main(). On client side, we just execute java Application (simply say). After we have our GWT part, we really want everything still the same. On client side, we don't need to let client or we ourselves install many new things.
So ideally, after we finish our GWT part, for client, still, our application is one application and the way to launch is only java Application
We don't want to tell client that we need a TomCat server to be seperately installed.
We don't want client feel troublesome and it seems now we need to maintain multiple packages, etc.
You need a web-server to serve you GWT application, orelse it can not communicate with local Java app. As you run GWT-compiled Javascript in a browser, it can't access to your local machine resources.
It can be a Tomcat running on localHost or you could use Google App Engine. You can't run a GWT app like a Java Swing application.
But relax... Tomcat is not that troublesome and does not require more package that what is already in it.
I've read some articles on the Internet that this is not possible. To communicate own SQL database that is located on other server from GWT application. Jetty doesn't allow it.
I found a way how to perform it but it's not very cosy. I have client and server part inside GWT. The server has to communicate with MySQL database on localhost. So I've written an ant script to build a war that I can launch on Apache Tomcat server. It works perfectly there but I'm not able to debug the code effectively.
Do you have some advices how to perform this task? I was thinking of writing the clienty only in GWT and find some waz how to communicate my own server written outside the GWT. I've found Apache Thrift for GWT but this edited library of thrift seem not to work properly.
Thank you very much for your answers:)
It is possible to communicate with a database from a GWT application. The client side has to call the methods of the server via GWT-RPC, which can communicate with any database.
Maybe Jetty does not support it (have not tested it personally) but you can develop your web application using Apache too. There you can access the database the same way as from any web application:
You will need the mysql-connector-java-5.1.20-bin.jar file (downloadable from: http://dev.mysql.com/downloads/connector/j/ ), and restart the server added to the $CATALINA_HOME/common/lib directory.
OR added to the WEB-INF/lib folder of your web application.
You can find tutorials online of how to develop an application using Tomcat instead of Jetty. For example: https://wiki.auckland.ac.nz/display/BeSTGRID/Deploying+GWT+to+Tomcat+in+Eclipse
Reshi, stop and think about how applications really work. Nobody provides web pages with javascript to read/write databases, that would be crazy and unsecure. Servers are always in themiddle of all communication in this case. You need to create services that run inside your server, one of these services will be a database layer.
Javascript cant create network connections and read/write binary data, thus it would be insane to attempt to get the gwt compiler to compile any jdbc drvier and more.
Jetty does NOT stop us from connecting to a database. All you have to do is to follow the MVP model way. Although MVP is better bet against all hurdles, at a minimal point, you would have to try not having SQL code on the client package.
I have an existing Java application running on a linux box that monitors the state of relays and network information. This is a stand-alone device currently.
What I would like to further develop is a web server for the device to remotely monitor, configure, and control the device via an Ethernet connection. To achieve this, I need some way to interface between the web server, which could be configured as enabled/disabled, and the master device, which is always running.
Is there a good way to do this? I have looked at apache w/ tomcat and similar web servers but not sure if this is what I need. The key here is that the web server needs to be able to access the existing java application without interfering with its always running services.
You either develop a webapp, use your Java application's API inside the webapp, and deploy this webapp inside a web container. Or you can do the reverse and embed a web server inside your application (see here for documentation to embed Jetty).
If you want to keep the webapp and the original application in two separate JVMs, you'll need some wey to communicate between both, like sockets, RMI, or even files, but it will be more complex.
You might want to take a look at JMX http://docs.oracle.com/javase/tutorial/jmx/overview/index.html