Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java compilation error: "cannot resolve symbol"

Reply
Thread Tools

Java compilation error: "cannot resolve symbol"

 
 
Philipp Gressly
Guest
Posts: n/a
 
      04-17-2005
exquisitus wrote:
> I have a simple test package that I am using to learn Java. I have two
> files, both of which belong to the same package (mypackage). One of the
> files uses a class defined in the other file. Both files are in the same
> directory c:\temp\test\mypackage
>
> I compiled the non-dependent file without any problem. However, when I
> tried to compile the file that has a dependency to the other file, I got
> a "cannot resolve symbol". I don't believe it!. The .class file from
> the first compilation is right there (where on earth is the compiler
> looking)?. I tried to spoonfed the compiler by typing the ff (from the
> c:\temp\test\mypackage directory):
>
> javac -c . foo2.java
>
> and it still reported the same error !
>
> This must be fairly easy to solve. I would appreciate any help. As an
> aside, could anyone provide me with a simple build.xml file to build
> this?. The two files are foo1.java and foo2.java. foo2.java has
> adependency on foo1.java
>
> Thanks
>
>


Try the following javac-command with the below mentioned classes
"Foo1.java" and "Foo2.java" (be aware of the package-declaration, the
upper- and lowercase Letters in the File- and Classnames and the
classpath and local directory:



>cd C:\temp\test
>javac -classpath . mypackage/*



File Foo1.java:
>>>

package mypackage;

public class Foo1 {
Foo2 foo2;
}
<<<

File Foo2.java
>>>

package mypackage;

public class Foo2 {
}
<<<

Hope that hepls
 
Reply With Quote
 
 
 
 
exquisitus
Guest
Posts: n/a
 
      04-17-2005
I have a simple test package that I am using to learn Java. I have two
files, both of which belong to the same package (mypackage). One of the
files uses a class defined in the other file. Both files are in the same
directory c:\temp\test\mypackage

I compiled the non-dependent file without any problem. However, when I
tried to compile the file that has a dependency to the other file, I got
a "cannot resolve symbol". I don't believe it!. The .class file from
the first compilation is right there (where on earth is the compiler
looking)?. I tried to spoonfed the compiler by typing the ff (from the
c:\temp\test\mypackage directory):

javac -c . foo2.java

and it still reported the same error !

This must be fairly easy to solve. I would appreciate any help. As an
aside, could anyone provide me with a simple build.xml file to build
this?. The two files are foo1.java and foo2.java. foo2.java has
adependency on foo1.java

Thanks


 
Reply With Quote
 
 
 
 
exquisitus
Guest
Posts: n/a
 
      04-18-2005


Philipp Gressly wrote:
> exquisitus wrote:
>
>> I have a simple test package that I am using to learn Java. I have two
>> files, both of which belong to the same package (mypackage). One of
>> the files uses a class defined in the other file. Both files are in
>> the same directory c:\temp\test\mypackage
>>
>> I compiled the non-dependent file without any problem. However, when I
>> tried to compile the file that has a dependency to the other file, I
>> got a "cannot resolve symbol". I don't believe it!. The .class file
>> from the first compilation is right there (where on earth is the
>> compiler looking)?. I tried to spoonfed the compiler by typing the ff
>> (from the c:\temp\test\mypackage directory):
>>
>> javac -c . foo2.java
>>
>> and it still reported the same error !
>>
>> This must be fairly easy to solve. I would appreciate any help. As an
>> aside, could anyone provide me with a simple build.xml file to build
>> this?. The two files are foo1.java and foo2.java. foo2.java has
>> adependency on foo1.java
>>
>> Thanks
>>
>>

>
> Try the following javac-command with the below mentioned classes
> "Foo1.java" and "Foo2.java" (be aware of the package-declaration, the
> upper- and lowercase Letters in the File- and Classnames and the
> classpath and local directory:
>
>
>
> >cd C:\temp\test
> >javac -classpath . mypackage/*

>
>
> File Foo1.java:
> >>>

> package mypackage;
>
> public class Foo1 {
> Foo2 foo2;
> }
> <<<
>
> File Foo2.java
> >>>

> package mypackage;
>
> public class Foo2 {
> }
> <<<
>
> Hope that hepls



Thank you very, very much - It worked !!!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compilation error with seperate compilation C__chp C++ 4 02-15-2008 03:57 PM
Java Applets connecting to Databases: access denied (java.net.SocketPermission ... resolve) carrilho.paulo@gmail.com Java 2 10-14-2007 09:04 PM
src-resolve: Cannot resolve the name ... ivanet@gmail.com XML 1 03-23-2007 12:10 PM
java.lang.runtime.exec cannot resolve symbol Darren Java 10 11-15-2005 07:20 PM
How to resolve java.awt.AWTException: cannot open XIM problem in Java? Arun Java 0 05-18-2004 11:18 AM



Advertisments