Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a java program on a server?

Tags:

java

mysql

I have made a java application that stores data from a .csv file to a MySql database. Now my client want it to upload this application to his web space (web space he has taken for his website) so that he can run that program on that server.

I have used FileZilla software to upload the program to his web hosting but now I don't know how to run that program on his server.

To run it on localsystem, it needs to open a command-prompt window to run it.

Is there any specific feature that the web-hosting must support to run that java program?

As it stores data from a file (.csv file) to a MySql database, then would it better to deploy that program on the server on which the database is being hosted instead of the server on which the website is being hosted?

like image 999
Yatendra Avatar asked Feb 28 '10 08:02

Yatendra


People also ask

Can you run a Java program on a website?

You can run a Java Web Start application from a browser by clicking a link to the application's JNLP file. The following text is an example of a link to a JNLP file. Java Web Start software loads and runs the application based on instructions in the JNLP file.

What is Java server process?

Definition. The server processes of the J2EE Engine actually execute the J2EE application. Each server process is multi-threaded, and can therefore process a large number of requests simultaneously. The Java Dispatcher assigns requests to the server processes.

What is a Java Web server?

Java 18's Simple Web Server is a minimal HTTP static file server that was added in JEP 408 to the jdk. httpserver module. It serves a single directory hierarchy, and it serves only static files over HTTP/1.1; dynamic content and other HTTP versions are not supported.


1 Answers

If your webhost has java available you could try to execute it from a php cronjob without the need for ssh:

<?php system('java -jar /path/to/your/program.jar'); ?>

Cron jobs are easily done from cpanel.(P.S. the above is the code for the php file it is not what you put in the cron page, you put the php -f /path/to/php/file.php in the cron page)

like image 67
DCC Avatar answered Oct 09 '22 17:10

DCC