Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot resolve symbol error

 
Nee Kat
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic