aspose file tools*
The moose likes Beginning Java and the fly likes Creating and building Standalone application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Creating and building Standalone application" Watch "Creating and building Standalone application" New topic
Author

Creating and building Standalone application

Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Hi,

I have a need to develop a Standalone software. i am planning to develop it using servlets and jsps. i want to know how to export and install it to the client machine. Its a Stand-alone software, which is a simple data-show up from database kind of work. can anyone suggest me on how to export and install it. i know i should bundle entire application into a JAR file. But i am not familiar on how to install at client's system and make it work. Thanking you in advance.


Ashwin Sridhar
SCJP | SCWCD | OCA
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

You say its an application built using- servlets and jsps. For this you need to create a war file. You need to install Application server- like tomcat on the client machine (which the client may not like) and then deploy the war there.
OR
Better way is to host your application on some Servlet hosting provider and then your client can access the application via the internet.
OR
You can create a standalone desktop application and package the application into a jar and give it to the client. The client should have JRE installed (I think Most of the OS would come with the JRE installed)


Mohamed Sanaulla | My Blog
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Of three i suppose, the last option makes more sense to me. Could you explain it more. i have database scripts also. so does that mean, i need to have a Oracle/MySql installed on client machine.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

Ashwin Sridhar wrote:Of three i suppose, the last option makes more sense to me. Could you explain it more. i have database scripts also. so does that mean, i need to have a Oracle/MySql installed on client machine.


There was a discussion sometime back regarding using of embedded database - Apache Derby. (May be you can search in Javaranch for that discussion).
You can embed this database along with your application jar.
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Thanks for your Quick Respose.

Using derby would be an excellent idea.

Even if i package my application as a JAR, i would have to unbundle it and deploy it in the tomcat server at client place.

i want the client to unbundle-deploy the application on a single click from the setup.

i am looking for such a kind of approach. any suggestions on this.
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

I suspect that you will be using the wrong technology if you are installing a web server such as Tomcat on your client's machine. Nothing you have written makes this sound like the right approach. Just the opposite - I think you need a standard Java Swing application.


Retired horse trader.
 Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

If you are building a Desktop applications- which runs outside the browser- you make use of Swing of JavaFX 2.0 (still in beta) to build the GUI. Then you create a jar for this application which would include your apache derby jar as well. And you would not need a Application server for this.
Either you can write a OS specific script to run the jar and give it to the client or give just the jar.
Also you can have a look at- Java Web Start- Thats another way of distributing/launching the applications.

Dont expect client to install extra tools to run your application- the bare minimum would be the JRE and if you use Java Web Start it will download the JRE if it detects that the system has no JRE installed.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

Thought this might be of some help: http://izpack.org/
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Thanks for the suggestions.
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

The derby database is connecting fine. But when i try to launch the application from a jar file, i am unable to access it.

Should i have to bundle the database on to the jar.

i register driver and create connection in following way

Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();

con = DriverManager.getConnection("jdbc:derby:E:/Mydatabase");

This is not working when launching using a JAR. Any idea
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

As mentioned in the other thread here: http://www.coderanch.com/t/545378/java/java/build-derby-database-jar#2474446
You need to have the Derby jar along with your application jar. Just like you package other 3rd party jars with your application.
I havent used Derby myself, but I am sure there would be how-tos on the internet that will guide you through the process.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating and building Standalone application