Version 26.1 by David Avendasora on 2008/06/25 10:10

Show last authors
1 1. Create a new WebObjects Application
2 [[image:Picture 9.png]]
3 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}}
4 1. Modify the Main.html by adding:
5
6 {{code title="Main.html Changes"}}
7 <WEBOBJECT NAME=JavaClientLink>click here</WEBOBJECT>
8 {{/code}}
9
10 1. Modify the Main.wod file by adding:
11
12 {{code title="Main.wod Changes"}}
13 JavaClientLink: WOHyperlink {
14 href = javaClientLink;
15 }
16 {{/code}}
17
18 1. Modify the Main.java file by adding:
19
20 {{code title="Main.java Changes"}}
21
22 public String javaClientLink() {
23 return WOJavaClientComponent.webStartActionURL(context(), "JavaClient");
24 }
25
26 {{/code}}
27
28 1. Create a WOComponent named "JavaClient".
29 [[image:Picture 11.png]][[image:Picture 10.png]]
30 This WOComponent will be what passes the specifics about your client-side application to WebObjects.
31 1. Modify the JavaClient.html replacing the contents with:
32
33 {{code title="JavaClient.html Contents"}}
34 <WEBOBJECT NAME=JavaClientComponent></WEBOBJECT>
35 {{/code}}
36
37 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.
38
39 {{code title="JavaClient.wod Contents"}}
40
41 JavaClientComponent: WOJavaClientComponent {
42 applicationClassName = "com.webobjects.eogeneration.EODynamicApplication";
43 applicationName = "D2JC WebStart Test";
44 applicationDescription = "D2JC WebStart Test";
45 downloadClientClasses = "noDownloadClientClasses";
46 vendor = "My Company";
47 }
48
49 {{/code}}
50
51 {{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}}
52
53 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.
54 1. Add the following frameworks to the project build path:
55 JavaDirectToWeb
56 JavaDTWGeneration
57 JavaEOApplication
58 JavaEOControl
59 JavaEODistribution
60 JavaEOGeneration
61 JavaEOInterface
62 JavaEOInterfaceSwing
63 JavaEOProject
64 JavaEORuleSystem
65 JavaFoundation
66 JavaJDBCAdaptor
67 JavaWebObjects
68 JavaWOExtensions
69
70 {{note title="Note!"}}
71 If you are not creating a D2JC application, then you won't need all of these, but they won't hurt anything either.
72 {{/note}}
73
74 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}}
75
76 {{code title="ClasspathClient.txt File"}}
77
78 # ApplicationClass == com.webobjects.eoapplication.client.EOClientApplicationSupport
79 # JDB == jdb
80 # JDBOptions ==
81 # JVM == java
82 # JVMOptions ==
83 APPROOT/WebServerResources/Java/WebStartJNLPTest.jar
84 /System/Library/Frameworks/JavaFoundation.framework/WebServerResources/Java/JavaFoundation.jar
85 WOROOT/Library/Frameworks/JavaEOControl.framework/WebServerResources/Java/JavaEOControl.jar
86 WOROOT/Library/Frameworks/JavaXML.framework/WebServerResources/Java/JavaXML.jar
87 WOROOT/Library/Frameworks/JavaDirectToWeb.framework/WebServerResources/Java/JavaDirectToWeb.jar
88 WOROOT/Library/Frameworks/JavaEOApplication.framework/WebServerResources/Java/JavaEOApplication.jar
89 WOROOT/Library/Frameworks/JavaEODistribution.framework/WebServerResources/Java/JavaEODistribution.jar
90 WOROOT/Library/Frameworks/JavaEOGeneration.framework/WebServerResources/Java/JavaEOGeneration.jar
91 WOROOT/Library/Frameworks/JavaEOInterface.framework/WebServerResources/Java/JavaEOInterface.jar
92 WOROOT/Library/Frameworks/JavaEOInterfaceSwing.framework/WebServerResources/Java/JavaEOInterfaceSwing.jar
93 WOROOT/Library/Frameworks/JavaEORuleSystem.framework/WebServerResources/Java/JavaEORuleSystem.jar
94 WOROOT/Library/Frameworks/JavaWOJSPServlet.framework/WebServerResources/Java/JavaWOJSPServlet_client.jar
95 HOMEROOT/Library/Java
96 LOCALROOT/Library/Java
97 WOROOT/Library/Java
98 /Network/Library/Java
99 WOROOT/Library/Frameworks/JavaVM.framework/Classes/classes.jar
100 WOROOT/Library/Frameworks/JavaVM.framework/Classes/ui.jar
101
102 {{/code}}
103
104 This file is only required by the application when it is being launched from within Eclipse.
105
106 1. Create a javaclientbuild.xml file in root of the project and paste the follwing as contents:
107
108 {{code title="javaclientbuild.xml"}}
109
110 <project name="javaclient" default="javaclient" basedir=".">
111 <target name="setProps">
112 <property file="${user.home}${file.separator}build.properties"/>
113 <property file="build.properties"/>
114 <property file="${user.home}${file.separator}Library${file.separator}wobuild.properties"/>
115 <condition property="wo.properties.check.failed">
116 <not>
117 <and>
118 <isset property="wo.wosystemroot"/>
119 <isset property="wo.wolocalroot"/>
120 </and>
121 </not>
122 </condition>
123 <fail message="Could not find ${user.home}${file.separator}Library${file.separator}wobuild.properties." if="wo.properties.check.failed"/>
124 </target>
125 <target name="javaclient" depends="setProps">
126 <mkdir dir="build/${project.name}.woa/Contents/WebServerResources/Java"/>
127
128 <!-- project client-side classes -->
129 <copy todir="build/${project.name}.woa/Contents/WebServerResources/Java/">
130 <fileset dir="${classes.dir}">
131 <include name="**/client/**/*.class,**/common/**/*.class,**/BMGenericRecord.class"/>
132 <exclude name="**/server/**/*.class"/>
133 </fileset>
134 </copy>
135
136 <jar basedir="${classes.dir}"
137 includes="**/client/**/*.class,**/common/**/*.class,**/BMGenericRecord.class"
138 excludes="**/server/**/*.class"
139 jarfile="build/${project.name}.woa/Contents/WebServerResources/Java/${project.name}.jar">
140 </jar>
141
142 <!-- Launch Scripts and WOBootstrap.jar-->
143 <mkdir dir="build/${project.name}.woa/Contents/MacOS"/>
144 <mkdir dir="build/${project.name}.woa/Contents/UNIX"/>
145 <mkdir dir="build/${project.name}.woa/Contents/Windows"/>
146
147 <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/UnixLaunch.sh"
148 tofile="build/${project.name}.woa/Contents/${project.name}"/>
149 <chmod file="build/${project.name}.woa/Contents/${project.name}" perm="ugo+rx"/>
150 <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WinLaunch.CMD"
151 tofile="build/${project.name}.woa/Contents/${project.name}.CMD"/>
152 <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WOBootstrap.jar"
153 tofile="build/${project.name}.woa/Contents/WOBootstrap.jar"/>
154
155 <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/UnixLaunchClient.sh"
156 tofile="build/${project.name}.woa/Contents/MacOS/${project.name}_Client"/>
157 <chmod file="build/${project.name}.woa/Contents/MacOS/${project.name}_Client" perm="ugo+rx"/>
158 <copy file="ClasspathClient.txt" tofile="build/${project.name}.woa/Contents/MacOS/ClasspathClient.txt"/>
159
160 <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WinLaunch.CMD"
161 tofile="build/${project.name}.woa/Contents/Windows/${project.name}.CMD"/>
162
163 </target>
164 </project>
165
166 {{/code}}
167
168 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.
169
170 Please follow the [[instructions>>Java Client-WebStart Incremental Build]] for how to create the Java Client Incremental Builder.
171
172 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"
173 [[image:Picture 12.png]]
174 1. Right-click on the project and select "Run As -> WebObjects Application"
175 [[image:Picture 13.png]]
176 1. Select your.app.Application as the Application class
177 [[image:Picture 14.png]]
178 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:
179 [[image:Picture 15.png]]
180 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/]]