Port web app to native app - java

I have a very simple web app at the moment (just some static HTML/CSS/JS files and a JAR for the API that connects to a relational database). I would like to be able to have people run it locally on their own computers, instead of in the cloud like how I have it now.
My question is: is there some container framework for Windows/Mac/Linux that can bundle and display my app locally?
I want to have an installer or--better yet--portable ZIP/folder that someone can put on their computer, double-click a startup script, and have this running locally. The idea is that I may have to make different packages for each OS, but I will retain the same frontend, Java, and relational database.
I know of XAMPP for running a portable LAMP stack, but that's about all I could find with relation to a question like this.
EDIT: I should mention that the relational database aspect could potentially be swapped out with something like SQLite.

Related

How to make a server for a Java and MySQL application

I created a Java application that accesses a MySQL database (made using MySQL Workbench). I want to create an installer for my application so that other users can use it on other computers, but I can't figure out how to do so.
I tried using Launch4j and Inno Setup Compiler, but when I tried to install the application on another computer it didn't access my database.
After a bit of research, I found out that I (maybe?) have to use a server for my database, but I couldn't figure out what and how to do that.
My questions are:
Do I have to use a server to make my application installable on other computers?
What is the easiest server to use for this task?
PS: I'm very new at programming so please be as explicit as you can :)

Set up SQL Database accessed by Java, without Server needs (Embedded?)

I am currently working on a university project to set up a database and a java GUI for the company I work at.
My idea was to use JavaDB (JDK-integrated Derby) or MySQL as database engine and connect to a Java application that I code using DBMC.
Ideally, both the Database and GUI Java Application would simply be saved on the company's network drive in the same folder, without the need of a permanently running an SQL server or something like that.
So when a user started up the Java application, the database (server) would start up too and close when the Java Application is closed.
I was messing around with Derby Embedded, but found that it was fairly impractical, lacking a useful gui administration tool like MySQL or multi-user access (not the first priority) and accessing it via SQuirreL didn't succeed very well either.
Do you know a better solution to this?
Would it be possible to do this with MySQL for example?
I hope, I explained everything okay.

Store MySQLite Database Online

I'm making a voting app in Java using Eclipse where the user votes for their favorite team. Right now I have a local MySQLite database that I am managing with the MySQLite Firefox extension. The votes are stored in the MySQLite database, then I have another java application that reads from the database and outputs the name of the team that got more votes. However, I would like to store this database online, so multiple people can vote at once, then the results are displayed. How can I go about doing this? I am guessing that I will need PHP, but I am having a hard time finding a tutorial on how to integrate a MySQLite database with PHP. I pretty much just need to store my database online. Everything is functional locally.
Maybe I'll need more details but I'm assuming you have wrote a Standalone Java app, which is connected to you local SQLite Database.
Also, I think you don't want to distribute that app for everyone who wants to vote (would be better if they could vote via a website, right?).
In this case, you have to write a web application to provide both front-end and back-end of your app. You can pick one among many existing languages and frameworks (PHP is one of them), such as Java itself with some web framework, Ruby on Rails or Python/Django (just to depict some of them). Plus, I'd recommend you to use some other database such as MySQL or PostgreSQL.
Here are basic tutorials to you follow for some of the previously mentioned languages/framework:
Java (JSP)
PHP
Ruby on Rails
To deploy you app (i.e. put it online, you'll need a server). Honestly I'd recommend you to use Heroku because the deploy process is really simple (just push your code using git) and you can run your app for free (if your app got really successful you may have to scale up the server and then you'll have to pay, but maybe that's not the case, right?).
So, pick up a language and framework, write your web app and deploy it to the server. Then you can have multiple access voting into the same database.

Distribute Java application in Mysql

I wish to distribute my restaurant application, which uses MySQL to store the data. I plan to use Lauch4j to distribute its .exe file.
But the program also requires the user to have mysql Installed, is it possible to hard code mysql setup within the application? or anything else that could be done to avoid the user the pain of downloading and installing it?
It is a matter of opinion, but I advise you to not do it.
If your main concern is the install process being easy for the user, use some embedded DB. That way, the user not only will not have to care about things like firewalls, possible mysql vulnerabilities and so on.
If you need something that only mysql or other standalone DBs can provide you, don't hide it from the user. Technical capable users should be allowed to configure your app to run in the sql engines they already have installed (if they want to). Other people should at least know that you are installing something else apart of your app. Of course less tech-savy users will be scared, but if they do not know what they are doing they should not be tinkering with MySQL (or even installing programs).
In essence: Let the people know what you are installing in their systems. Allow them to reuse other DB engines if they chose to.
If i was you, if MySQL was the option, I would just take it for granted that it is installed and ask for the connection parameters (make it the first step of the installation procedure so you can check it before proceeding).
You can use SQLite in for your application. If any application needs to store data in the same system only and the application needs to be small and lightweight application then you can use sqlite as database. SQLite makes a great application file format.

Creating an installer for Java program with database

Recently I made an application in using Swing, AWT and JDBC that manages some database. I used PostgreSQL as the backend with JDBC drivers to connect to the database. What I want to do is create a setup/installer program so that the application can be installed and used on any pc. My problem is I dont know how to integrate the database along?
Any help would be appreciated.
Take a lesson from most commercial applications that have a database component. Usually they require that the database be installed/configured beforehand and provide db scripts for their supported vendors. There are a lot of reasons for this. Most of these are related to the fact that organization's like to manage their own databases. This is often because they have company restrictions regarding security, maintenance, etc. Also a single database process may be shared between many different programs(if you install two instances of your application do you want to have to two installations of the database?).
Most folks(especially network admins) wouldn't want an application that ran around installing rogue DMBS's on their machine.
I wouldn't spend a ton of time attempting to install the database during your install process. Why re-invent the wheel when the vendor has already created an installation process for you? Instead install the database ahead of time and focus your installer instead on running the necessary scripts such that your application can connect to it on the first start up. What it does means is having your installer have the necessary drivers, connection information, and credentials to communicate with the database to get it initialized. After the DB is initialized then you can have additional routines that configure your application install such that it points to the database you initialized during the install. Taking this approach will not only be easier, but it will allow your application to do more interesting things like connect to remote databases or skip database initialization all together and connect to an existing database.
Writing an installer that also manages DB installation is a project in and of itself. The big question is do you need to install PostgreSQL from scratch or will you tell the user to install it themselves first?
I have attempted to do something similar and what I eventually did was build an installer with NSIS that includes Postgres and a JRE in the install bundle along with my program. The installer copies everything to the user's install location and creates all the required config files.
The biggest issue I had was that I had a number of config options to present to the user that would have taken a lot of programming in NSIS. So, I modified the ANT build scripts I already had written to build the project. What NSIS does then is copy the JRE to a temp location and start a Java installer GUI I wrote instead that gathers up all the config info and launches ANT in the background.
If you don't have much to configure or what you need to configure doesn't have many options, then you can probably do everything in NSIS directly. But, keep in mind that you need to be security conscious too. How are you creating a new user to run Postgres? What about directory permissions for you install? Who can start and stop the DB, who can read the db files, etc?
Maybe you may try a pure java database, like hsql, or h2, or derby....

Categories

Resources