Forum How do I...?

Run prince from Java:Bad version number in .class file

klin
I'm trying to run Prince in java and get the following error message:

java.lang.UnsupportedClassVersionError: Bad version number in .class file

I'm new to Prince, please advise.
klin
I recompiled and made a new Jar with JRE1.5, the error is gone. However, I'm still unable to get the following simple test right:

import com.princexml.*;
import java.io.*;

public class test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Prince p = new Prince("C:\\prince\\prince.exe");
boolean result;
try {
result = p.convert("C:\\temp\\testprince.html");
if (result) System.out.println("Worked");
else System.out.println("Failed");
}
catch (IOException e) {
e.printStackTrace();
};
}
}

It says "failed", but I have no idea what went wrong, nor do I know how to check the error. Please help.
mikeday
You will need to point to the command-line exe file, which is probably C:\Prince\Engine\bin\prince.exe in this case.
klin
Yeah that was the issue. However, is there a way to check error? Is PrinceEvents implemented?
mikeday
Yes, it is used for getting log messages back from Prince. However, this will not return anything if the Prince executable has not been run.