我如何告诉 javac 如何找到 imageio 类?

发布于 2024-12-02 00:33:37 字数 486 浏览 0 评论 0 原文

我是 java 开发新手,我只想使用 javac 作为我的构建系统。我正在使用 java 向其他人编写的程序添加一个功能,特别是涉及 GeoTiff 图像。

我在网上找到了一个我想使用的类,但是我在构建该类时遇到了麻烦,无论我做什么,我都会收到此消息:

javac GeoTiffIIOMetadataAdapter.java
GeoTiffIIOMetadataAdapter.java:11: package com.sun.media.imageio.plugins.tiff does not exist
 import com.sun.media.imageio.plugins.tiff.GeoTIFFTagSet;

我使用的是 RHEL5,所以我安装了我认为需要的软件包,jai-imageio-core.x86_64. 但问题仍然存在。我认为我没有正确设置一些变量(例如 -sourcepath 或其他变量)。我将不胜感激任何帮助。

I'm new to java development, I just want to use javac for my build system. I'm using java to add a feature to a program someone else wrote, specifically involving GeoTiff images.

I found a class online that I would like to use, however I'm having trouble building the class, no matter what I do I get this message:

javac GeoTiffIIOMetadataAdapter.java
GeoTiffIIOMetadataAdapter.java:11: package com.sun.media.imageio.plugins.tiff does not exist
 import com.sun.media.imageio.plugins.tiff.GeoTIFFTagSet;

I'm on RHEL5, so I installed the package I thought I needed, jai-imageio-core.x86_64. But the problem persists. I think that I'm not setting some variable corrently (like -sourcepath or something). I would appreciate any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

饮湿 2024-12-09 00:33:37

您需要使用 -cp-classpath 包含 jar。

所以你的编译就像 java -cp "" <您的 Java 类> 。

我认为您需要这个 jar 文件。

您可以在此处了解有关 javac 的更多信息。

You need to include the jar with -cp or -classpath.

So your compile would be like java -cp "<location to jai_imageio-1.1.jar>" <your java class> .

I think you need this jar file.

You can read more about javac here.

旧竹 2024-12-09 00:33:37

找出包在哪里安装了包含要导入的类的 jar 文件,并将其添加到 -classpath 中的 javac 命令行中。 (然后,当插件运行时,您还需要将其包含在类路径中;如何做到这一点可能取决于它插入的程序)。

Find out where the package installed the jar file with the class you want to import, and add it to the javac commandline in the -classpath. (You then also need to include it in the classpath when your plugin runs; how to do that may depend on the program it plugs into).

庆幸我还是我 2024-12-09 00:33:37

我认为我没有正确设置某些变量(例如 -sourcepath 或其他东西)

  • 本教程简要介绍了Java中环境变量的用法:PATH 和 CLASSPATH

  • 这似乎是最受欢迎的答案我在在线论坛上看到的各种与类路径相关的问题:设置类路径
    为了避免“盲目推荐”,我在添加到这个答案之前快速浏览了一下它,嗯......它确实涵盖了处理类路径所需知道的大部分内容。不错;我之前没有研究它的原因是附近总是有一些大师向我解释东西。

I think that I'm not setting some variable correctly (like -sourcepath or something)

  • This tutorial briefly introduces the usage of environment variables in Java: PATH and CLASSPATH

  • This one seems to be the most popular answer to various classpath related questions I've seen at online forums: Setting the class path.
    To avoid "blind recommendation" I quickly skimmed through it before adding to this answer and, well... it really covers most of what one needs to know to deal with classpath. Pretty good; the reason why I didn't look into it before is that there always has been some guru nearby who explained stuff to me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文