executable wrapper : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

executable wrapper
A utility that takes a Java jar file and bundles in inside a Windows exe file to give the illusion the program in a C utility. It still needs a JVM (Java Virtual Machine) to work. It is not the same as a native compiler. There are a number of variations:
Creating an EXE file Self Contained Kickers
AOT compilation Installer
Shortcuts Class Wrapper
Executable Jars Java Web Start
Independent Kickers Links

Creating an EXE file

Here are eight ways to get what acts like a Java executable file:
  1. AOT (Ahead Of Time) compilation

    Use an AOT native compiler. This is the only method that gives you a true machine code executable. You may still have to distribute some DLLs (Dynamic Link Libraries) or the JRE (Java Runtime Environment) along with your executable. Examples are JET and gcj. This the only technique mentioned here that speeds up execution. The other techniques are kludges to make Java look like a familiar exe file, without truly being one. See the native compiler entry for a discussion of the advantages and disadvantages of true native compilation.
  2. Shortcuts

    Set up a shortcut with the appropriate java.exe command to load the class.
  3. Executable Jars

    Bundle your classes in a jar with the Main-Class attribute. Set up an association for *.jar to make it executable.
  4. Independent Kickers

    Write yourself a tiny C kicker program that exec’s a Java command to load your class. Assuming the jar file Foo.jar with main class Bar, here how to make a Foo.exe tiny kickoff program. Compile the following program foo.c to foo.exe:
    #include <process.h>
    int main(void)
    {
    execlp(java.exe,
    java.exe,
    -cp,
    foo.jar,
    Bar,
    NULL);
    return 0;
    }
  5. Self Contained Kickers

    If you want to play really strange games, concatenate the jar file onto the end of your foo.exe kicker and put the EXE file on the classpath where you would normally need to place foo.jar. This way you can distribute but a single file, albeit uncompressed. Reputedly java.exe will happily treat this combo as a standard jar. Executing the foo.exe just ignores the jar tacked on the end, e. g. In this case your custom foo.c kicker code will look like this:
    #include <process.h>
    int main(void)
    {
    execlp(java.exe,
    java.exe,
    -cp,
    foo.exe,
    Bar,
    NULL);
    return 0;
    }
    then
    rename foo.exe littlefoo.exe
    copy /b littlefoo.exe + foo.jar foo.exe
    You only need distribute foo.exe.
  6. Installer

    Use the InstallAnywhere NOW installer (or other installer). It uses a standard platform-dependent EXE kickoff file for a standard interpreted platform-independent Java application packaged in a jar file.
  7. Class Wrapper

    The Microsoft SDK (Software Development Kit) for Java included a tool called jexegen which turned your *.class file(s) into an *.exe file. It didn’t compile them or convert them to machine code; it just stuffed the contents of the *.class files into the *.exe file along with some code to pass those bytecodes to the MS JVM to be interpreted. The resulting exe files needed access to the Microsoft JVM to work, unlike true native *.exe files which are standalone and written in machine code.

    Though Microsoft’s Jexegen and Webgain Café and Oracle’s J2Exe are gone, there are other programs that use the similar wrapping technique:

  8. Java Web Start

    Distribute using Java Web Start. Users can click on menu or desktop items to kick off pure java Programs.

This page is posted
on the web at:

http://mindprod.com/jgloss/executablewrapper.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\executablewrapper.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[3.129.249.170]
You are visitor number