Solved

ERROR : CLASS NOT FOUND IN PACKAGE.

Posted on 2000-05-09
4
164 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Configure a Bean in an XML file 4 49
Error in @AspectJ Based AOP with Spring 2 24
passing enum to a method 4 35
Coding for the first time 9 70
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

726 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