Invoking Tidy from Microsoft's JVM

All,

I could really use some help getting Tidy to run in our unusual environment.
I am using Microsoft's Visual J++ (Version 6.0) on Windows NT.

The first problem I had was trying to "shell out", calling tidy.exe via
Runtime.getRuntime().exec().  Unfortunately, when this statement is
executed, the process which is created "hangs".  That is, on the subsequent
waitFor() call, the process never returns.  Note that I have successfully
used this technique to call other Windows executables.  At first, I thought
that maybe the problem was in the parameters I was passing to tidy.exe.  For
example, I thought that maybe the input filename was not being passed in
correctly and that tidy was waiting for input via standard in.  That would
certainly explain the hanging.  However, I have stepped through the debugger
and I am confident I am passing the parameters correctly.

Next, I tried calling a batch file from Java, that in turn calls Tidy.
Unfortunately, a similar problem occurs, but this time the batch file
"hangs" at the place where Tidy is invoked.  Any ideas on why the process is
hanging?  Any suggestions on how to get the process to complete?

For my third attempt to solve this problem, I downloaded JTidy.  I was
encouraged to see that a java version of tidy existed and I could avoid the
"shelling out" and hanging problems I was seeing above.  Unfortunately, when
I try invoking the parse() method of the Tidy object, I get a
java.lang.IllegalAccessError with the following stack trace:

java.lang.IllegalAccessError: org/w3c/tidy/ParserImpl: field _parseHead is
inaccessible
		at org/w3c/tidy/ParserImpl$ParseHTML.parse (ParserImpl.java)
	at org/w3c/tidy/ParserImpl.parseDocument (ParserImpl.java)
		at org/w3c/tidy/Tidy.parse (Tidy.java)

I did report the java.lang.IllegalAccessError error to this list back in
December 2000, and Gary Peskin kindly responded.  He said that he had seen
this error in Microsoft JVMs before.  Gary suggested I try turning off the
jit, which I think I did, but I am not 100% sure.  I can't figure out if I
have the Just In Time option set or not.  If I go to Tools->Options and
select "Debugger".  The "Just-In-Time debugger" checkbox is checked.  I
tried unselecting the checkbox, re-compiling, and re-running, but that did
not help.  Next, I went to the Compiler tab of my project's properties and
tried both -nojit and /nojit, but neither had an effect.  Interestingly, if
I put in garbage for a compiler option, it still compiles with any error
messages, so I'm not sure if I am doing this correctly.  I can't figure out
how to configure J++ to show me the actual compile/run commands it uses, so
I really can't confirm if I am using the jit option or not.  Does anyone
have specific instructions on how to turn off the just-in-time compiler for
Microsoft's J++ or how to configure it to display the compile and run
commands?  Then again, I'm not even sure changing this setting will
help-recall it was just a suggestion from Gary.  Does anyone know how to get
around this java.lang.IllegalAccessError?

I have successfully used JTidy from Borland's JBuilder.  Thus, I am
contemplating writing a tidy wrapper in JBuilder and trying to somehow call
it from J++.  However, I'd rather solve one of the above problems before I
head down this path, and I ask for your help.

Sincerely,
Michael S. Goldberg
mgoldberg@yet2.com

Received on Thursday, 10 May 2001 14:08:56 UTC