Here is my problem:-
On my desktop, there is a folder called "Test."
In Test, there is a folder called "toUse."
In "toUse," there is a java source file called "Test" and three folders, namely "Print," "SwingFrame" and "TextFileWriter."
The source file for "Test.":-
package Test.toUse;
import Test.toUse.Print.Printer;
public class Test {
public static void main(String[] args) {
Printer p = new Printer();
p.printMe("It worked!");
}
}
In the folder "Print", there is a source file called "Printer" and it's class file:-
package everydayUse.Print;
public class Printer {
public void printMe(String toSay) {
System.out.println(toSay);
}
}
In the folder "SwingFrame", there is a source file called "FrameMaker" and it's class file:-
package everydayUse.SwingFrame;
import javax.swing.*;
public class FrameMaker {
public JFrame createFrame(String title, int width, int height) {
JFrame frame = new JFrame(title);
frame.setSize(width, height);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
return frame;
}
}
In the folder "TextFileWriter", there is a source file called "TextFileWriter" and it's class file:-
package everydayUse.TextFileWriter;
import java.io.*;
public class TextFileWriter {
public void write(String fileName, String toWrite) {
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(fileName));
writer.write(toWrite);
writer.close();
}
catch (Exception ex) { ex.printStackTrace(); }
}
}
When I try to compile Test.java, this is the error I get:-
Test.java:2: package Test.toUse.Print does not exist
import Test.toUse.Print.Printer;
^
Test.java:5: cannot find symbol
symbol : class Printer
location: class Test.toUse.Test
Printer p = new Printer();
^
Test.java:5: cannot find symbol
symbol : class Printer
location: class Test.toUse.Test
Printer p = new Printer();
^
3 errors