• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Two classes in two different sources.

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();
}
}
-------------------------------------------------
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to look for howto's in setting classpath for your OS.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic