• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • 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>
 
Panagiotis Kalogeropoulos
Rancher
Posts: 99
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!