Version 31.1 by David Avendasora on 2008/06/25 10:04

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. Add the following frameworks to the project build path:
54 JavaDirectToWeb
55 JavaDTWGeneration
56 JavaEOApplication
57 JavaEOControl
58 JavaEODistribution
59 JavaEOGeneration
60 JavaEOInterface
61 JavaEOInterfaceSwing
62 JavaEOProject
63 JavaEORuleSystem
64 JavaFoundation
65 JavaJDBCAdaptor
66 JavaWebObjects
67 JavaWOExtensions
68
69 {{note title="Note!"}}
70 If you are not creating a D2JC application, then you won't need all of these, but they won't hurt anything either.
71 {{/note}}
72
73 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}}
74
75 {{code title="ClasspathClient.txt File"}}
76
77 # ApplicationClass == com.webobjects.eoapplication.client.EOClientApplicationSupport
78 # JDB == jdb
79 # JDBOptions ==
80 # JVM == java
81 # JVMOptions ==
82 APPROOT/WebServerResources/Java/WebStartJNLPTest.jar
83 /System/Library/Frameworks/JavaFoundation.framework/WebServerResources/Java/JavaFoundation.jar
84 WOROOT/Library/Frameworks/JavaEOControl.framework/WebServerResources/Java/JavaEOControl.jar
85 WOROOT/Library/Frameworks/JavaXML.framework/WebServerResources/Java/JavaXML.jar
86 WOROOT/Library/Frameworks/JavaDirectToWeb.framework/WebServerResources/Java/JavaDirectToWeb.jar
87 WOROOT/Library/Frameworks/JavaEOApplication.framework/WebServerResources/Java/JavaEOApplication.jar
88 WOROOT/Library/Frameworks/JavaEODistribution.framework/WebServerResources/Java/JavaEODistribution.jar
89 WOROOT/Library/Frameworks/JavaEOGeneration.framework/WebServerResources/Java/JavaEOGeneration.jar
90 WOROOT/Library/Frameworks/JavaEOInterface.framework/WebServerResources/Java/JavaEOInterface.jar
91 WOROOT/Library/Frameworks/JavaEOInterfaceSwing.framework/WebServerResources/Java/JavaEOInterfaceSwing.jar
92 WOROOT/Library/Frameworks/JavaEORuleSystem.framework/WebServerResources/Java/JavaEORuleSystem.jar
93 WOROOT/Library/Frameworks/JavaWOJSPServlet.framework/WebServerResources/Java/JavaWOJSPServlet_client.jar
94 HOMEROOT/Library/Java
95 LOCALROOT/Library/Java
96 WOROOT/Library/Java
97 /Network/Library/Java
98 WOROOT/Library/Frameworks/JavaVM.framework/Classes/classes.jar
99 WOROOT/Library/Frameworks/JavaVM.framework/Classes/ui.jar
100
101 {{/code}}
102
103 1. Create a javaclientbuild.xml file in root of the project and paste the follwing as contents:
104
105 {{code title="javaclientbuild.xml"}}
106
107 <project name="javaclient" default="javaclient" basedir=".">
108 <target name="setProps">
109 <property file="${user.home}${file.separator}build.properties"/>
110 <property file="build.properties"/>
111 <property file="${user.home}${file.separator}Library${file.separator}wobuild.properties"/>
112 <condition property="wo.properties.check.failed">
113 <not>
114 <and>
115 <isset property="wo.wosystemroot"/>
116 <isset property="wo.wolocalroot"/>
117 </and>
118 </not>
119 </condition>
120 <fail message="Could not find ${user.home}${file.separator}Library${file.separator}wobuild.properties." if="wo.properties.check.failed"/>
121 </target>
122 <target name="javaclient" depends="setProps">
123 <mkdir dir="build/${project.name}.woa/Contents/WebServerResources/Java"/>
124
125 <!-- project client-side classes -->
126 <copy todir="build/${project.name}.woa/Contents/WebServerResources/Java/">
127 <fileset dir="${classes.dir}">
128 <include name="**/client/**/*.class,**/common/**/*.class,**/BMGenericRecord.class"/>
129 <exclude name="**/server/**/*.class"/>
130 </fileset>
131 </copy>
132
133 <jar basedir="${classes.dir}"
134 includes="**/client/**/*.class,**/common/**/*.class,**/BMGenericRecord.class"
135 excludes="**/server/**/*.class"
136 jarfile="build/${project.name}.woa/Contents/WebServerResources/Java/${project.name}.jar">
137 </jar>
138
139 <!-- Launch Scripts and WOBootstrap.jar-->
140 <mkdir dir="build/${project.name}.woa/Contents/MacOS"/>
141 <mkdir dir="build/${project.name}.woa/Contents/UNIX"/>
142 <mkdir dir="build/${project.name}.woa/Contents/Windows"/>
143
144 <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/UnixLaunch.sh"
145 tofile="build/${project.name}.woa/Contents/${project.name}"/>
146 <chmod file="build/${project.name}.woa/Contents/${project.name}" perm="ugo+rx"/>
147 <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WinLaunch.CMD"
148 tofile="build/${project.name}.woa/Contents/${project.name}.CMD"/>
149 <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WOBootstrap.jar"
150 tofile="build/${project.name}.woa/Contents/WOBootstrap.jar"/>
151
152 <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/UnixLaunchClient.sh"
153 tofile="build/${project.name}.woa/Contents/MacOS/${project.name}_Client"/>
154 <chmod file="build/${project.name}.woa/Contents/MacOS/${project.name}_Client" perm="ugo+rx"/>
155 <copy file="ClasspathClient.txt" tofile="build/${project.name}.woa/Contents/MacOS/ClasspathClient.txt"/>
156
157 <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WinLaunch.CMD"
158 tofile="build/${project.name}.woa/Contents/Windows/${project.name}.CMD"/>
159
160 </target>
161 </project>
162
163 {{/code}}
164
165 This file is needed to make up for the lack of Java Client application building by the WOLips Incremental Builder. Please follow the [[instructions>>Java Client-WebStart Incremental Build]] for how to create the Java Client Incremental Builder.
166
167 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"
168 [[image:Picture 12.png]]
169 1. Right-click on the project and select "Run As -> WebObjects Application"
170 [[image:Picture 13.png]]
171 1. Select your.app.Application as the Application class
172 [[image:Picture 14.png]]
173 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:
174 [[image:Picture 15.png]]
175 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/]]