• 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

javac : Compiling a .JAVA file which uses other classes in it

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI i have 3 java files

I managed to generate .class files for both a and b using

but when i do the same for c.java I get the error
error: cannot find symbol b and c
Any suggestions on how i could solve this problem ?
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note a.java , b.java and c.java are in the same folder
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the output that i get
C:\jibx\tutorial\example24\example>dir
Volume in drive C is WINDOWS
Volume Serial Number is 1C8F-663E

Directory of C:\jibx\tutorial\example24\example

05/06/2012 06:16 PM <DIR> .
05/06/2012 06:16 PM <DIR> ..
05/06/2012 06:16 PM 1,122 Address.class
05/06/2012 04:04 PM 3,445 Address.java
05/06/2012 06:16 PM 748 Customer.class
05/06/2012 04:04 PM 1,761 Customer.java
05/06/2012 06:16 PM 757 Item.class
05/06/2012 04:04 PM 1,876 Item.java
05/06/2012 04:54 PM 4,872 Order.java
05/06/2012 06:16 PM 1,022 Shipping.class
05/06/2012 04:04 PM 877 Shipping.java
10 File(s) 18,590 bytes
2 Dir(s) 160,025,100,288 bytes free

C:\jibx\tutorial\example24\example>C:\"Program Files"\Java\jdk1.7.0\bin\javac Order.java
Order.java:33: error: cannot find symbol
private Customer customer;
^
symbol: class Customer
location: class Order
Order.java:34: error: cannot find symbol
private Address billTo;
^
symbol: class Address
location: class Order
Order.java:35: error: cannot find symbol
private Shipping shipping;
^
symbol: class Shipping
location: class Order
Order.java:36: error: cannot find symbol
private Address shipTo;
^
symbol: class Address
location: class Order
Order.java:37: error: cannot find symbol
private List<Item> itemList = new ArrayList<Item>();
^
symbol: class Item
location: class Order
Order.java:65: error: cannot find symbol
public Customer getCustomer() {
^
symbol: class Customer
location: class Order
Order.java:74: error: cannot find symbol
public void setCustomer(Customer customer) {
^
symbol: class Customer
location: class Order
Order.java:83: error: cannot find symbol
public Address getBillTo() {
^
symbol: class Address
location: class Order
Order.java:92: error: cannot find symbol
public void setBillTo(Address billTo) {
^
symbol: class Address
location: class Order
Order.java:101: error: cannot find symbol
public Shipping getShipping() {
^
symbol: class Shipping
location: class Order
Order.java:110: error: cannot find symbol
public void setShipping(Shipping shipping) {
^
symbol: class Shipping
location: class Order
Order.java:119: error: cannot find symbol
public Address getShipTo() {
^
symbol: class Address
location: class Order
Order.java:128: error: cannot find symbol
public void setShipTo(Address shipTo) {
^
symbol: class Address
location: class Order
Order.java:137: error: cannot find symbol
public List<Item> getItemList() {
^
symbol: class Item
location: class Order
Order.java:146: error: cannot find symbol
public void setItemList(List<Item> list) {
^
symbol: class Item
location: class Order
Order.java:37: error: cannot find symbol
private List<Item> itemList = new ArrayList<Item>();
^
symbol: class Item
location: class Order
16 errors

C:\jibx\tutorial\example24\example>
 
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As you can see the compiler can't find the classes that you have in your code. Have you created separate classes for the (missing) Objects that you have in Order class?
reply
    Bookmark Topic Watch Topic
  • New Topic