Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Two classes in two different sources.

 
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();
}
}
-------------------------------------------------
 
Rancher
Posts: 3656
34
  • 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
Rancher
Posts: 3656
34
  • 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.
 
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.
 
Whoever got anywhere by being normal? Just ask this exceptional tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!