?
Solved

ERROR : CLASS NOT FOUND IN PACKAGE.

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

771 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