File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Two classes in two different sources. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Two classes in two different sources." Watch "Two classes in two different sources." New topic
Author

Two classes in two different sources.

Venkata Samy
Greenhorn

Joined: Aug 20, 2005
Posts: 8
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
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
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

Joined: Aug 20, 2005
Posts: 8
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
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
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

Joined: May 18, 2005
Posts: 84
You have to look for howto's in setting classpath for your OS.


I'm a Hood Ornament
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Two classes in two different sources.