File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes package and import doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "package and import doubt" Watch "package and import doubt" New topic
Author

package and import doubt

adam Lui
Ranch Hand

Joined: Sep 03, 2007
Posts: 186
i got the class files in the same directory course:
a.java


Student

the compiler complaints on a.java about not being able to find Student.
i really dont have a clue why..
pls help!

(even i put course.Student instead of Student in declaration)
Kinnaree Patel
Ranch Hand

Joined: Oct 30, 2007
Posts: 33
I tried running the code you have wrote and this code is working fine on my machine. It displays the result 20 as expected.
[ November 14, 2007: Message edited by: Kinnaree Patel ]

95% people read history, 5% create it... On The Way To 5%...
SCJP 5.0 -> 88%, SCWCD -> 86%, Next -> SCBCD and SCDJWS
adam Lui
Ranch Hand

Joined: Sep 03, 2007
Posts: 186
is there any system settings or classpath invocation on the command has to be specified to run this code?
Kinnaree Patel
Ranch Hand

Joined: Oct 30, 2007
Posts: 33
Originally posted by adam Lui:
is there any system settings or classpath invocation on the command has to be specified to run this code?


No.. I didn't do anything extra to run the program except for setting the classpath for jdk... I just gave the normal commands as we do to compile and run any java file in general.

javac -d . Student.java and javac -d . a.java
and to run java course.a

Thats all. No extra commands.

P.S I put "-d ." because my java files were not in course directory.
[ November 14, 2007: Message edited by: Kinnaree Patel ]
satabdi das
Greenhorn

Joined: Jul 17, 2007
Posts: 28
Hi,


there are no problem with your program. It's an issue with your classpath setting. I have created a directoty under Practice. So I executed the program like this.

java -classpath /Practice/ course.Student

it worked. You need to set your classpath option accordingly.

Hope I helped.

Regards,
Satabdi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: package and import doubt