Cannot find symbol
I have two .java files under the same directory. I intend to keep them under the package UnitTesting.SWIFTParser which is actually my directory structure also.
I can successfully compile SWIFTParserTest.java.
In SWIFTParserTestSuite.java I have
import UnitTesting.SWIFTParser.SWIFTParserTest;
When I try to compile SWIFTParserTestSuite.java I get the following error:-
SWIFTParserTestSuite.java:7: cannot find symbol
symbol : class SWIFTParserTest
location: package UnitTesting.SWIFTParser
import UnitTesting.SWIFTParser.SWIFTParserTest;
^
SWIFTParserTestSuite.java:16: cannot find symbol
symbol : class SWIFTParserTest
location: class UnitTesting.SWIFTParser.SWIFTParserTestSuite
suite.addTestSuite(SWIFTParserTest.class);
This is added in my classpath also
setenv CLASSPATH /home/santsat/dev/Magellan/Development/8/8.01/JIRA-1788394-SWIFTParsing/UnitTesting/SWIFTParser/:${CLASSPATH}
Any pointers why would I be getting this error?
Thanks
Message was edited by:
chabhi
[1094 byte] By [
chabhia] at [2007-11-27 2:07:32]

Similar problem found in another thread of yours
http://forum.java.sun.com/thread.jspa?threadID=5164389&messageID=9628218#9628218
/home/santsat/dev/Magellan/Development/8/8.01/JIRA-1788394-SWIFTParsing/UnitTesting/SWIFTParser/:${CLASSPATH}
to
/home/santsat/dev/Magellan/Development/8/8.01/JIRA-1788394-SWIFTParsing/:${CLASSPATH}
the classpath should set to the package location, not the class file location.
by the way, you use JIRA for work? in london office ?
thank you very much for your assistance. That compiled fine after I changed the classpath accordingly.
But when I do java SWIFTParserTestSuite in my current directory I
get
Exception in thread "main" java.lang.NoClassDefFoundError: SWIFTParserTestSuite (wrong name: UnitTesting/SWIFTParser/SWIFTParserTestSuite)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
BTW we do use JIRA.
You should cd to the following directory
/home/santsat/dev/Magellan/Development/8/8.01/JIRA-1788394-SWIFTParsing/
and type the following command
java UnitTesting.SWIFTParser.SWIFTParserTestSuite
If this is not working, check if your SWIFTParserTestSuite has a static main method.
I am just wondering if lots of company using JIRA or may probably we are colleagues :)
> You should cd to the following directory
> /home/santsat/dev/Magellan/Development/8/8.01/JIRA-178
> 8394-SWIFTParsing/
> and type the following command
> java
> UnitTesting.SWIFTParser.SWIFTParserTestSuite
java -cp . UnitTesting.SWIFTParser.SWIFTParserTestSuite