RE: Invoking Tidy from Microsoft's JVM

Thanks a million, Gary!  Recompiling did the trick.  I can now use JTidy
from Microsoft's J++.

A couple of points to note for future reference:

1) I received a compile error in Tidy.java.  According to the compiler, a
catch block was unreachable because the statement inside the try block did
not throw the exception being caught.  The code is probably right, and the
exception is probably thrown with a later version of Java, like 1.2 or 1.3.
Microsoft's J++ appears to be based on one of the older Java versions, like
1.1.  I suspect the exception was not thrown in the java version on which
J++ is based.  I simply commented out the offending catch block and was able
to recompile.
2) When I packaged up my recently-compiled class files, I needed to include
the lone properties file in the zip package, which I missed the first time.

Recompiling the JTidy source in J++ and repeating the above two steps is not
difficult, but if anyone else needs to do it and would like to skip it, I
would be happy to share the zip file I created with anyone who requests it
(via e-mail, as I do not always monitor this list).

Thanks again,
Michael

 -----Original Message-----
From: 	Gary L Peskin [mailto:garyp@firstech.com] 
Sent:	Thursday, May 10, 2001 11:44 AM
To:	Michael Goldberg
Cc:	'html-tidy@w3.org'
Subject:	Re: Invoking Tidy from Microsoft's JVM

Hi, Michael --

I believe that subsequent reports of the IllegalAccessError have
revealed that the problem can be fixed simply by recompiling the code. 
The source is downloaded with the java version and there are not too
many .java files.

It seems like this had to do with some sort of compiler incompatibility
with the compiler that we used to create the .class files.  It should be
fixed for future releases but this should get you by for now.

HTH,
Gary

Michael Goldberg wrote:
> 
> 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 Friday, 11 May 2001 11:20:46 UTC