Find the answer to your Linux question:
Results 1 to 3 of 3
HI All I am trying to learn a bit of java over the coming festive period and have been going through the tutorial at http://java.sun.com/docs/books/tutor...O/objects.html but have hit a problem ...
  1. #1
    Just Joined!
    Join Date
    Dec 2006
    Posts
    2

    Question Configuring Java

    HI All

    I am trying to learn a bit of java over the coming festive period and have been going through the tutorial at http://java.sun.com/docs/books/tutor...O/objects.html but have hit a problem which looks like something is wrong with my $CLASSPATH.

    I originally set it to '.' so i could compile very simple Hello World type programs while i was in the same directory e.g.
    cd /home/sar/Java/
    javac ./HelloWorld.java
    java HelloWorld
    but now i am trying to compile the 'CreateObjectsDemo' at the above link and getting the following output from javac
    cd /home/sar/Java/
    javac ./CreateObjectDemo.java
    ./CreateObjectDemo.java:7: cannot find symbol
    symbol : class Point
    location: class CreateObjectDemo
    Point originOne = new Point(23, 94);
    ^
    ./CreateObjectDemo.java:7: cannot find symbol
    symbol : class Point
    location: class CreateObjectDemo
    Point originOne = new Point(23, 94);
    ^
    ./CreateObjectDemo.java:8: cannot find symbol
    symbol : class Rectangle
    location: class CreateObjectDemo
    Rectangle rectOne = new Rectangle(originOne, 100, 200);
    ^
    ./CreateObjectDemo.java:8: cannot find symbol
    symbol : class Rectangle
    location: class CreateObjectDemo
    Rectangle rectOne = new Rectangle(originOne, 100, 200);
    ^
    ./CreateObjectDemo.java:9: cannot find symbol
    symbol : class Rectangle
    location: class CreateObjectDemo
    Rectangle rectTwo = new Rectangle(50, 100);
    ^
    ./CreateObjectDemo.java:9: cannot find symbol
    symbol : class Rectangle
    location: class CreateObjectDemo
    Rectangle rectTwo = new Rectangle(50, 100);
    ^
    6 errors
    Please can some one help. I am sure its just me not setting th classpath right. Not sure if this helps but i'm running suse10.2 and Java 1.5 and my CLASSPATH is .

    Thanks#Spence

  2. #2
    Just Joined! conradt's Avatar
    Join Date
    Dec 2006
    Posts
    5
    You need to store the Point.java and Rectangle.java in the same directory like the class you wrote above (CreateObjectDemo.java). Point/Rectangle are no classes of the JDK itself, but of your tutorial application.

    http://java.sun.com/docs/books/tutor...les/Point.java
    http://java.sun.com/docs/books/tutor...Rectangle.java

    Do you have these classes there as well?

  3. #3
    Just Joined!
    Join Date
    Dec 2006
    Posts
    2

    Red face I did say i was learning !!!!

    Hi

    Thanks for the reply. Yep i realized yesterday so i compiled the other files and hay presto the thing actually works.

    Spence

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...