是否可以编译 PDFRender 以在 JRE 1.4 上运行?
我想使用Java的PDF到图像转换API, PDF-Renderer 似乎相当好的。由于它是为 JRE 1.5 合规性而编写的,因此当我尝试编译到 1.4 时,会出现很多编译错误。我尝试调整编译器兼容性选项但没有成功。那么,PDF Renderer 是否有 1.4 兼容版本?如果没有,想知道是否还有其他 PDF 选项=> java 中的图像渲染器,与 JRE 1.4.2+ 兼容
I would like to use a PDF to image conversion API for Java, PDF-Renderer seems to be quite good. As it's been written for JRE 1.5 compliance, I get alot of compile errors when I try to compile down to 1.4. I have tried tweeking the compiler compatibility options without success. So, is there a 1.4 compatible build for PDF Renderer ? If not would like to know if there are any other options for a PDF=> image renderer in java that is compatible with JRE 1.4.2+
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您运行 javac 时,请使用命令行选项
-target 1.4
。由于 java 1.5 添加了泛型和枚举,两者都是编译器功能,我相信 javac 将成功生成与 1.4 兼容的字节代码。但稍后您可能会遇到一些问题。例如,如果 PDFERenderer 使用 JDK 1.5 中的 java 类,而在 JDK 1.4 中找不到......在这种情况下,您可以尝试在运行应用程序时将它们添加到 bootclasspath,但我不能保证成功,因为类可能依赖于其他类等等...
您可以尝试,但我个人建议您升级到 java 1.6。 :)
when you are running javac use command line option
-target 1.4
. Due to java 1.5 added generics and enum that both are compiler features I believe that javac will succeed to generate 1.4-compatible byte code.But you will probably have some problems later. For example if PDFERenderer uses java classes from JDK 1.5 that cannot be found in JDK 1.4.... In this case you can try to add them to bootclasspath when you are running your application but I cannot guarantee success because classes may depend on other classes etc...
You can try but I'd personally recommend you to move forward to java 1.6. :)