Are you getting errors? When you compile or when you run? I suspect this might be a simple classpath issue. Here is a sample error you might get when it is a classpath issue:
1 2 3 4 5 6 7 8 9 10 11
| C:\Test\Java\work\RandomPackage\TestClass2.java:5: cannot resolve symbol symbol : class TestClass location: class RandomPackage.TestClass2 TestClass insideClass; ^ C:\Test\Java\work\RandomPackage\TestClass2.java:8: cannot resolve symbol symbol : class TestClass location: class RandomPackage.TestClass2 insideClass = new TestClass(); ^ 2 errors |
If this is your problem, then you simply have to set the classpath to the directory where RandomPackage resides. You can do this with an environment variable or the '-classpath' command line switch. Then the javac command must either be executed in the directory where RandomPackage is or you can use the '-sourcepath' switch to point to it. So if your directory structure is:
c:\java\work\RandomPackage
you need to do this:
c:\java\work>javac -classpath . TESTER1.java RandomPackage/*.java
If this is not your problem, you need to provide more information. What you are trying to do(compile, execute) and what your error messages are.
Firstly, thanx!
This is exactly my problem.

Unfortunately I still cant get it working

How do I compile the classTestClass2.
I recieve the error:
D:\My Programs\Tests\RandomPackage\TestClass2.java:5: cannot resolve symbol
symbol : class TestClass
location: class RandomPackage.TestClass2
TestClass insideClass;
^
D:\My Programs\Tests\RandomPackage\TestClass2.java:8: cannot resolve symbol
symbol : class TestClass
location: class RandomPackage.TestClass2
insideClass = new TestClass();
^
2 errors
Tool completed with exit code 1
I tried c:\java\work\RandomPackage>javac -classPath . TestClass.java RandomPackage/*.java
but that does not work...
One more question , I'm currently using textpad to write my java code, which means your solution requires I either:
compile through command prompt (which is annoying)
create a new user defined tool that compiles and includes the extra arguments "c:\java\work>javac -classpath . TESTER1.java RandomPackage/*.java"
Is there another way that I have missed?
This whole package thing seems rather complicated for something that should be so simple :-/
Thanx again
Simon