• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two classes in two different sources.

 
Venkata Samy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the following code in two different files. Op1.java compiles, but not Op.java. It says "cannot resolve symbol Op1". Both sources are in the same directory.

By the way, I'm forced to use the following command to run the Java program in my laptop: (Thought this would give some clue about my settings)
java -classpath %classpath%;. hello1

I appreciate any help,

Thank you.
venkata

-------------------------------------------------
Op1.java
-------------------------------------------------
public class Op1
{
int i;
public void prnt()
{
{
System.out.println("Value of i within subset is : " + i);
i++;
System.out.println("Value of i within subset is : " + i);
}
}

}

-------------------------------------------------
Op.java
-------------------------------------------------
public class Op
{
public static void main(String[] args)
{
Op1 O = new Op1();
O.prnt();
}
}
-------------------------------------------------
 
Norm Radder
Bartender
Posts: 1343
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The commandline you show starts the hello1 class.

java -classpath %classpath%;. hello1

How is it related to the Op and Op1 classes?

Could you copy and paste here the console for when you run the program that gives the reported error?

Is the error message
cannot resolve symbol Op1

from the compiler (javac.exe)? Please copy all of console with messages and post here.
 
Venkata Samy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the confusion.

I'm getting compile time error. NOT run time error.

It's an example command string that I use to run any java program in my laptop. The fact that I've to use this command string to run a program after a normal compilation might be due to some invalid CLASSPATH setup in my laptop. So, I've provided the command string as additional information. In this case, I did not use it, as I couldn't even compile the sources.

Thank you.
 
Norm Radder
Bartender
Posts: 1343
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We need to see the program that you are compiling and the all of the screen from when you compile it that shows all the error messages if we are to help you.
 
Megs Maquito
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to look for howto's in setting classpath for your OS.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic