I have different projects in Eclipse (java me midlets) which all need to share code. Currently I duplicate things, but this is not ideal. What is the best way to do this? Th
You can create a Java Project which will contain the shared code and have other projects reference it. When deploying you can pack this project as a separate jar file.
Have you considered creating a shared library instead of just shared code? Export to a JAR file and import that into the dependent products.
The up-side of doing this (vs just referencing the shared code) is that it will force you into more rigorous practices. You will now have an API that must be maintained and versioned cleanly. It will also make you better consider what's shared and what's not. This will likely lead to better encapsulation, and hopefully better testing.
I'm not saying you lack these things now. Just that creating a common-foo.jar can often encourage better habits.