473,378 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

classpath error

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!
Jul 18 '08 #1
10 2107
r035198x
13,262 8TB
Your first error is caused by trying to access a private field from nother class. That's not allowed.
Jul 18 '08 #2
Your first error is caused by trying to access a private field from nother class. That's not allowed.
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 :)
Jul 18 '08 #3
r035198x
13,262 8TB
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.
Jul 18 '08 #4
JosAH
11,448 Expert 8TB
This is where your class is stored:

Settings\Rachael\Desktop\Dom\Tutorial\jmqt\QTCycle .class

The class seems to be in the package 'jmqt', can you show us the classpath
you used?

kind regards,

Jos
Jul 18 '08 #5
This is where your class is stored:

Settings\Rachael\Desktop\Dom\Tutorial\jmqt\QTCycle .class

The class seems to be in the package 'jmqt', can you show us the classpath
you used?

kind regards,

Jos
by classpath do you mean under project settings? im using jcreator

would this seem right?

C:\Documents and Settings\Rachael\Desktop\Dom\Tutorial;C:\jmusic\jm usic.jar;C:\WINDOWS\system32\QTJava.zip;C:\Documen ts and Settings\Rachael\Desktop\Dom\Tutorial\jmqt;C:\Docu ments and Settings\Rachael\Desktop\Dom\Tutorial\QTCycle;C:\P rogram Files\Java\jdk1.6.0_06\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_06\lib\dt.jar;C:\Program Files\Java\jdk1.6.0_06\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_06\jre\lib\ext\dnsns.jar;C:\Pr ogram Files\Java\jdk1.6.0_06\jre\lib\ext\localedata.jar; C:\Program Files\Java\jdk1.6.0_06\jre\lib\ext\sunjce_provider .jar;C:\Program Files\Java\jdk1.6.0_06\jre\lib\ext\sunmscapi.jar;C :\Program Files\Java\jdk1.6.0_06\jre\lib\ext\sunpkcs11.jar
Jul 18 '08 #6
JosAH
11,448 Expert 8TB
by classpath do you mean under project settings? im using jcreator

would this seem right?

C:\Documents and Settings\Rachael\Desktop\Dom\Tutorial;C:\jmusic\jm usic.jar;C:\WINDOWS\system32\QTJava.zip;C:\Documents and Settings\Rachael\Desktop\Dom\Tutorial\jmqt;C:\Docu ments and Settings\Rachael\Desktop\Dom\Tutorial\QTCycle;C:\Program Files\Java\jdk1.6.0_06\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_06\lib\dt.jar;C:\Program Files\Java\jdk1.6.0_06\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_06\jre\lib\ext\dnsns.jar;C:\Pr ogram Files\Java\jdk1.6.0_06\jre\lib\ext\localedata.jar; C:\Program Files\Java\jdk1.6.0_06\jre\lib\ext\sunjce_provider .jar;C:\Program Files\Java\jdk1.6.0_06\jre\lib\ext\sunmscapi.jar;C :\Program Files\Java\jdk1.6.0_06\jre\lib\ext\sunpkcs11.jar
I boldfaced the suspicious classpath elements; there's more trash in there: those
paths leading to the private jre (that comes with the jdk) shouldn't be there,
neither anything in the jre's ext directories should be there. If I were you I'd clean
that mess up a bit, remove and recompile that class and try again.

kind regards,

Jos
Jul 18 '08 #7
I boldfaced the suspicious classpath elements; there's more trash in there: those
paths leading to the private jre (that comes with the jdk) shouldn't be there,
neither anything in the jre's ext directories should be there. If I were you I'd clean
that mess up a bit, remove and recompile that class and try again.

kind regards,

Jos
im sorry i misunderstood you, do you mean to remove the C:\Program Files\Java\jdk1.6.0_06\jre\lib\rt.jar; and any others under \jre ?
Jul 19 '08 #8
JosAH
11,448 Expert 8TB
im sorry i misunderstood you, do you mean to remove the C:\Program Files\Java\jdk1.6.0_06\jre\lib\rt.jar; and any others under \jre ?
The JDK comes with its own private JRE and on top of that it comes with a public
JRE. The first JRE is none of our business, i.e. it is used by the development
tools such as javac, jar etc. Have a look in your C:\Program Files\Java directory:
you'll find a JDK directory and a JRE directory; that JRE directory is the public
JRE; that private JRE is a subdirectory of the JDK directory. There is no need
to have a classpath component point to any JRE directory at all. Your classpath
however is full of it; get rid of them, they're useless.

kind regards,

Jos
Jul 19 '08 #9
The JDK comes with its own private JRE and on top of that it comes with a public
JRE. The first JRE is none of our business, i.e. it is used by the development
tools such as javac, jar etc. Have a look in your C:\Program Files\Java directory:
you'll find a JDK directory and a JRE directory; that JRE directory is the public
JRE; that private JRE is a subdirectory of the JDK directory. There is no need
to have a classpath component point to any JRE directory at all. Your classpath
however is full of it; get rid of them, they're useless.

kind regards,

Jos
Okay thank you very much for you help and sorry to bother you with what was probably a trivial question. I got so frustrated that i just removed QTCycle completely and have managed to function without it.

Thanks again!
Jul 19 '08 #10
JosAH
11,448 Expert 8TB
Okay thank you very much for you help and sorry to bother you with what was probably a trivial question. I got so frustrated that i just removed QTCycle completely and have managed to function without it.

Thanks again!
That's the old Roman way of curing someone: amputation. You have basically
'unsolved' your problem which basically was a classpath problem. Better clean
up that classpath list before you're going to use packages again because that
problem will surely rear its ugly head again in the near future.

kind regards,

Jos
Jul 19 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Abdelhalim MIMOUNI | last post by:
hi, i'm using the abstract class definition, and when compiling the abstract class it's ok, but the problem is when compiling the subclass: i get the following message: Rect.java:9: cannot...
2
by: Paul | last post by:
hi , i have started with "beginning JSP web development" and got stuck on extending classes. I'm getting the following error message: TechnicalBook.java:3: cannot resolve symbol symbol : class...
7
by: dlarsson | last post by:
Okay folks, I thought I was doing something very, very simple, but I cannot seem to get this to work at all. Can anyone identify what I am doing wrong here-? _________________________________ ...
9
by: KevinRobinson | last post by:
Hi, Can anyone please tell me how to add or change a Java classpath in SUSE Linux 9.3. I have set up a Tomcat server but my Java Classes will not run although they do on a windows box. ...
0
by: MIRRA | last post by:
Hi I have a UNIX script which creates a report. In that script I have to define the java classpath. Also I need to check if the java classpath specified exists or not. Below is the command i use ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.