Hello.

  First, you have to keep somthing in mind : when working in your IDE,
and declare classes and packages, they are stored in your workspace
(the folder in which you choose as your "root" folder to store
projects : I'll call it your_workspace).

  Then, when you declare a new package, it creates a new "namespace"
for relatives files, and will store them in the folder your_workspace/
your_package_name/ (assuming that you're working in linux. if not,
replace / by \ in the folder's path).
  Thus, if you create a new class as Food.class or FoodMain.class (by
creating and compiling Food.java and FoodMain.java) in your package
(by declaring the "package" statement in their declaration), you have
to look them in the folder your_workspace/your_package_name.

  Now, looking for your problem, it seems that you haven't declared
any "package" statement in the FoodMain.java. But when compiling in
command line, you used the command "c:\foodpackage\fruitpackage>javac
Food.java FoodMain.java" which indicates that you are in the folder
relative to "fruitpackage" package  : FoodMain.java is not here, you
have to look it in the folder c:\foodpackage, or in the folder
your_workspace.
  For compiling, try this command : c:\foodpackage>FoodMain.java from
within "c:\foodpackage" folder, or "c:\foodpackage\fruitpackage>javac
Food.java ..\FoodMain.java" from within "c:\foodpackage\fruitpackage"
folder.

  @+


On 28 fév, 11:10, Rafał Laczek <[email protected]> wrote:
> Hello Friends,
>
> I have a problem to create file FoodMain.class
> I used all suitable proposed in lesson commands. For example using
> following one:
> c:\foodpackage\fruitpackage>javac Food.java FoodMain.java
> system created Food.class in fruitpackage but regarding FoodMain I
> receive communicate:
> FoodMain.java: cannot find
> symbol: class Food
> location: class fruitpackage.FoodMain
> Food appleFood = new Food();  //this is one of the objects.
>
> The tops of classes in java files are following:
> package fruitpackage;
> public class FoodMain
>
> package foodpackage.fruitpackage;
> public class Food
>
> The cod of classes is OK because project works in IDE.
>
> I enclose print-screen.
>
> I am a beginner in Java.
>
> Thank you very much for your help!
>
> Best regards,
> Rafał
>
> ----------------------------------------------------
> ATRAKCYJNE NIERUCHOMOŚCI W ZAKOPANEM !!!
> Apartamenty, Domy, Działki, Pensjonaty, Hotele, Lokale użytkowe...
> Kliknij:http://klik.wp.pl/?adr=www.nieruchomosciwzakopanem.pl&sid=652
>
>  lab1003.doc
> 39KAfficherTélécharger

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to