This tutorial will help you create a single Eclipse/WOLips project that contains both the client- and server-side classes of a WebObjects Java Client project, build both applications and then launch them both.
You can also create a Java Client application using two separate Eclipse WebObjects projects. One for the server, and one for the client. This will make the separation between client and server much more obvious, but then you will have two Eclipse projects to maintain.
- Create a new WebObjects Application
- Name it "WebStartJNLPTest" in Eclipse with a package of "your.app"
If you change the Project name or packages, then you'll need to make additional changes in the subsequent steps.
- Modify the Main.html by adding:
- Modify the Main.wod file by adding:
- Modify the Main.java file by adding:
- Create a WOComponent named "JavaClient".
This WOComponent will be what passes the specifics about your client-side application to WebObjects.
- Modify the JavaClient.html replacing the contents with:
- Paste the following as the contents of the JavaClient.wod file. Feel free to change the applicationName, applicationDescription and vendor parameters to anything you wish.
If you are not creating a Direct To Java Client (D2JC) application, then you will need to replace the applicationClassName parameter (com.webobjects.eogeneration.EODynamicApplication) with the name of your client-side application class. Your non-D2JC client-side Application class must subclass EOApplication.
- If you didn't add an EOModel file to the project when you created it, do it now. Drop any existing EOModel in the Resources directory, or create one from scratch.
- Add the following frameworks to the project build path:
If you are not creating a D2JC application, then you won't need all of these, but they won't hurt anything either.
- Create a ClasspathClient.txt file in the root of the project and paste the following as contents:
This file is only required by the application when it is being launched from within Eclipse.
If you changed the applicaton name in Step 2 above, make sure you change the name of the Client-Side .jar file in the first classpath line below (WebStartJNLPTest.jar). Also be sure to match the case of the project. Client-Side .jar filenames are CamelCase instead of all lowercase as server-side .jar filenames are.
- Create a Java Client Incremental Builder by following the instructions. This file is needed to make up for the lack of Java Client application building by the WOLips Incremental Builder. It also copies the client launch scripts into the project so that the application will auto-launch when you run it from within Eclipse.
- If you did not setup the Java Client Incremental Builder, then right-click on the javaclientbuild.xml file and select "Run As -> Ant Build"
- Right-click on the project and select "Run As -> WebObjects Application"
- Select your.app.Application as the Application class
- If you want to actually deploy this application, then you will also need to modify the build.xml file.
This is it. WebStart should automatically download your client application and launch it. If you are creating a D2JC application and did not put an EOModel file in the Resources directory of your project, then you'll see something like this:
If you don't want a D2JC application, then you are on your own for creating the user interface for it. Your client-side application can be a command-line or GUI application. If you want a Swing GUI, then I highly recommend Florijan Stamenkovic's JBND Framework