classpath错误 [英] classpath error

查看:121
本文介绍了classpath错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有我是一个初学java用户,我得到一个与我认为的类路径有关的错误。


我有一个文件JM550b.java,它试图访问类QTCycle时编译。 QTCycle.java创建一个名为jmqt" package jmqt;"的软件包。并且该类被放置在该文件夹中。


QTCycle.java成功编译但是当我尝试编译JM550b.java时,我收到一条错误,上面写着无法访问QTCycle。在线私人静态QTCycle播放器;


它还说


无法访问QTCycle

坏类文件:C:\Documents and Settings \Rachael \Desktop \Dom\Tutorial\jmqt\QTCycle .class

类文件包含错误的类:jmqt.QTCycle

请删除或确保它出现在类路径的正确子目录中。

私有静态QTCycle播放器;"


我的目录是这样的:(我确定这是出现问题的地方,请帮我解决这个问题!)

桌面\ DomD!\\ Tutorial \ src - 这是主要的.java我的项目的文件保存,因为主程序将访问几个类。

Desktop \Dom \Tutorial \ _jmqt - 这是QTCycle类在编译时所用的地方

我不确定我还需要说什么,但如果有人可以提供帮助,我会很高兴能提供所有信息。

请帮助!

hey all im a beginner java user and am getting an error relating to the classpath i assume.

I have a file JM550b.java which is trying to access the class QTCycle when compiling. QTCycle.java creates a package called jmqt "package jmqt;" and the class is placed in that folder.

QTCycle.java compiles successfuly but when i try to compile JM550b.java i get an error saying "cannot access QTCycle" on the line "private static QTCycle player;"

It also says

"cannot access QTCycle
bad class file: C:\Documents and Settings\Rachael\Desktop\Dom\Tutorial\jmqt\QTCycle .class
class file contains wrong class: jmqt.QTCycle
Please remove or make sure it appears in the correct subdirectory of the classpath.
private static QTCycle player;"

My directory is like this: (im sure this is where the problems arise please help me im struggling with this!)
Desktop\Dom\Tutorial\src - this is where the main .java files of my project are kept as there a few classes the main program will access.
Desktop\Dom\Tutorial\jmqt - this is where the QTCycle class goes when it is compiled

Im not sure what more i need to say but if anyone can help i will be glad to give all info i can.

Please help!

推荐答案

您的第一个错误是由尝试从其他类访问私有字段引起的。这是不允许的。
Your first error is caused by trying to access a private field from nother class. That''s not allowed.



您的第一个错误是由尝试从其他类访问私有字段引起的。这是不允许的。
Your first error is caused by trying to access a private field from nother class. That''s not allowed.



但是我有其他类似的行,例如私人静态按钮开始,停止;

和私有静态EightBeat1拍;"


这两个工作正常。


感谢您的回复:)

But i have other lines similar such as "private static Button start, stop;"
and "private static EightBeat1 pat;"

These two work fine.

Thank you for reply :)


I现在看,我不明白你的初始陈述,对不起。

它应该是一个目录结构问题。您的jmqt文件夹必须位于src文件夹中。
I see now that I did not understand your initial statements, sorry.
It should be a directory structure problem. Your jmqt folder must be in the src folder.


这篇关于classpath错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