• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
     
    author & internet detective
    Posts: 41878
    909
    Eclipse IDE VI Editor Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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)
     
    She's brilliant. She can see what can be and is not limited to what is. And she knows this tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic