Java – Opening an existing Java project

eclipsejavanetbeansproject

Can someone help me to open an existing Java project using Eclipse or Netbeans?
It's a specific project on SourceForge, SMPPClientServer.

All I want to do is to just get this project to run. But, this seems like a challenge at the moment as I'm totally new to Java (I'm a C#.Net developer).

Best Answer

  • Download the .jar from sourceforge, save it somewhere on your PC.
  • Open eclipse.
  • You need the "Package Explorer" window open - should be open by default I think, on the LHS.
  • Right click, New -> Project, and select "Java Project"
  • Click Next
  • Give your project a name, can be basically anything, although there are naming standards. E.g MyProject
  • Click Next, then click Finish.
  • You'll now have a new project called MyProject in the Package Explorer window.
  • Now you need to import the jar to your project:
  • Create a folder in your project in which you'll keep any jars. Right click on "MyProject", New -> Folder and give it a name, say "x-jars"
  • This folder will be created below MyProject. This is a real (system) folder, and you want to copy your jar into this folder. This folder will be located on your filesystem at ~eclipse-workspace/MyProject/x-jars/
  • When copied into the x-jars folder, back in eclipse select MyProject and hit F5 to refresh. The jar will now show up under your x-jars folder (You can expand a folder contents by clicking the little triangles)
  • Now you want to actually use your jar:
  • Right click on "src" under MyProject (src is where you keep all your java classes). Do New -> Package, and per standard conventions give it a name like: com.mydomain.smpp and click Finish.
  • Right Click on the resulting Package and do New -> Class, and give it a name, e.g MyTest, and click Finish.
  • You'll now have the skeleton of a Java class in your main eclipse editor. This class lives in the Package com.mydomain.smpp. All classes should live in a package.
  • Finally you need to make sure that the x-jars folder is included in your build (compile) path. Right click on MyProject, do Build Path -> Configure Build Path. On the Libraries tab click "Add JARS", and select the x-jars folder in MyProject.
  • And that's it. I can't help you set up a trial SMPP app/class as there does not appear to be any docs or published API, but this is what you need to do to use the jar.