Click here to Skip to main content
15,888,270 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Java!

I have :
- Two Classes in a Java Application : Person & Task
- In the Person class code : I instantiate Task Class

I use command line style to compile and run the app ( Please DO Not Ask me to use
an IDE / I am trying to learn how things work in the background )

I have set the Class Path and it works

I compiled the Task class without any problem

I complied the Person class without The code that instantiates the Task Class and it works

I tried to compile the Person class again BUT "with the Code that instantiates the Task Class" and : IT DOESN'T WORK :(

Here is the Error message : cannot find symbol
Task myTask = new Task();
symbol : class Task
location : class Person

BOTH CLASSES ARE IN THE SAME FOLDER !

Where is the problem then : DO I miss some concept in java Compilation and directory Organization ?

Update 1 :

Where should I put my Task.class File after compiling Task.java So that It could be accessible and visible by the Person class ?

In my Path Class I mention only the Jar Files I need to use.

What I have tried:

I tried :

- Using package
- Not using package
- Add a constructor to the Task Class
- Delete the main method from Task class

- I respect the convention of naming classes and constructors in Java
Posted
Updated 1-Aug-16 5:18am
v2
Comments
Richard MacCutchan 1-Aug-16 12:25pm    
Did you add an import statement (import Task;) in your Person source file?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900