This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Not working with 1.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Not working with 1.5" Watch "Not working with 1.5" New topic
Author

Not working with 1.5

Vani Chinta
Ranch Hand

Joined: Mar 25, 2007
Posts: 38
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.


SCJP 1.4
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
You shouldn't have to change anything to make it work in 1.5.

What is the error?
Vani Chinta
Ranch Hand

Joined: Mar 25, 2007
Posts: 38
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

Joined: Feb 15, 2007
Posts: 557
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.


Thanks & Regards, T.Srinivasan
SCWCD 1.4(89%), SCJP 5.0(75%)
Vani Chinta
Ranch Hand

Joined: Mar 25, 2007
Posts: 38
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.
 
 
subject: Not working with 1.5
 
Similar Threads
Using pageContext in EL
EL - [ ] and .
El property not found problem
Compiling java file
can't able to compile javabean file