File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Could not compile JTidy (jtidy-04aug2000r7-src) with JDK1.6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Could not compile JTidy (jtidy-04aug2000r7-src) with JDK1.6 " Watch "Could not compile JTidy (jtidy-04aug2000r7-src) with JDK1.6 " New topic

Could not compile JTidy (jtidy-04aug2000r7-src) with JDK1.6

Jack Bush
Ranch Hand

Joined: Oct 20, 2006
Posts: 235
Hi All,

I am having difficulty compiling the latest version of JTidy source code on Windows XP, SP2 platform with the following error:

I am using the build.xml from MKSearch Ant build file for re-packaging the JTidy classes

Also tried compiling on jtidy-04aug2000r7-dev & jtidy-04aug2000r7-bin without much luck either.

There are numerous forum conversations on how to use JTidy but nothing on how to build it especially on overcoming Class the compatibility conflict with standard Java distributions that occurred since JDK1.5 back in 2004. I am surprised that no one has updated JTidy to overcome this issue.
Any advice or suggestion on this issue would be appreciated.


Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

But to me it doesn't look like you have run into anything like Java 5 incompatibility.
java.lang.NoClassDefFoundError: org/apache/tools/ant/Main
Looks more like you just messed up your classpath and java.exe just can't find Ant's main class.
[ July 07, 2008: Message edited by: Paul Clapham ]
Jack Bush
Ranch Hand

Joined: Oct 20, 2006
Posts: 235
Hi Paul,

I have fixed the AntMain error and the following incompatibility error returned:

Would you be able to interpret what the resolution step is from JTidy development notes ( since I couldn't follow its instruction, or not sure whether it is still relevant?


William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
If this was my problem I would follow the suggestion to use -source 1.4
(use -source 1.4 or lower to use 'enum' as an identifier)

-OR- change the source code to rename the "enum" variable name.
Jack Bush
Ranch Hand

Joined: Oct 20, 2006
Posts: 235
I overcame the 'enum' limitation by renaming this variable to non-reserved Java word and successfully completed the Ant build. However, only the Tidy.jar file was generated as opposed to JTidy.jar.

The following program was use to convert a HTML file to XML without success still:

It turned out that the Patient.xml file was still in HTML format. I cross checked the conversion by running the following command using the Tidy utility which successfully produced an equivalent XML file:

In short, the Ant build failed despite having resolved the 'enum' limitation.

The errfile turned out to be slightly different.

Any suggestion would be appreciated.


I agree. Here's the link:
subject: Could not compile JTidy (jtidy-04aug2000r7-src) with JDK1.6
It's not a secret anymore!