aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how to create dynamic installation or exe/setup file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to create dynamic installation or exe/setup file?" Watch "how to create dynamic installation or exe/setup file?" New topic
Author

how to create dynamic installation or exe/setup file?

Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
i want to create a software, in which what i need to do is, when i install that software in any
system, automatically account in the database should created, i mean i only need to distribute the installtion files to whom

who want to use that software.
at the time of installation it should ask how many users are there and based on that account in the database should created,
how can i do this??

also is it necessary that the system in which i m installing that software should have database, i mean if i use oracle, the
system in which i am installing that software should have oracle??


Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1089
    
  10

You can use an 'embedded db' to achieve this. JavaDB is a good choice.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2

You can use an 'embedded db' to achieve this. JavaDB is a good choice.


so by using Java DB, i do not need to worry weather the system which is installing this software has database installed in his system or not, he only need jre, is it??

and is it possible to create dynamic installation file as i said, in which while installing it asks for number of users and create those number of account/table or whatever into Java DB??
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1089
    
  10

Correct.
JavaDB is part of jdk since 1.6. You can see in the features page which shows that this can be run in 'embedded' mode.

When you run the application first time, you should 'create' the database which can be done via API call. This will have the database in the local hd. Whenever the application starts, you should 'start' the database and stop it when the application stops. Again, all these can be done via API call.
Once the DB is started, connecting to and performing CRUD operations are usual JDBC stuff. The JavaDB ships with a JDBC driver for connecting to a JavaDB database.

Edit: The user only needs the JRE, but you should include derby.jar when you ship the application (Derby is the original Apache's open source project which is now supprted by Oracle called as JavaDB). I don't think derby.jar is included as part of jre.
You can read this link to understand how to use JavaDB in embedded mode.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
okay, Thank you...
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1089
    
  10

I see that you created another thread about the same question for making it an executable.
Like I pointed out, you need to write code to create the embedded db the first time, and then have code to start/stop the db. When you distribute the app, you will include all your jars along with derby.jar.
If you want to make it an executable, you can use launch4j to create an executable (with option to bundle JRE itself). Or, if your's is a NetBeans project, you can right-click on the project and use Distribution menu options to create an executable/zip.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2

I see that you created another thread about the same question for making it an executable

I am sorry for that..

and i wrote code for create embedded db



now my question is how to include this?
simple class file ie. Test.class???
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1089
    
  10

Punit Jain wrote:
now my question is how to include this?
simple class file ie. Test.class???


include where?
Have you ever created a standalone jar file? you should start from there...
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
no i have never created, and i m using eclipse.
how do i create a jar file??
and after that what next to do??
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1089
    
  10

Check this: link
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
thank you very much, i will create a jar file of my class, after that???
do i need to include my jar file and derby.jar using this software Launch4j isn't it??
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1089
    
  10

No. If you read through the link, you can see that you can run standalone jar files with: 'java -jar <jarfilename>.jar' (in most machines, simple double-clik on the jar file will bring up the app).
Also, in subsequent sections, it is shown about how to include other jars in your classpath. That is where you have to specify derby.jar. Follow that and try it out. You won't need to make any executable at all in most cases (I started talking about launch4j thinking that you were already aware of standalone jars)...
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
yes i will read that link, but i just want to know one more thing, if i want to create a installer than do i have to use that launch4j???
(installer i mean, ie(any software we install))
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1089
    
  10

I don't think you need an installer. You are using Eclipse IDE, how did you install it? most propably, you got a single zip file and unzipped it, right?
So, you can do the same. Just put all your jars in a single zip file and send it across. All the user needs to do is just unzip and the app is ready.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
ya got it...
thank you...
but again for any of my project if i need installer, do i need to use launch4j???
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1089
    
  10

No. For an installer, you should look at something like izpack
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
thank you..
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1089
    
  10

You're welcome.
 
 
subject: how to create dynamic installation or exe/setup file?