Version 33.1 by David Avendasora on 2008/06/26 10:29

Show last authors
1 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.
2
3 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.
4
5 1. Create a new WebObjects Application
6 [[image:Picture 9.png]]
7 1. Name it "WebStartJNLPTest" in Eclipse with a package of "your.app" {{note title="Note!"}}If you change the Project name or packages, then you'll need to make additional changes in the subsequent steps.{{/note}}
8 1. Modify the Main.html by adding:
9
10 {{code title="Main.html Changes"}}
11 <WEBOBJECT NAME=JavaClientLink>click here</WEBOBJECT>
12 {{/code}}
13
14 1. Modify the Main.wod file by adding:
15
16 {{code title="Main.wod Changes"}}
17 JavaClientLink: WOHyperlink {
18 href = javaClientLink;
19 }
20 {{/code}}
21
22 1. Modify the Main.java file by adding:
23
24 {{code title="Main.java Changes"}}
25
26 public String javaClientLink() {
27 return WOJavaClientComponent.webStartActionURL(context(), "JavaClient");
28 }
29
30 {{/code}}
31
32 1. Create a WOComponent named "JavaClient".
33 [[image:Picture 11.png]][[image:Picture 10.png]]
34 This WOComponent will be what passes the specifics about your client-side application to WebObjects.
35 1. Modify the JavaClient.html replacing the contents with:
36
37 {{code title="JavaClient.html Contents"}}
38 <WEBOBJECT NAME=JavaClientComponent></WEBOBJECT>
39 {{/code}}
40
41 1. 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.
42
43 {{code title="JavaClient.wod Contents"}}
44
45 JavaClientComponent: WOJavaClientComponent {
46 applicationClassName = "com.webobjects.eogeneration.EODynamicApplication";
47 applicationName = "D2JC WebStart Test";
48 applicationDescription = "D2JC WebStart Test";
49 downloadClientClasses = "noDownloadClientClasses";
50 vendor = "My Company";
51 }
52
53 {{/code}}
54
55 {{note title="Note!"}}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.{{/note}}
56
57 1. 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.
58 1. Add the following frameworks to the project build path:
59 JavaDirectToWeb
60 JavaDTWGeneration
61 JavaEOApplication
62 JavaEOControl
63 JavaEODistribution
64 JavaEOGeneration
65 JavaEOInterface
66 JavaEOInterfaceSwing
67 JavaEOProject
68 JavaEORuleSystem
69 JavaFoundation
70 JavaJDBCAdaptor
71 JavaWebObjects
72 JavaWOExtensions
73
74 {{note title="Note!"}}
75 If you are not creating a D2JC application, then you won't need all of these, but they won't hurt anything either.
76 {{/note}}
77
78 1. Create a ClasspathClient.txt file in the root of the project and paste the following as contents:{{note title="Note!"}}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.{{/note}}
79
80 {{code title="ClasspathClient.txt File"}}
81
82 # ApplicationClass == com.webobjects.eoapplication.client.EOClientApplicationSupport
83 # JDB == jdb
84 # JDBOptions ==
85 # JVM == java
86 # JVMOptions ==
87 APPROOT/WebServerResources/Java/WebStartJNLPTest.jar
88 /System/Library/Frameworks/JavaFoundation.framework/WebServerResources/Java/JavaFoundation.jar
89 WOROOT/Library/Frameworks/JavaEOControl.framework/WebServerResources/Java/JavaEOControl.jar
90 WOROOT/Library/Frameworks/JavaXML.framework/WebServerResources/Java/JavaXML.jar
91 WOROOT/Library/Frameworks/JavaDirectToWeb.framework/WebServerResources/Java/JavaDirectToWeb.jar
92 WOROOT/Library/Frameworks/JavaEOApplication.framework/WebServerResources/Java/JavaEOApplication.jar
93 WOROOT/Library/Frameworks/JavaEODistribution.framework/WebServerResources/Java/JavaEODistribution.jar
94 WOROOT/Library/Frameworks/JavaEOGeneration.framework/WebServerResources/Java/JavaEOGeneration.jar
95 WOROOT/Library/Frameworks/JavaEOInterface.framework/WebServerResources/Java/JavaEOInterface.jar
96 WOROOT/Library/Frameworks/JavaEOInterfaceSwing.framework/WebServerResources/Java/JavaEOInterfaceSwing.jar
97 WOROOT/Library/Frameworks/JavaEORuleSystem.framework/WebServerResources/Java/JavaEORuleSystem.jar
98 WOROOT/Library/Frameworks/JavaWOJSPServlet.framework/WebServerResources/Java/JavaWOJSPServlet_client.jar
99 HOMEROOT/Library/Java
100 LOCALROOT/Library/Java
101 WOROOT/Library/Java
102 /Network/Library/Java
103 WOROOT/Library/Frameworks/JavaVM.framework/Classes/classes.jar
104 WOROOT/Library/Frameworks/JavaVM.framework/Classes/ui.jar
105
106 {{/code}}
107
108 This file is only required by the application when it is being launched from within Eclipse.
109
110 1. Create a Java Client Incremental Builder by following the [[instructions>>Java Client-WebStart Incremental Build]]. 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.
111 1. If you did not setup the Java Client Incremental Builder, then right-click on the javaclientbuild.xml file and select "Run As -> Ant Build"
112 [[image:Picture 12.png]]
113 1. Right-click on the project and select "Run As -> WebObjects Application"
114 [[image:Picture 13.png]]
115 1. Select your.app.Application as the Application class
116 [[image:Picture 14.png]]
117 1. If you want to actually deploy this application, then you will also need to [[modify the build.xml file>>Java Client-Building]].
118 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:
119 [[image:Picture 15.png]]
120 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>>http://web.mac.com/flor385/JBND/]]