How can I host a Jar file on Tomcat - java

I have developed a simple management software like library,shop item management. when I compiled my java files I get a .Jar file which I want to host somewhere (tomcat etc.) so that anybody can go to that IP and add/modify the iteams. Is it possible ? I developed that software using java Jframe.

You need to create a JNLP (Java Network Launch Protocol)
The Java Network Launch Protocol (JNLP) enables an application to be launched on a client desktop by using resources that are hosted on a remote web server
See This for detail about JNLP.
Also you will get a lot of information from google about JNLP.

Related

How do I know the URL of a web app on my machine?

So I just got internship at this company, and they would like me to complete a project(Web application) which someone else did but didn't finish two years ago. But the person didn't leave any documentation about this web app. Right now I would like to run and test this web app, but I couldn't get it started.
So it's running on WebSphere Application Server in IBM Rational Application Developer, the code is written in java and javascript. (I could start the server, but I don't know where to go and open up the web app)
Sorry I'm really new to this, questions might be stupid, appreciate any help:)
Do you know what port it's running on? You should be able to access it from a web browser on the host machine by going to
http://127.0.0.1:XX
where XX is the port in question. If you don't know, try 80 - that's the default HTTP port and it's worth a shot.
The default websphere web port is 9080, so try http://localhost:9080/
So it's running on WebSphere Application Server in IBM Rational Application Developer
and
I could start the server
Assuming you are able to start the server via RAD as I assume from the above and you are able to publish the app to WebSphere via RAD, you should then be able to right click on the project folder and choose "Run on Server." It will walk you through publishing the app to the server and will then launch a browser to the index page or URL via the context path and web project settings. You can have RAD use an embedded browser (default) or adjust it to launch an external browser via Preferences -> Web Browser.
To manually check where a webapp will be deployed you can either check application.xml (if you have one) OR you can right click on the project root folder in RAD, choose Properties, and Web Project Settings. The context path is in a field there.
Run-On-Server will show you both server/hostname (usually localhost), port, and application context path in one operation.

Java Desktop Application on Network basis

Is it possible for a Java Desktop Application coded with java Swing to use in multiple computer through networking? I have a Java Desktop Application with MySQL as database. I want to deployed it in about 3-5 computers by means of Networking or sending data depend on their IP Address. SO what are the process that i am going to do to achieve this networking. Is setting the path of the database inside my program into the server's IP Address will help? Thank you so much.
Is it possible for a Java Desktop Application coded with java Swing to use in multiple computer through networking?
For deploying Java desktop apps., the best option is usually to install the app. using Java Web Start. JWS works on Windows, OS X & *nix.
.. sending data depend on their IP Address
If the launch file (XML with a JNLP extension) is generated dynamically, properties can be added on a client by client basis. Alternately, have the client supply that information when they 'phone home'.
Try replacing the hostName in your database connections from localhost with the IP adress of the computer carrying the Database.

Download Java Application using JNLP with single domain and multiple IPs

We have a Java Application having multiples jar and launch over JNLP using a URL. Whenever we change the IP behind the URL our all jars download again.
What information on client machine are checked to download the jars?

Recommended server for JNLP

I have never used JNLP, and I have no web/war server already running so I will install it from sratch:
Which to use?
GlassFish
Tomcat
Apache
Jetty
Another?
I wonder if someone already using JNLP could make any recomendation for the server.
I just want a blank page with a button in the middle for starting the application nothing more, nothing less.
If you use only JNLP you don't need Java server. JNLP is client side. Simple http server like Apache HTTP Server should be OK. HTTP server will be better solution than use of web container/Java EE server because JNLP (usually) is a static content. Even lighthttpd should be enough.
As already stated any server capable to serve HTTP will do. If your WebStart application is not signed by itself (i.e. you code-signed the corresponding Jar files) you could probably consider to publish the JNLP plus its resources via HTTPS. This way your clients will know that the software they are going to execute came from its rightful origin. Although unsigned WebStart applications are restricted in their privileges on the client's machine it still is a measure to elicit trust in your clients. On the other hand this requires more configuration effort with regard to the server you chose.
If your application will need some extended privileges on the client's machine such as access to the file system then I would recommend that you do sign your jar files to gain the necessary privileges automatically (don't forget to specify them in a element within your JNLP).
These are the default restrictions for unsigned WebStart apps:
No access to local disk.
All your jars must be downloaded from the same host. Note, however, that you can download extensions and JREs from any host as long as they are signed and trusted.
Network connections are allowed only to host from which your jars were downloaded. ("Phone home restriction.")
No security manager can be installed.
No native libraries (not even in extensions).
Limited access to system properties. (The application has read/write access to all system properties defined in the jnlp file, as well as read-only access to the same set of properties as applets
You dont need a server to run JNLP(Webstart).. This is how webstart works
it simply is an application that can be started over the web, this would be the procedure from the user perspective:
user goes to yourwebsite.com
user see's link: run my awesome app
user clicks link, which downloads .jnlp file
user runs the jnlp file through java web start (part of java SE, user requires java runtime environment JRE to run this)
java web start reads jnlp to get information about the server that holds the corresponding application
jar files get downloaded automatically (the first time) and then the application starts
user gets bored and closes application
the next day, user comes back and clicks your link again
application is already downloaded, so it starts right away
user gets bored again and closes your application
1 day later, you decide to update your application and you deploy the new jar file on your
server, replacing one of the old files
after 2 days user clicks your link again
java web start recognizes that the user has a different version, downloads update automatically and starts the application again
...
..
.

Question about Tomcat for Java Server Based on sockets

I would like to know if I purchase a VPS service(linux based) over the net.
Do I need Tomcat to be installed in order to launch my java based server (socket server)?
If yes Which version do I need, and can you please give me a reference for an online guide for how to install and run things on a VPS which is based on Linux.
Thanks
If your are not deploying web apps (WAR's), you don't need a application server like tomcat or glassfish. So to run your java based server, you only need the JRE.
Get a Windows-based VPS if you are not familiar with Linux, as you have to administrate the server (apply patches, etc.), if it is not managed by your provider.
Have a look at this Superuser question for Linux books.

Categories