Está en la página 1de 4

Convertir Archivo Java a EXE

Hola a todos, ando buscando un programa que sea capaz de convertir una aplicacion
hecha en Java, a un archivo ejecutable (archivo.exe). Se que hay programas que lo hacen,
pero no he sido capaz de dar con ellos. Me gustaria saber si me pueden ayudar.

Se llaman "Ahead of Time Compilers (AOT)".

La primera respuesta que vas a obtener en todos los foros de Java sera,
Por qu? Convertir a .exe eliminara el objetivo de Java. (Portabilidad).

En Linux el compilador "GNU gcj" es una herramienta open source


que permite generar cdigo binario ejecutable para Linux. (Por ser
open source todava le hace falta desarrollo y creo que es compatible
solamente con la especificacin 1.4 y anteriores, pero funciona
muy bien en la mayora de los casos).

En Windows creo que solo "Excelsior JET" y tienes que comprar las
licencias adecuadas o seguir las instrucciones que tiene en su sitio
para optar por una versin no-comercial.

Hay otro tipo que no convierte y solamente lo encapsula...


http://www.monografias.com/trabajos2...igo-java.shtml

Hay mucha informacin al respecto en google. (Demasiado como para


reproducirla por aqu).

http://www.google.com/search?q=AHEAD+OF+TIME+AOT+JAVA

Y es muy importante que leas el siguiente artculo, que describe


exactamente "por qu", "cuando", "cuando no" y "como".

http://www.excelsior-usa.com/articles/java-to-exe.html

ltima edicin por HackmanC; 28-feb-2008 a las 13:10

Convert Java to EXE


Why, When, When Not and How
By Dmitry LESKOV
Last update: 25-Apr-2009
If you are sure you need a real EXE, go straight to AOT Compilers.
"How do I make an .EXE file from my Java application?", "Need help
converting jar to exe", "Is it possible to create a Windows executable
using Java?" --- these and similar questions are among the most popular
topics on Java developer forums. Should you start such a topic today,
you are likely to encounter the following three types of replies:
"You cannot"
"You should not, because that would kill the very purpose of Java"
"You can do that with third party software X and Y"

The truth is that there exist two completely different approaches to the
creation of native executables from Java applications, addressing
different sets of problems. Moreover, under certain conditions some of
those problems may be solved without making an EXE. So the most
correct way to reply to such a post would be a request for more
information, namely what is the goal of conversion to EXE. And the most
frequent answer would be

Simplify Java Application


Deployment
Our Services
We help Java developers find the root causes of:
Performance bottlenecks
Scalability issues
Intermittent bugs
etc.

Java compiles to platform-independent bytecode (.class files), which is


not directly supported by PC hardware. So a Java program needs a Java
Runtime Environment (JRE) to run, which would either interpret the
bytecode instructions or compile them to native code on the fly. This in
turn means that the author of that program has to ensure somehow that
the proper version of the JRE is installed on an end user system.
In a general case you may not expect that your end users will know what
a JRE is, how to check its version, and how to download and install it.
This is especially true for consumer applications, such as games or
multimedia. And those who already have a JRE installed may not like the
idea about installing a different version, because it may break their
existing Java applications and favorite applets.
Then, even if you can make sure the right version of the JRE is properly
installed on enduser systems, which is quite possible in a classroom or
enterprise environment, the command line required to launch your Java
application can be quite long:
java -Xmx200m -cp whatever.jar -Dsome.property MyApp
Yes, you may put that line into a batch file and call it runme.bat, but it
looks so much easier to give your program to a friend, teacher or
colleague as a single file that can be run by a double-click. Or, even
better, enable it to be installed and uninstalled in a native manner
without affecting other applications.
So it comes as no surprise that the primary motivation for seeking a way
to convert a Java application into an EXE file is to make its deployment
and use simpler and safer for an average user, that is, a Windows user.
What surprises newbie Java developers is that the JDK does not offer
such functionality. Before J2SE 1.4, all you could make with JDK tools
were

Executable Jars
Pros
No need to use any third-party tools

Single distribution for all Java-enabled platforms


Cons
Application will not start on systems that do not have a JRE (properly)
installed

Application will not work if it uses APIs absent in the default JRE

Need to teach users that .JAR files are clickable


Resources
The Java Archive (JAR) File Format
Tools
One-JAR
Autojar
Fat Jar
Java Launcher
You can make your Java application runnable via a double-click by
packaging it into a so called executable jar. You do that by specifying the
main class of your application, any extra jar files it may require and so
on in the jar's manifest file
Main-Class: MyAppMain
Class-Path: mylib.jar
Then you use the jar utility from the Java SDK to package your classes
and resource files, specifying the m option and the name of your
manifest file:
jar cvfm MyApp.jar MyApp.mf *.class *.gif
This will result in the creation of MyApp.jar. Now, if you type
java -jar MyApp.jar
the Java launcher will read the manifest from MyApp.jar and invoke the
main method from the class MyAppMain. Moreover, if you double-click that
jar file on a system that has JRE installed, the java launcher will be
invoked automatically.
Note: As of J2SE 5.0, jar files are associated with the javaw launcher on
Windows, which does not open a console on startup. If your application
needs a console, write a batch file which would start it using the java
launcher.
If your application consists of more than one jar file, there is an open
source tool called One-JAR that claims to correctly repackage multiple
jars into one.
The major problem with executable jars is compatibility. The default JRE
may be of an older version than is required by your application or may
not have the necessary Java Optional Packages (previously known as
Standard Extensions) installed. For instance, if your app uses the java.nio
package introduced in Java 2 version 1.4, it will not work on JRE 1.3.x.
Similarly, if it uses JavaMail 1.3, and the default JRE has JavaMail 1.2 or
JavaMail is not present at all, the double-clicked jar will not run.
Fortunately, Sun has created a Java application deployment technology
that eliminates this compatibility problem and adds some nice features.
It is part of the Java 2 platform since version 1.4 and is called

También podría gustarte