my dog learned polymorphism*
The moose likes Beginning Java and the fly likes cannot find symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cannot find symbol" Watch "cannot find symbol" New topic
Author

cannot find symbol

Tontang Bei
Ranch Hand

Joined: Oct 21, 2006
Posts: 130
I have 2 classes both in same package (util.DateParse and util.Testit). I try calling a static method of the class DateParse from class Testit class, and it says:

Testit.java:9: cannot find symbol
symbol : variable DateParse
location: class util.Testit
Date d1=DateParse.parseIt(input);
^
1 error

below are the codes for the class

Class DateParse


Class Testit
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Make sure that your CLASSPATH is properly set. If you're compiling in the util directory, you can try "javac -cp . *.java"

public static Date ParseIt(String dateTobeParsed){

You'd better give method names starting with lower-case.


[My Blog]
All roads lead to JavaRanch
Tontang Bei
Ranch Hand

Joined: Oct 21, 2006
Posts: 130
Thnaks very much Satou. I have fixed the method names and gotten it to compile but when I run it it gives the following exception

C:\jf\util>java Testit
Exception in thread "main" java.lang.NoClassDefFoundError: Testit (wrong name: util/Testit)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

below is the method test() in Testit class


Ive even tried running with java -classpath . Testit and it still doesnt work.
[ May 07, 2007: Message edited by: Tontang Bei ]
Tontang Bei
Ranch Hand

Joined: Oct 21, 2006
Posts: 130
Ok I got it. I was running from within current package which was mistake.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot find symbol
 
Similar Threads
System Date
SimpledateFormat class issue.
Any Alternative for this CODE !!!!!!
please help me ...
Calendar class - starts with month 0?