views:

136

answers:

4

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).

+1  A: 

Just download the JAR and add it to your project. Unfortunately, there is no documentation how to use the classes and methods in that JAR, so you'll have to do a lot of guessing.

Aaron Digulla
My understanding was that Josh wants to set up a project for the sources, not add the JAR to an existing project.
Andrzej Doyle
If you look under the SMPP Application Server 1.1 folder, there's a .zip file containing the sources.He should be able to just unpack that and Import into his IDE of choice
Adam Luchjenbroers
+2  A: 

If you just want to run the compiled project: java -jar SMPPServer.jar on the command line should do the trick (I would expect, anyhow). If you're in Windows you may want to look at associatiating .jar files with Java or writing a simple .bat file to make it simpler.

If you've got the source code, you'll probably want to look for 'Import' to import the source files and create a new Eclipse or Netbeans project. In Eclipse you'll find this under the the File menu. I'm not familiar with Netbeans, but I'd expect it to be in the same place.

Adam Luchjenbroers
Shouldn't that be "java -jar SMPPServer.jar"?
Michael Borgwardt
You might be right.... updating.
Adam Luchjenbroers
+3  A: 

The jar file is not an actual Eclipse or Netbeans project. You need to create a new project with your favorite IDE and to import the jar file as a library.

To add the jar file in Eclipse, you must right click on your project and go to the menu Build path > Add External Archives

lepnio
+3  A: 
  • 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.
Richard