Solved

ERROR : CLASS NOT FOUND IN PACKAGE.

Posted on 2000-05-09
4
156 Views
Last Modified: 2013-11-23

Hi,

Have installed JDK1.2.2 on NT. The CLASSPATH was set in NT as
jdk1.2.2\jre\lib\rt.jar

Have two java source files as under :

f:\java-programs\applications\orion\src\abc
\NetworkSender.java

and

f:\java-programs\applications\orion\src\abc
\NetworkSenderTest.java

Both contain the statemement : package abc; at the very top.

Had compiled the NetworkSender.java in :

f:\java-programs\applications\orion
\Classes\abc

However when I tried to compile NetworkSenderTest.java from

f:\java-programs\applications\orion
\src\abc>  

specifying the path for NetworkSender.class as follows,

javac -classpath .\..\..\classes\abc
-d .\..\..\classes\abc NetworkSendTest.java

I got the error :

Cannot find class file : abc.NetworkSender.class

(PLEASE NOTE THAT THE SOURCE FILE NAMES MATCH THE CLASS NAMES)

PLEASE HELP.
0
Comment
Question by:x666xchange
  • 2
4 Comments
 

Accepted Solution

by:
prl earned 30 total points
Comment Utility
When you compile a class in a package, you should specifiy package directory

javac -d . NetworkSender.java

and NetworkSender.java contains

package abc;
class NetworkSender {
  ...
}

You will get a directory 'abc' and class file will be placed there.

Now if you wanna run it, do

java abc.NetworkSender
0
 

Expert Comment

by:kk_manish
Comment Utility
Hi,
Other option is
U can complie all java files in package collectively as

...\src\abc> javac *.java  
 OR if u
wanna class files to be in differant
directory u can do so as suggested by prl.


0
 

Author Comment

by:x666xchange
Comment Utility
Answer accepted
0
 

Author Comment

by:x666xchange
Comment Utility

PLEASE DELETE THIS POSTING
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now