CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Java and JSP (http://www.codingforums.com/forumdisplay.php?f=54)
-   -   Converting.java to .exe ? (http://www.codingforums.com/showthread.php?t=149724)

Inquisit 10-07-2008 05:05 PM

Converting.java to .exe ?
 
Question

Is there a way to Convert a .java file to an exe file

i use NetBean 6 and i have a source folder in that src folder

a main java project file .java (1) 1 file

individual.java files (2) files

now i want to convert this source folder with all the.java files to one .exe file to run under native Windows OS

i have softwares such as

JSmooth

EXE4J



i dont know how to do this in either 1 if there's a way i can convert that whole folder to an exe file would be very helpful
for the completion of my software


Solutions are welcome:confused:
thanks

shadowmaniac 10-07-2008 07:25 PM

Haven't tried it myself but this seems pretty straight forward:
Quote:

2.2. Creating your first exe

Building your own EXE wrapper for your java application just needs a few simple steps: specify the name of the executable, define the main java class, optionally a classpath if it needs more than its own jar, and that's all.
2.2.1. Quick Start

The minimum data you need to start the creation of the binary executable for your application is to specify a classpath and the fully-qualified name of your main class. You can configure both in the Application panel (add new jars or directories using the icon with a yellow + sign, and type the class name in the Main Class field.

Once done, go to the Windows Executable panel, and type the name of the executable in the Executable Name field. Do not forget to add the .exe suffix, for your executable name. Something like my-app.exe should be fine.

Of course, you can specify many more options for the java wrapper, but this is enough for a basic java application. Now, click on the save button (or in the File+Save menu) and select a filename for the project. This is an important step, because all the path stored in the file, and displayed in the GUI are relative to this project file. Selecting a location under the root directory of your project is a good (and safe) choice.

Once your project is saved, it is just a matter of clicking on the Project+Create Exe. And that's it. You can use the Project+Run Exe to run the program, or use the windows explorer to run the executable.
Source: http://jsmooth.sourceforge.net/docs/...oc.html#N100B0

Aradon 10-07-2008 10:10 PM

Most windows come with the JRE, if this is the case you shouldn't be creating an exe, but instead should be creating a jar file. JAR files are like exe's, but for Java only!

http://java.sun.com/docs/books/tutorial/deployment/jar/

Inquisit 10-08-2008 12:25 AM

Thanks im on it right now

Inquisit 10-08-2008 12:28 AM

Jar files need a JRE or IDE to run thats the disadvantage but with .exe it can be accessed anytime anywhere....

thnaks appreciate your help on this one D..

Fou-Lu 10-08-2008 04:53 AM

I'd have to disagree. An .exe will only work for the framework it was developed for - a Windows .exe is unlikely to be executable on Linux for example. This is why Java is advantageous with the JRE, so the bytecode can be dynamically interpreted by the host system. This takes the specific architecture away from the developer, making applications more portable. This is one of the advantages that Java has over C# (which will only run to its full extent on a Windows machine). The .NET framework also uses the MIL, so its taking the same approach to the interpreter as Java does.
This of course, ignores emulations like cygwin and wine. If you want to make executable files, use C/C++.

Inquisit 10-08-2008 08:47 PM

all the same then is it possible converting to C" from .java then to exe from C# if you know of any software?

anyways thanks though was helpful


All times are GMT +1. The time now is 04:57 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.