Solved

ERROR : CLASS NOT FOUND IN PACKAGE.

Posted on 2000-05-09
4
159 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
ID: 2793582
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
ID: 2889959
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
ID: 2898356
Answer accepted
0
 

Author Comment

by:x666xchange
ID: 5958110

PLEASE DELETE THIS POSTING
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.

911 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

20 Experts available now in Live!

Get 1:1 Help Now