Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

package and import doubt

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
adam Lui
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there any system settings or classpath invocation on the command has to be specified to run this code?
 
Kinnaree Patel
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic