Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not working with 1.5

 
Vani Chinta
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have worked on jdk 1.4 but now using 1.5 for certification purpose. Here is one sample example that is working on 1.4 but giving compilation error in 1.5.
Person.java


Dog.java

Toy.java


Can some one let me know what else should I change to make it work with jdk1.5

Classpath is set as following.
set classpath="C:\jdk1.5.0_11\bin;C:\jdk1.5.0_11\com\example\web;C:\jdk1.5.0_11\bin\com\example\model;


Thanks.
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't have to change anything to make it work in 1.5.

What is the error?
 
Vani Chinta
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get compilation error when I compile Dog class. Toy is compiling properly. but Dog and Person are not.

Here is the error that is displayed for Dog class.
"Dog.java:12: cannot resolve symbol
symbol : class Toy
location: class com.example.model.Dog
private Toy[] toys;
^
Dog.java:23: cannot resolve symbol
symbol : class Toy
location: class com.example.model.Dog
public void setToys(Toy[] toys){
^
Dog.java:27: cannot resolve symbol
symbol : class Toy
location: class com.example.model.Dog
3 errors."

Here is the error for Person class.
"Person.java:6: cannot resolve symbol
symbol : class Dog
location: class com.example.model.Person
private Dog dog;
^
Person.java:18: cannot resolve symbol
symbol : class Dog
location: class com.example.model.Person
public void setDog(Dog dog){
^
Person.java:22: cannot resolve symbol
symbol : class Dog
location: class com.example.model.Person
public Dog getDog(){
^
3 errors"

I see Toy.class in com/example/model folder. Not sure why is this not recognized.

Appreicate help in solving this problem,
Thanks
 
Srinivasan thoyyeti
Ranch Hand
Posts: 557
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vani Chinta,

You need to know
1) what is classpath, how to set.
2) How to compile and run run a program which is contained in some package(other than default).

Please refer to 10th chapter in K&B book.
 
Vani Chinta
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Figured out the problem. Thanks for pointing out that it is a classpath problem. I specified classpath in double quotes (set classpath="xxx") like I mentioned in my first post. That was causing the problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic