Results 1 to 9 of 9

Thread: compile problem

  1. #1
    chrisbremen is offline Member
    Join Date
    Nov 2008
    Posts
    7
    Rep Power
    0

    Default compile problem

    im having an issue with compiling a practice code.

    Im importing from swing and i have set my path to the right directory but when i try to compile it gives me:
    cannot find symbol

    my computer didnt have a classpath so i created one and put the location in there but it still didnt work.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Can you copy-paste full error message you get? Seems this is not related with the class path, something wrong with your code.

  3. #3
    chrisbremen is offline Member
    Join Date
    Nov 2008
    Posts
    7
    Rep Power
    0

    Default

    " RefTester.java:1: cannot find symbol
    symbol : class point
    location: package java.awt
    import java.awt.point;

    RefTester.java:5: cannot find symbol
    symbol: class Point
    location: class RefTester
    Point pt1, pt2;

    RefTester.java:6: cannot find symbol
    symbol: class Point
    location: class RefTester
    pt1 = new Point(100, 100);"


    There is the error

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    you need to import java.awt.Point; not java.awt.point;

    Capitalization matters.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    What the best practice is, if you don't know what the correct class is import the complete package.

    Java Code:
    import java.awt.*;
    Actually most of new Java IDEs can identify those capitalization errors. But my opinion is don't stick on that. Just try to overcome such things based on the error message you get.

  6. #6
    chrisbremen is offline Member
    Join Date
    Nov 2008
    Posts
    7
    Rep Power
    0

    Default

    ok thanks that worked it compile ok but now im having a problem with running it

    it gives me the following:
    "Exception in thread "main" java.lang.NoClassDefFoundError: RefTester

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  8. #8
    chrisbremen is offline Member
    Join Date
    Nov 2008
    Posts
    7
    Rep Power
    0

    Default

    yes i am using command prompt and i had the path set correctly because i compiled and ran another one earlier and it was fine.

    but i just went back to run that one again and it is giving me the same error so maybe the path did get messed up some how

  9. #9
    chrisbremen is offline Member
    Join Date
    Nov 2008
    Posts
    7
    Rep Power
    0

    Default

    right now my path is set to C:\program files\java\jdk1.6_07\bin

    my computer doesnt have a classpath only a Path

Similar Threads

  1. doesn't compile?!
    By jon80 in forum New To Java
    Replies: 8
    Last Post: 06-14-2008, 05:42 PM
  2. Compile Issue
    By CrazyShells Slam in forum New To Java
    Replies: 4
    Last Post: 05-14-2008, 08:51 PM
  3. Not able to compile
    By bugger in forum New To Java
    Replies: 2
    Last Post: 01-09-2008, 10:13 PM
  4. simple problem - code wont compile
    By dirtycash in forum New To Java
    Replies: 1
    Last Post: 11-20-2007, 05:49 PM
  5. Replies: 2
    Last Post: 08-06-2007, 09:16 PM

Posting Permissions

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