I'm using Mysql database and neatbeans IDE conncting by mysql-connector-java-5.1.21 jdbc , and I want to convert My program in my laptop to .exe file to be instaled in anthor PC's ....... help please ?
Asked
Active
Viewed 2,574 times
0
-
1possible duplicate of [How can I convert my Java program to an .exe file?](http://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program-to-an-exe-file) – duffymo Jul 05 '12 at 23:07
-
*"to be instaled in anthor PC's"* Deploy the lot using [Java Web Start](http://stackoverflow.com/tags/java-web-start/info) & it will even work on those desktop computers that **don't** run Windows. – Andrew Thompson Jul 05 '12 at 23:23
-
@AndrewThompson Please don't spam the same comment on every answer AND the question as well. – WhyNotHugo Jul 05 '12 at 23:43
-
@Hugo Same technology, different comment. :) – Andrew Thompson Jul 06 '12 at 08:05
-
Your question has created some confusion. Do you specifically want an EXE? If so: a) Why? What is the advantage of it? b) Why start coding the app. in Java? There are easier paths to getting a `.exe`. – Andrew Thompson Jul 07 '12 at 00:40
2 Answers
2
You can't do that, you'll need to drag over mysql and the jre along with those java classes. The best you can achieve is some launcher that contains everything inside of it.
If you want this to be a single, portable binary, your best shot is to use some embeded SQLDB, like HSQLDB.

WhyNotHugo
- 9,423
- 6
- 62
- 70
-
*"You can't do that, you'll need to drag over mysql and the jre along with those java classes."* I'm weary just reading about it. Go for the 'one click' solution using [JWS](http://stackoverflow.com/tags/java-web-start/info). More hassle for the developer, but a breeze for the end user. – Andrew Thompson Jul 05 '12 at 23:27
-
He specifically said he wanted an exe file (a windows binary), JWS is far from that, in that is not only requires a JRE pre-installed, but also the Java Plugin for the user's browser. I also think you can't install/run mysql through JWS. – WhyNotHugo Jul 05 '12 at 23:41
-
*"I want to convert My program in my laptop to .. to be instaled in anthor PC's"* Take out the 2 words in the middle, which are often poorly chosen, and it points to JWS. *"I also think you can't install/run mysql through JWS."* You think wrong, JWS provides the extension installer service. – Andrew Thompson Jul 06 '12 at 08:03
-
Sure, if you alter the op's question, other answer will apply, I answered the one he actually asked, not a variation of it. – WhyNotHugo Jul 06 '12 at 15:23
-
-
I had try tody with Launch j4 and the jar file convert to exe but it did'nt connect with DB the error meassge is com.mysql.jdbc.Driver – user1464708 Jul 07 '12 at 00:12
-
@user1464708 Not much we can do without the entire error, and if possible, the full stacktrace. That should be a different question though. – WhyNotHugo Jul 07 '12 at 00:24
0
-
@AndrewThompson Please don't spam the same comment on every answer AND the question as well. – WhyNotHugo Jul 05 '12 at 23:42
-
@AndrewThompson - I don't think JWS is related to answering this question. In no way is JWS related to creating a .exe file. – djangofan Jul 06 '12 at 18:51
-
I try with Launch 4j and it fail to connect with mysql DB the output error is com.mysql.jdbc.Driver any idea??? – user1464708 Jul 06 '12 at 23:22
-
Yes, JDBC drivers are a unique beast and cannot be loaded using the typical classforname method when the app is loaded on another 'custom' classloader like Launch4j, Ant, YAJSW, etc. I believe there is a way to get it working but the JDBC .jar needs to be pre-loaded by the custom classloader. Using jconsole or JVisualVM to inspect the classloader (runtime classpath) may give you a better idea of what the problem is. Another possibility might be OSGI, similar to how SquirrelSQL and Eclipse would dynamically load the JDBC .jar . – djangofan Apr 14 '13 at 16:19