Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Not working with 1.5

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic