1

I want to compile a java class called Contrat.java which is using an object of the class ListContrat.java both classes are located in the same folder whose path is : C:\Users\hue7\workspace\Test\src\com\sky, I tried to compile (create .class) executing the following commands from the folder namded sky:

javac Contrat.java and javac -cp ListContrat.java Contrat.java both gives the error:

    Contrat.java:21: error: cannot find symbol 
        protected List<ListContrat> contrat; 
                       ^ 
  symbol:   class ListContrat 
  location: class Contrat 
Contrat.java:23: error: cannot find symbol 
        public List<ListContrat> getContrat() { 
                    ^ 
  symbol:   class ListContrat 
  location: class Contrat 
Note: Contrat.java uses unchecked or unsafe operations. 
Note: Recompile with -Xlint:unchecked for details. 
2 errors 

But when I execute the command javac Contrat.java from src folder it works correctly.

Can anyone explain why please ?

1

1 Answer 1

1

Finally I resolved the error, executing the command from the src folder.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.