Java – converting jars using ikvm (flying navigator – xhtmlrenderer)

I think so Net, so I try to use ikvm to convert the flying navigator Library:

ikvmc core-renderer.jar

For some reason, ikvmc gave me an EXE core renderer Exe, so I renamed it core renderer DLL, added to my assembly and hacked

using java.io;
using java.lang;
using com.lowagie.text;
using org.xhtmlrenderer.pdf;

namespace flying_saucer
{
    class FlyingSaucerApp
    {
        static void Main(string[] args)
        {
            // This works
            DocumentException dummy = new DocumentException();

            ITextRenderer renderer = new ITextRenderer();


            // For some reason,this raises NoClassDefFoundError                
            renderer.setDocument(File("hello.xhtml").toURI().toURL().toString());
        }
    }
}

For some reason, it gives Java lang.NoClassDefFoundError:com. lowagie. text. DocumentException. I realized that documentexception was something itextrender () might throw, but I already included com lowagie. Text, any ideas?

Solution

It turns out that for this special case, I need to render the flying navigator and iText (the dependencies of the flying Navigator) and let the flying navigator assembly reference its dependencies:

ikvmc -target:library itext.jar
ikvmc -target:library -reference:itext.dll core-renderer.jar

(for novices: if you don't read any documentation and just try the command, you also need to make sure that the DLL file attached to ikvmc also exists - the easiest way is to dump all ikvmc files to your iText jar file)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>