I've been a c++ programmer for 10 years, i'm used to just creating libraries and then linking to them from my existing project. However in java, i have 2 projects, one is my game engine, the other is the test environment that i would like to use, here is how it is structured:
yet in my test app, i cannot do
it simply cannot find the reference.
How can I do this without having to copy and paste my engine into every program i write with it?
Package your engine as a jar, and add the jar to the classpath of the projects that use it.
In eclipse you can also declare that your test prgram depends on your game engine. The classes will then be available. Check in the build paths dialog available from the context menu in the project view.
In eclipse, right click on your test project in the Project Explorer and select Properties. In the "Java Build Path" section, go to the Projects tab and add your engine project.
You need to change the classpath to include the folder containing your engine.
java -cp /path/to/engine testapp
I just fired up Eclipse to check this out.
You should see a red wavy underline on
import com.logic.engine.*; - mouse over this and it'll tell you that the import could not be resolved and offer you a number of so-called quick fixes. One of those should be Fix Project Setup - that will offer to fix things for you, in this case to add one project to the other's build path.