You have a file TestingEvent.java and a nested directory called com/testing in the same higher directory.
You have Test.java and Test2.java in com/testing and TestingEvent.java in the higher-level directory. That is what I did, copying your files. And I got this, once I corrected my own errors!
[Campbell@localhost ~]$ cd java
[Campbell@localhost java]$ mkdir com
[Campbell@localhost java]$ cd com
[Campbell@localhost com]$ mkdir testing
[Campbell@localhost com]$ cd ..
[Campbell@localhost java]$ gedit com/testing/Test.java&
[Campbell@localhost java]$ javac com/testing/Test.java com/testing/Test2.java
[Campbell@localhost java]$ javac TestingEvent.java
[Campbell@localhost java]$ java TestingEvent
test
test2
[Campbell@localhost java]$
If you have all the files in the same directory it would be different, but you have two choices if the directories are already set up.
Navigate to lower directories and compile with javac MyFile.javaStay in higher directory and compile with javac com/package/MyFileI did the latter. Note you can compile several files in one instruction. If you compile them separately, TestingEvent has a dependency on Test2 and Test2 has a dependency on
Test, so Test2 cannot be compiled before Test and TestingEvent cannot be compiled before Test2.
Although I am using Linux, you can do the same on Windows, but might have to use \ instead of /.
Did you find
this thread when you searched, and its included links? Or
this one (that might be one of the links mentioned earlier)?
You should find more information there.
It ought not to be necessary to set up a classpath variable for this simple application.
Using
javac -d . Test.java will work if you have all the files in one folder; the com and testing folders will be set up by the -d command. The . means start in current directory; I don't know whether that instruction works without the .