Using XMLC and understanding IDEA's run feature

I am attempting to use the enhydra compiler, XMLC, which takes XML or HTML and creates java classes, from within IDEA but I seem to be running into an inexplicable classpath problem.

My question boils down to how exactly IDEA "runs" a compiled program, at least on Windows. For example, after compiling a program and pressing run, if I copy the run command that appears in the IDEA run window into a command window and execute it, the program runs as expected. However the very same command fails to find the classes it needs from within IDEA. I get errors like:

package org.enhydra.xml.dom does not exist
import org.enhydra.xml.dom.DOMOps;
or
cannot resolve symbol
symbol : method getMIMEType ()

I know IDEA uses javaw.exe and not java.exe, so is this the source of the problem? If it is, could someone shed some light on this basic issue? How exactly does IDEA run a compiled program?

TIA,

Curious George

2 comments

Well, I think I can explain.

IDEA runs programs through the use of a launcher whose only purpose now is
to setup the thread listening to socket through which IDEA communicates with
running program. If you have a look at command line you will immediately
notice this: the main class is not the user supplied one, but something
called AppMain.

Moreover you may notice that classpath settings are changed to reduce
classpath to what is needed to setup the thread. When this thread is baked,
the new classloader is created from the path in idea.user.classpath and user
main routine is invoked using this.

The problem in 815 is that the system classloader still uses the path
supplied in original classpath, so if you program relies on the system
classloader, then it will probably fail to load classes. This problem still
remains in 816 and is fixed only in the coming 817 build. Also note that
before 817 you may avoid the use of custom launcher and all this stuff by
just deleting JNIWrap.dll from your %IDEA_HOME%\bin directory, the hint
already discussed several times on the forums.

Hope this helps,
Eugene.


0

And one more thing: not javaw but java is used with the launcher


0

Please sign in to leave a comment.