wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes javac generating Wierd error during compilation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "javac generating Wierd error during compilation" Watch "javac generating Wierd error during compilation" New topic
Author

javac generating Wierd error during compilation

Suvojit Chakraborty
Ranch Hand

Joined: Nov 10, 2009
Posts: 62
    
    1
Hello friends

I am reading Kathy Sierra and I wish to give SCJP exam.
Today when I tried to test the concept of protected V/S Default access modifier I got struck with a problem.

Below is the code:


If I try to compile it I get following error:

C:\Program Files\Java\jdk1.5.0_06\bin>javac ProtTestChild.java error: cannot read: ProtTestChild.java 1 error C:\Program Files\Java\jdk1.5.0_06\bin>


Can anyone tell me what could be the problem??


Thanks
BR
Suvojit
Neha Daga
Ranch Hand

Joined: Oct 30, 2009
Posts: 504
read this. may be this can help you.


SCJP 1.6 96%
Nidhi Sar
Ranch Hand

Joined: Oct 19, 2009
Posts: 252

Suvojit,

Your code is fine. The compilation error seems to suggest that either the file protTestChild.java is deleted/renamed before running javac or else it is hidden/not readable.

Have you checked the location and "file attributes" of the file?

HTH,
Nidhi


"A problem well stated is a problem half solved.” - Charles F. Kettering
SCJP 6, OCPJWCD
Suvojit Chakraborty
Ranch Hand

Joined: Nov 10, 2009
Posts: 62
    
    1
Neha Daga wrote:read this. may be this can help you.


Thanks a lot for your quick reply.
I got the solution from some other forum. I needed to execute the command as C:\Program Files\Java\jdk1.5.0_06\bin>javac xyz/ProtTestChild.java

But I thank you Neha, the link you gave proved to be something which I have been searching for a long time.I was in a habit of saving my programs in bin directory although I knew its not a good practice but since I was not clear with the classpaths and environment variable so I had to do it against my will.

It would be a great help if you can tell me more about classpaths and environment variable or may be give some other usefull links to study.

Thank you Nidhi for your help.

Thanks a lot
BR
Suvojit
Neha Daga
Ranch Hand

Joined: Oct 30, 2009
Posts: 504
http://www.ibm.com/developerworks/library/j-classpath-unix/

if you want the same article is for windows : http://www.ibm.com/developerworks/library/j-classpath-windows/
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41035
    
  43
Word of advice: Don't keep any of your source and class files inside of the JDK's bin directory (or anywhere else in the JDK directory, for that matter). It's bound to create problems.


Ping & DNS - my free Android networking tools app
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

Ulf Dittmer wrote:Word of advice: Don't keep any of your source and class files inside of the JDK's bin directory (or anywhere else in the JDK directory, for that matter). It's bound to create problems.


yup... correct!


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

About the names of your classes: Using the names "Parent" and "Child" for superclasses and subclasses is really wrong; inheritance in OO programming is not the same as biological inheritance. Confusing the OO programming concept of inheritance with the biological meaning of the word will make it harder for you to understand what "inheritance" means with regard to programming.

See here for more about this.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: javac generating Wierd error during compilation
 
Similar Threads
package does not exist error
Noclass Exception
Getting Started
java on command
TIJ bruceeckel.simpletest question