[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ERROR : CLASS NOT FOUND IN PACKAGE.

Posted on 2000-05-09
4
Medium Priority
?
177 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month18 days, 9 hours left to enroll

826 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