Jump to content
Excelsior Forums
tanelorn

Explicit Mixed Compilation Model

Recommended Posts

Hi,

The Excelsior JET 5.0 documentation states that "Even though certain classes of your application can be compiled statically, you may enable the mixed model for them explicitly."

It is also said that "You may also use this reflective shield facility to pick out the classes and packages that you do not want to precompile by simply making them unavailable to the JET static compiler."

Could you describe how this is performed? I can manually remove classpath entries before jc compilation, but then my compiled app throws ClassNotFound exceptions.

Best regards.

Share this post


Link to post
Share on other sites

Hi,

You can include missing jar files into classpath after compilation by setting the CLASSPATH environment variable. Note that CLASSPATH environment is used on development systems only and won't work after deployment. So be sure to explicitly set "java.class.path" property in JetPackII when preparing the installation package.

Another option is to "fool" the compiler by replacing jar files intended for mixed compilation with empty jars for the duration of compilation. But do not forget to restore the jar files after compilation ;)

-AlexM

Share this post


Link to post
Share on other sites

Hi,

removing the jars at compile time and setting up java.class.path to ensure their proper use at run time did the trick for me, indeed. xpack simplifies this, as I can ask it to copy the jars in the deployment directory.

After reading the KB 000030 ("PRB: Compiled application cannot find resources"), I also added to java.class.path the jars I compiled into my exe. I thought at first that they should be removed from the classpath, but that led to ressources not found, even if they are embedded in the app.

I think you should add an example demonstrating this (a compiled and a non-compiled jar, each containing resources) to your samples. But perhaps I overlooked it.

Thanks!

Share this post


Link to post
Share on other sites
I think you should add an example demonstrating this (a compiled and a non-compiled jar, each containing resources) to your samples.

You are right - such a sample or KB needs to be added.

Could you clarify one question regarding your use of Mixed Compilation Model?

removing the jars at compile time and setting up java.class.path to ensure their proper use at run time did the trick for me, indeed. xpack simplifies this, as I can ask it to copy the jars in the deployment directory.

That's correct.

After reading the KB 000030 ("PRB: Compiled application cannot find resources"), I also added to java.class.path the jars I compiled into my exe. I thought at first that they should be removed from the classpath, but that led to ressources not found, even if they are embedded in the app.

What you say is not quite clear. To my understanding the procedure is as follows:

1. You want to compile one or more JARs into EXE.

To do that, you simply add them to the  list of classpath entries on the Classpath page of the JET Control Panel. No matter  if you do that manually or using the java command line parsing on the New page.

2.  You compile the project and the Optimizer adds the JARs to the classpath automatically.

3. Then, you start JetPackII and add the compiled executable to the package files.

The "java.class.path" value displayed on the Resources page of JetPackII already includes the JARs compiled into executable.

No other classpath manipulations are necessary for the compiled JARs.

Question: why and when did you need to manually add the compiled JARs to the classpath?

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

×