Results 1 to 9 of 9
Thread: compile problem
- 11-13-2008, 04:43 PM #1
Member
- Join Date
- Nov 2008
- Posts
- 7
- Rep Power
- 0
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.
- 11-13-2008, 04:45 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Can you copy-paste full error message you get? Seems this is not related with the class path, something wrong with your code.
- 11-13-2008, 05:21 PM #3
Member
- Join Date
- Nov 2008
- Posts
- 7
- Rep Power
- 0
" 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
-
you need to import java.awt.Point; not java.awt.point;
Capitalization matters.
- 11-13-2008, 05:56 PM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
What the best practice is, if you don't know what the correct class is import the complete package.
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.Java Code:import java.awt.*;
- 11-13-2008, 05:59 PM #6
Member
- Join Date
- Nov 2008
- Posts
- 7
- Rep Power
- 0
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
- 11-13-2008, 06:06 PM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Did you set the class path correctly? Are you working on the command prompt?
- 11-13-2008, 06:18 PM #8
Member
- Join Date
- Nov 2008
- Posts
- 7
- Rep Power
- 0
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
- 11-13-2008, 06:20 PM #9
Member
- Join Date
- Nov 2008
- Posts
- 7
- Rep Power
- 0
Similar Threads
-
doesn't compile?!
By jon80 in forum New To JavaReplies: 8Last Post: 06-14-2008, 05:42 PM -
Compile Issue
By CrazyShells Slam in forum New To JavaReplies: 4Last Post: 05-14-2008, 08:51 PM -
Not able to compile
By bugger in forum New To JavaReplies: 2Last Post: 01-09-2008, 10:13 PM -
simple problem - code wont compile
By dirtycash in forum New To JavaReplies: 1Last Post: 11-20-2007, 05:49 PM -
problem when I try to compile a program from command prompt
By osval in forum Advanced JavaReplies: 2Last Post: 08-06-2007, 09:16 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks