Java Application w/ Database as exe on another PC? - java

So I have completed my program, which uses a database inside of phpMyAdmin / workbench.
How is it possible to pack the program as a .exe, along with the database so that the end client (my mothers charity) doesn't have to install workbench and the database?
P.s: I have exported the project as a runnable .jar file, but I am unable to get it to an .exe file? what must I do?
Thanks in advance,
Josh

You could write a little C++ program that calls the jar.
It should also check if there is a JVM installed etc.
E. g. Let c/programs/myprogram/ be a directory; you put your jar and the exe that calls the jar in this directory. Then you could create a desktop shortcut etc.
Maybe there are there are solutions that automate this process, but I don't have any at hand right now.

Related

How to run a java executable file on other computer

I made a small application using Java Swings and then created a jar file of the project using 'clean and build' option in Netbeans. Then, I converted that .jar file in a .exe file using the software 'Launch4j' and it was perfectly running on my laptop. However when I tried running that exe file on other laptop. It displayed the error: Class NewJframe.firstfile couldnot be found.
( I made the database on the other laptop also with MySql Connection).
Please help me clarify why I am getting this error.
Also, I would like to know what all are the requirements to run an .exe file on other computer which I made from a .jar file?
I would pretty much expect something like Launch4j to take care of all your packaging requirements; did it give you options to "include all dependencies" that you didn't click "YES" to...?
It sounds like it's packaged your app, but possibly not the Java runtime envt it needs to run your app.
Try giving him the JAR file and see if he can run that. If he can, It's a problem with Launch4j, if he can't it's a problem with Java.
Alternatively try something like Excelsior JET instead.
Class NewJframe.firstfile couldnot be found
Launch4J only bundles your application's main JAR file inside the .exe (or not even that if you select "don't wrap JAR") - any other JARs that the main one depends on must be present in the same relative locations, you can't necessarily copy just the .exe.

Create jar to exe with MySQL database

How do I create an installer exe file with MySql DB included? What is the best way to install the database along with my application?
You can use two separate technologies, one (like JSmooth) to create an exe from a jar (this exe is only a wrapper around your jar, which will be uncompressed at runtime), and another (like NSIS) for creating a "setup exe": an installer program that can include your previously created jar-exe and and any other programs, such as a database.
Of course, this would be a Windows-only solution, Windows exe files do not run on Linux/Mac. Jar files run everywhere (if Java is installed)
yes i have GUI,..
Then you need Java Web Start for deploying it (to Windows, OS X and *nix).
JWS offers the ExtensionInstallerService that might be used to invoke an installer for the DB, and a PersistenceService for storing any connection details. See demos. of both in the Java Web Start examples.

Convert Java Project to .Exe

I've created a game project in NetBeans 6.9, and I want to run the project on another computer. The problem is if NetBeans is not installed on the other computer then surely I cannot run the project.
Therefore I have to convert my project into a .exe that can be run on other computers without having to install NetBeans.
Is there a free application that can convert .java to .exe?
Please help me to convert my project into a .exe file. Thanks.
Check out these official netbeans article for Packaging and Deploying Desktop Java Applications and Developing General Java Applications.
From the article
Running the Application Inside of the IDE
When developing applications in the IDE, typically you will need to test and refine them before distributing them. You can easily test an application that you are working on by running the application from the IDE.
To run the AnotherGrep project in the IDE, right-clicking the project's node (AnotherGrep) in the Projects window and choose Run Project.
The xGrep window should open. You can click the Browse button to choose a file in which to search for a text pattern. In the Search Pattern field, type text or a regular expression pattern that you would like to match, and click Search. The results of each match will appear in the xGrep window's Output area.
Information on regular expressions that you can use in this application are available here and in many other places on the World Wide Web.
Running the Application Outside of the IDE
Once you have finished developing the application and before you distribute it, you will probably want to make sure that the application also works outside of the IDE.
You can run the application outside of the IDE by following these steps:
In your system's file manager (for example, in the My Computer window on Windows XP systems), navigate to PROJECT_HOME/dist and double-click the AnotherGrep.jar file.
You will know that the application has started successfully when the xGrep window opens.
If the xGrep window does not open, your system probably does not have a file association between JAR files and the Java Runtime Environment. See Troubleshooting JAR File Associations.
Distributing the Application to Other Users
Now that you have verified that the application works outside of the IDE, you are ready to distribute it.
You can distribute the application by following these steps:
1: Create a zip file that contains the application JAR file (AnotherGrep.jar) and the accompanying lib folder that contains swing-layout-1.0.jar.
2: Send the file to the people who will use the application. Instruct them to unpack the zip file, making sure that the AnotherGrep.jar file and the lib folder are in the same folder.
The users of your application should be able to run it by double-clicking the JAR file. If this does not work for them, show them the information in the Troubleshooting JAR File Associations section.
Also some third party tools like Launch4j may do the trick. For more information see this article on java-to-exe
See Launch4j. I dislike starting java apps with a batch file. This wraps anything from the root jar all the way up to a complete Java environment in an exe. You get your own icon in the system tray rather than the generic coffee cup. I've used it successfully on a project that has about 300,000 downloads, and it's never been the source of a reported bug. NB It does take some careful reading to pick the right options for your project. But you can set it up with the Ant build script in Netbeans to make the .exe automatically. Very nice and clean. My project includes native libraries. They work fine as well.
I think the NSIS will help you . Most of the applications using NSIS. Because it is open source.
Also there is a Eclipse plugin for NSIS to make the process easy.
http://hmne.sourceforge.net/

