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]
# 1

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 ?

rym82a at 2007-7-12 1:55:51 > top of Java-index,Java Essentials,New To Java...
# 2
It's the very same problem you had previously.
CeciNEstPasUnProgrammeura at 2007-7-12 1:55:52 > top of Java-index,Java Essentials,New To Java...
# 3

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.

chabhia at 2007-7-12 1:55:52 > top of Java-index,Java Essentials,New To Java...
# 4
Make sure that you have created the package correctly. Because your importing SWIFTParserTest.class. Which should present inside the package folder of your current directory.
Vencya at 2007-7-12 1:55:52 > top of Java-index,Java Essentials,New To Java...
# 5
no..it is a differnet issue...but obviously related to classpath as I understand....anyways thanks for chipping in and checking the issue.
chabhia at 2007-7-12 1:55:52 > top of Java-index,Java Essentials,New To Java...
# 6

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 :)

rym82a at 2007-7-12 1:55:52 > top of Java-index,Java Essentials,New To Java...
# 7

> 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

CeciNEstPasUnProgrammeura at 2007-7-12 1:55:52 > top of Java-index,Java Essentials,New To Java...
# 8
thanks a lot...it workedyou definitely made it easy for me....i am thankful to you for your time and solution....
chabhia at 2007-7-12 1:55:52 > top of Java-index,Java Essentials,New To Java...