Java is a great development environment, designed to enable rapid generation
of relatively bug-free versatile robust code. For deployment to Win32 platforms, greater performance
and end-user convenience can be achieved by compiling your Java bytecode into
Win32 executable applications (which however still require the MS-JVM installed for
certain Java-specific dlls). The Microsoft utility jexegen.exe, included with
the Microsoft SDK 4 for Java converts
arbitrary Java bytecode class files, and any resource files (images, sound, text, binary ..)
into a self-contained win32 executable .exe file, launchable on any win32 platform
with IE4+ installed.
jview com.javascience.msapps.RandomLogo java com.javascience.msapps.RandomLogo
jexegen /main:com.javascience.msapps.RandomLogo /w /out:randomlogo.exe com/javascience/msapps/*.* flask.resNote how the com/javascience/msapps/*.* specifies all the files (class, image, source code etc..) be included in the exe file as resources. The /w switch prevents the console window from appearing. The optional flask.res is a binary win32 resource file specifying resources for the .exe file, such as a custom icon (see below).
signcode -cn "Security Development" -n "Embedded Image demo" -t "http://timestamp.verisign.com/scripts/timstamp.dll" randomlogo.exeTo verify or inspect the signature on the exe file, right click it and select the Properties/Digital Signatures pane.
To run the resultant randomlogo.exe file,
just double-click as usual for any win32 application.
(1) Use VC++ 6 to edit the .exe file as a resource and add an icon resource.
(2) Generate and compile a custom stub .exe file with the custom icon (SDK4/Java samples).
(3) Use the rc.exe utility (Resource Compiler) provided with the Windows Platform SDK (doesn't require
the C++ compiler).
The manual approach using the rc.exe Platform SDK utility is now described:
#include "resource.h" IDI_ICON ICON flask.icoresource.h
#define IDI_ICON 101