Jump to content
Excelsior Forums
DMA02

Compile & pack only selected jars

Recommended Posts

Hi there,

Using JET v7 evaluation.

I have my program which consists of 3 jar files. I want excelsior jet to compile and pack those 3 jar files into an executable but leave the rest of the 30 or so libs alone.

I noticed that it compiles or packages everything else all into one huge executable. It works but I kinda want the other libs to be regular jar files outside, so i can replace them with newer versions without having to recompile.

Is there some interesting trick to do this?

Thanks in advance.

Share this post


Link to post
Share on other sites

It is possible if your 3 jars do not contain classes/interfaces derived from classes residing in the rest of 30 jars.

Excelsior JET cannot compile (and thus protect) classes whose superclasses are not available at compile time. When this occurs, the compiler leaves the classes in bytecode form and packs them into EXE as is.

There is a trick for such cases:

1. Prepare fake jars with names of those 30 jars and supply them to the compiler.

Do not forget to select "none" in the "Pack into EXE" column for those 30 jars (page "Classpath" of JET Control Panel.)

2. Then click "Check consistency", to check if you will have uncompiled classes in your 3 jars due to absent superclasses (they will be marked with a black icon).

3. After compilation, replace fake jars with the real ones.

Altenatively, you may skip creation of 30 fake jars and specify only 3 jars to the compiler. In such case, replace the classpath of your application after compilation via manually setting the "-Djava.class.path" VM property.

Non-compiled jars will be handled by the JIT compiler that comes with the JET Runtime.

Share this post


Link to post
Share on other sites

It is possible if your 3 jars do not contain classes/interfaces derived from classes residing in the rest of 30 jars.

Excelsior JET cannot compile (and thus protect) classes whose superclasses are not available at compile time. When this occurs, the compiler leaves the classes in bytecode form and packs them into EXE as is.

There is a trick for such cases:

1. Prepare fake jars with names of those 30 jars and supply them to the compiler.

Do not forget to select "none" in the "Pack into EXE" column for those 30 jars (page "Classpath" of JET Control Panel.)

2. Then click "Check consistency", to check if you will have uncompiled classes in your 3 jars due to absent superclasses (they will be marked with a black icon).

3. After compilation, replace fake jars with the real ones.

Altenatively, you may skip creation of 30 fake jars and specify only 3 jars to the compiler. In such case, replace the classpath of your application after compilation via manually setting the "-Djava.class.path" VM property.

Non-compiled jars will be handled by the JIT compiler that comes with the JET Runtime.

Is it possible to do this with the !batch directive? Ideally I would like to -pack=none for some jars and then change the -pack to all for the remaining jars retrieved with a different batch directive?

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×