This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes cannot resolve symbol error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cannot resolve symbol error" Watch "cannot resolve symbol error" New topic
Author

cannot resolve symbol error

Nee Kat
Ranch Hand

Joined: Jan 27, 2004
Posts: 37
I have two classes and trying to call a method from one class to another but getting this error.

Here is the class having the method:

import java.util.*;
import java.io.*;

public class MethodContainer{

public void printer(int ho)
{
System.out.println( "This works"+ho);
}
}

and here is the main class

import java.util.*;
import java.io.*;

public class callMethod{
public static void main( String args[])
{
int ho = 100;
MethodContainer methodReceiver = new MethodContainer();
methodReceiver.printer(ho);

}
}

I am getting these errors:

cannot resolve symbol
symbol : class MethodContainer
location: class callMethod
MethodContainer methodReceiver = new MethodContainer();

cannot resolve symbol
symbol : class MethodContainer
location: class callMethod
MethodContainer methodReceiver = new MethodContainer();

Help needed.

Thanks.
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
You may need to set your classpath to include the directory with your code in it. See setting the classpath FAQ.

I'm on windows and using jdk 1.4 and simply set classpath to current directory.
set classpath=.

If that doesn't fix things, then let us know what jdk you're using, what file names you are saving those two classes with and the command you're running, what directory you're working in.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot resolve symbol error
 
Similar Threads
Compile error
Sending Fax
What' s wrong with this code?
ArrayList:
Scanner