Can't simulate java.ext.dirs in IntelliJ

Out problem is this:

In the past we used to put all our extensions in ...\JRE\lib\ext.

Because we are working with many versions of Java, we decide to put all our extensions in other common place ...\JavaExt.
Now we are using the option:
-Djava.ext.dirs=...\JRE\lib\ext;*...\JavaExt * (-extdirs for compilation).

When working with IntelliJ we add all JARs under ...\JavaExt as a project library;

The problem that we have no way to tell IntelliJ that ...\JavaExt should run as extensions and added to the regular class path.
There some cases that the difference is important. i.e. illegal code is running OK under intellij and not from shell and vice versa.

I remember(but i can't found it now) there was a open task that different libraries can be marked for different use, for example mark a library for run-time only. I think my problem goes there too.

Any way to solve this problem ?

Thanks
Boaz

4 comments
Comment actions Permalink

The problem that we have no way to tell IntelliJ that ...\JavaExt should run as extensions and added to the regular class
path.


Not sure I understand the problem right. If the libraries from "JavaExt" are attached to some module, they will be added to the
classpath when running the app from IDEA. Did you mean they must not be added?


--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

Yes they will be added.
My problem is they way the added. They are added to the class path(using -classpath) means that they are loaded by the application loader.

But when I run it from shell they are added using the -Djava.ext.dirs, means they are loaded by the extension loader(sun.misc.Launcher.ExtClassLoader).

This is big different to us.

Thanks
Boaz

0
Comment actions Permalink

Boaz Nahum wrote:


The problem that we have no way to tell IntelliJ that ...\JavaExt should run as extensions and added to the regular class path.

You mean "... should run as extensions and not added to the regular
class path", right?

I presume that simply specifying -Djava.ext.dirs=C:\whatever as VM
property in the run configuration doesn't work, because your classes are
picked up and loaded by the application class loader first?

R

0
Comment actions Permalink

Boaz Nahum wrote:


The problem that we have no way to tell IntelliJ

that ...\JavaExt should run as extensions and
added to the regular class path.

You mean "... should run as extensions and not
added to the regular
class path", right?

Yes -exactly.


I presume that simply specifying
-Djava.ext.dirs=C:\whatever as VM
property in the run configuration doesn't work,
because your classes are
picked up and loaded by the application class loader
first?


No. It does work. The problem is that my jars are appeared now on list of two ClassLoaders, and i can run into situations(?) in which same class will be loaded by two different class loaders.
But i really need to think if it can happen. Maybe someone can help with that ?
If it can't happen then my problem become only a cosmetic problem - i need to specify library both as a global/project/module library and in the VM parameters.

Thanls
Boaz

0

Please sign in to leave a comment.