• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't compile 2 classes in different folders, page 15 (Java OCA 8 Programmer I Study Guide, Sybex)

 
Gaetan Ve
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Im trying to get my OCA 8 but with this one exercise i keep on getting an error that i dont understand.

I made the 2 classes in 2 different folders like the book says




Then I used the cmd line javac "packagea.ClassA.java packageb.ClassB.java" and then i receive the error File not found.
So I thought it might be wise to compile them individually to see if they work, well A compiled without a problem but B didnt.
I got this error when trying to compile B:



I still dont get what i'm doing wrong, i've retyped it multiple times but am still getting this error.
What am I missing?
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gaetan Ve wrote:I still dont get what i'm doing wrong, i've retyped it multiple times but am still getting this error.
What am I missing?

Sounds like you are experiencing a class path issue. This topic provides an excellent explanation about how to compile Java source code files in different folders using a similar example. I'm pretty sure after carefully reading this topic all your doubts (concerning this topic) will be cleared. If you still have doubts/questions after reading this topic, simply click on the "Post reply" button and let us know

Hope it helps!
Kind regards,
Roel
 
Gaetan Ve
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
Gaetan Ve wrote:I still dont get what i'm doing wrong, i've retyped it multiple times but am still getting this error.
What am I missing?

Sounds like you are experiencing a class path issue. This topic provides an excellent explanation about how to compile Java source code files in different folders using a similar example. I'm pretty sure after carefully reading this topic all your doubts (concerning this topic) will be cleared. If you still have doubts/questions after reading this topic, simply click on the "Post reply" button and let us know

Hope it helps!
Kind regards,
Roel


Thanks this helped! Still dont understand why the book gives you the instruction to when this seems incorrect.
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gaetan Ve wrote:Still dont understand why the book gives you the instruction to when this seems incorrect.

I have just tried following the given instructions and it works flawlessly! So the instructions in the study guide are spot-on. Probably you have missed something important.

Please follow this step-by-step guide very carefully:
  • create the directory C:\temp
  • create in this directory two subdirectories packagea and packageb
  • create in the subdirectory packagea a file ClassA.java
  • create in the subdirectory packageb a file ClassB.java
  • add the corresponding code snippets mentioned on page 14 of the study guide to respectively file ClassA.java and file ClassB.java
  • open a command prompt window
  • type the command cd C:\temp and press the <Enter> key
  • type the command javac packagea/ClassA.java packageb/ClassB.java and press the <Enter> key again
  • the two .class files are created successfully

  • If you are still experiencing any issues, please provide a step-by-step overview of everything you have done.

    Hope it helps!
    Kind regards,
    Roel
     
    Jeanne Boyarsky
    author & internet detective
    Marshal
    Posts: 35279
    384
    Eclipse IDE Java VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The good news is that classpaths aren't on the exam! (Granted that doesn't help with practice, but at least you don't have to memorize how it works)
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic