Jump to content
Excelsior Forums
Marcel_Mosterd

StandAlone .EXE and JAR FILES

Recommended Posts

I want to make a standalone .EXE file.

I don't want to include the JAR files in the .EXE file, i want to put them in a diferent lib directory.

Here's some files i don't want to include

xalan-2.0.0.jar

xerces-1.2.3.jar

xalanj1compat.jar

fop.jar

How can i make such a .EXE.

Using mixed mode :huh:

How does a project file looks like??

some examples i use in my project file

%!resource "C:\java\Development\Soixantneuf\Lib\xerces-1.2.3.jar"

I'm using version 2.5 of JET

Share this post


Link to post
Share on other sites

Wrong term - if .exe requires .jar or other files to run, it would not be standalone. Maybe I've understood something wrong?

If you wish to not bind these jars to the executable, simply choose "Leave intact" option in the step 4 in the GUI front-ent (I suppose you use it).

Share this post


Link to post
Share on other sites

Yep, that's what i meant but when trying NOT to include with the "Leaving intact" option selected.

We've got the following exception, we get a NULLPointer exception and a Stack overflow.

When adjusting the Heap size and setting correct classpath it's still not working

Here's the project file

%% Excelsior JET v2.50 project file

-ignorememberabsence-

-ignoreclassabsence+

-ignoreclassduplication-

-genasserts-

-gui-

-compilerheap=104857600

-stacklimit=900000

-genstackalloc+

-inline+

-inlinelimit=100

-inlinetolimit=1000

-jetvmprop=-Djet.gc.heaplimit:0

-main=Soixantneuf

%!resource "C:\java\Development\Soixantneuf\Classes"

%!resource "C:\java\Development\Soixantneuf\Lib\ant.jar"

%!resource "C:\java\Development\Soixantneuf\Lib\avalon-framework-4.0.jar"

%!resource "C:\java\Development\Soixantneuf\Lib\batik.jar"

%!resource "C:\java\Development\Soixantneuf\Lib\classes12.zip"

%!resource "C:\java\Development\Soixantneuf\Lib\fop.jar"

%!resource "C:\java\Development\Soixantneuf\Lib\logkit-1.0.jar"

%!resource "C:\java\Development\Soixantneuf\Lib\xalan-2.0.0.jar"

%!resource "C:\java\Development\Soixantneuf\Lib\xalanj1compat.jar"

%!resource "C:\java\Development\Soixantneuf\Lib\xerces-1.2.3.jar"

-lookup=*.class=C:\java\Development\Soixantneuf\Classes

!batch *.class "nl"

!module "Soixantneuf.class"

!module "C:\java\Development\Soixantneuf\Jet\Icon\Icon.ico"

Any idea?! ;D

Share this post


Link to post
Share on other sites

You should run the resulting exe by invoking run_<prjname>.bat file. It is automatically created by LaunchPad in your project directory. Check that those jars are included to the %classpath% in this batch file.

Share this post


Link to post
Share on other sites

We have done this and everything looks fine, every JAR files has been set in the classpath.

But when executing this batch file we got the following exception :

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/parsers/Do

umentBuilderFactory

we know that both xerces-1.2.3.jar and  xalan-2.0.0.jar contains this class maybe this gives a conflict

:huh: ???

Share this post


Link to post
Share on other sites

It looks like that this class was not compiled.

Go to page 3 (Define Compilation set), assure that all required jars are included to classpath entries set. Then find the class javax/xml/parsers/DocumentBuilderFactory in the "Compilable classes" window. Check that it is included to the compilation set (see legend). If it is not included (it may occur if the class is used only through dynamic loading in your application), then force it to be compiled.

Share this post


Link to post
Share on other sites

When the classes of our jar files are forced to be compiled our exe becomes very large, as same as you would include the jar files in the exe. So what will be our advantage between those two options.

Or is it better to use dynamic loading instead to reduce our exe.

Share this post


Link to post
Share on other sites

You may force to be compiled not only whole jars, but separate required classes (those that are mentioned in the NoClassDefFoundError message).

Generally, if the class is used (regardless whether it was imported or dynamically linked), it is strongly recommended to compile it. Otherwise (if these classes are compiled at run-time by internal just-in-time compiler, requires mixed model compilation), the performance can be significantly reduced.

The better way to reduce the size of EXE is to compile required libraries into DLLs. Read the manual for details.

Share this post


Link to post
Share on other sites

×