找不到包,即使它同时位于构建类路径和运行时类路径中
我无法编译 Java 程序,因为某些导入的包未找到,即使它们同时位于构建类路径和运行时类路径中。
下图显示了问题所在。我在 eclipse 中突出显示了 gdata-media 包。它对应于第一个编译错误。
截图http://img3.imageshack.us/img3/5199/classesnotavailable.png 点击查看大图
我做错了什么?
I am unable to compile a Java program because some of the imported packages are not found even though they are in both the build classpath and runtime classpath.
The image below shows the problem. I have highlighted the gdata-media package in eclipse. It corresponds to the first compile error.
screenshot http://img3.imageshack.us/img3/5199/classesnotavailable.png
Click for full size
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Eclipse 类路径和项目设置与命令行 javac 工具无关
The Eclipse classpath and project setup has no bearing on the command line javac tool
您用来编译代码的命令是什么?你那里有类似 -cp 或 -classpath 的东西吗?确保包含 YouTubeUpld 类的 jar 文件是该 -classpath 参数的一部分。有关如何设置 CLASSPATH 的更多信息,请参见此处< /a>.如果您没有显式指定类路径,javac 会从 CLASSPATH 环境变量中读取它
顺便问一下,为什么您不能直接从 Eclipse 启动您的应用程序,因为它是在 Eclipse 中编译的?
What's the command you are using to compile your code? Do you have something like -cp or -classpath there? Make sure that the jar file containing YouTubeUpld class is part of that -classpath parameters. More on how to set up CLASSPATH can be found here. If you do not specify the classpath explicitly javac reads it from the CLASSPATH environment variable
By the way why can't you just launch your app from Eclipse since it compiles there?