This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hello friends!! I am trying to compile these codes which belong to same package. The first code compiles allright but the second one gives me errors. Both of them belong to same package. **********Item.java file****************
I get the folloing errors when i compile the ShoppingCart.java C:\Tomcat\jakarta\webapps\myJSPApp\WEB-INF\classes\ShoppingCart.java:5: cannot resolve symbol symbol : class Item location: class jspin24hrs.hour16.ShoppingCart public void addItem(Item i){items.addElement(i);} ^ C:\Tomcat\jakarta\webapps\myJSPApp\WEB-INF\classes\ShoppingCart.java:9: cannot resolve symbol symbol : class Item location: class jspin24hrs.hour16.ShoppingCart Item item = (Item)itemEnum.nextElement(); ^ C:\Tomcat\jakarta\webapps\myJSPApp\WEB-INF\classes\ShoppingCart.java:9: cannot resolve symbol symbol : class Item location: class jspin24hrs.hour16.ShoppingCart Item item = (Item)itemEnum.nextElement(); ^ C:\Tomcat\jakarta\webapps\myJSPApp\WEB-INF\classes\ShoppingCart.java:20: cannot resolve symbol symbol : class Item location: class jspin24hrs.hour16.ShoppingCart Item item = (Item)itemEnum.nextElement(); ^ C:\Tomcat\jakarta\webapps\myJSPApp\WEB-INF\classes\ShoppingCart.java:20: cannot resolve symbol symbol : class Item location: class jspin24hrs.hour16.ShoppingCart Item item = (Item)itemEnum.nextElement(); ^ 5 errors Tool completed with exit code 1
PLEASE LET ME KNOW WHERE I AM MAKING THE MISTAKE THANKS, (edited by Cindy to format code) [ August 13, 2002: Message edited by: Cindy Glass ]
Anil Jain<br />Sun Certified Java(2) Programmer
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
posted
0
Look in directory /jspin24hrs/hour16 and see if the Item.class file really IS THERE.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Kevin Li
Greenhorn
Joined: Sep 25, 2001
Posts: 21
posted
0
You could try again as followed: 1.set classpath=.;%classpath% 2.come in directory "C:\Tomcat\jakarta\webapps\myJSPApp\WEB-INF\classes\" 3.execute compile command, java -d . *.java
Robert Paris
Ranch Hand
Joined: Jul 28, 2002
Posts: 585
posted
0
My guess is it's the class path. Notice a few things. One is both classes are in a package, but from your error code, it looks as though you did NOT putthem in that package folder structure. So you need to do this: 1. put the files in: ${curr_folder}/jspin24hrs/hour16/Item.java ${curr_folder}/jspin24hrs/hour16/ShoppingCart.java 2. Stay in the current Folder and do: javac -classpath . jspin24hrs/hour16/ShoppingCart.java Since it uses Item.java, that will compile both files (do not copy the recently compiled Item.class file into the folder).
Biju Philip
Greenhorn
Joined: Nov 03, 2001
Posts: 7
posted
0
As another suggestion (though it does not directly relate to your issue), try using the Jikes compiler. The error messages are a bit more clear.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: What's wrong with this code?? please help