Creating a stand alone Java application

Is it possible to create a stand alone application in Java (using Swing) and package it into an exe file?
My Idea is, we should be able to double click it and run the application.
If you export a runnable .jar file you will be able to double click and run, but you'll still need the JVM in order to interpret the bytecode.
The best way to deploy a Swing based app. to a client's desktop is using Java Web Start.
JWS offers desktop integration - making a desktop shortcut and menu item, each using an icon if specified. The end use can double-click the desktop shortcut cut to launch the app. ( or single-click the menu item to do the same ;).
Best of all, JWS works for all platforms for which the J2SE is supplied. Windows, Ubuntu, Fedora, Solaris, Mac. OS..
For ensuring the user has the correct minimum JRE needed to run the app., use deployJava.js to write the link to the JNLP launch file.
If you export your project in a .jar file, you will be able to run it when you click on it.
I suppose that you know that you must have the virtual machine installed in the computer that runs the program.(The virtual machine is the thing that allows java to be operative system independent)
And also you must know that if you transform that .jar to an .exe file using some kind of gadget... Then java will not be java anymore, because will not be able to run it in non-windows operative systems.
Remember java slogan
'Write once run everywhere"
See this image here i will explain you how to create a .jar using the eclipse IDE:
1-Select your project in the package explorer
2-Select File>Export from the menu
3-Pick Runnable JAR file from the dialog and
4-Click next and follow the rest of the wizard
You can package your application to JAR file. Application in jar file runs on duoble click.
Here is tutorial. http://download.oracle.com/javase/tutorial/deployment/jar/
You can already do this with a normal .jar file if the user has configured the extension to be executed with the JRE. But you can always use something like Launch4J. Please Note this simply wraps the Jar in a EXE file. The file still needs your Dependencies (.jars) and the JRE enviroment.

How to create a .exe file in netbeans?

I've created a project in netbeans and I want it to be runnable in another computer without having the netbeans installed (just like a .exe in visual basic).
I pressed F11 and I got a lib folder which has a .jar file on it. But then I don't know how to work it out, which one do I have to double click?
Can anyone please guide me?
If you created a java project, then the "other" computer should have the java runtime installed, in order for the jar to be executed there (java -jar your.jar) otherwise if you really want an .exe use one of the many jar2exe converters found on the almighty internet, such as http://www.ucware.com/jexec/index.htm
To run jar file on other computer you should have at least jdk. Their is no need to install NetBeans but you have to first set database connectivity to pc and your database. After connectivity just double click on jar file your project will run.
To know how to create Jar file in NetBeans check this link.
What type of project is this Desktop application OR Web based application ? If you are using java then for Desktop application you need to create a *.JAR and for Web based : *.WAR.
There are simple step to create jar/ war. please follow any tutorial.

Categories