Wiki source code of Java Client Example Project
Version 1.1 by David Avendasora on 2008/06/25 09:19
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | 1. Create a new WOApplication named "WebStartJNLPTest" in Eclipse with a package of "your.app" | ||
| 2 | 1. Modify the Main.html by adding: | ||
| 3 | |||
| 4 | {{code title="Main.html Changes"}} | ||
| 5 | <WEBOBJECT NAME=JavaClientLink>click here</WEBOBJECT> | ||
| 6 | {{/code}} | ||
| 7 | |||
| 8 | 1. Modify the Main.wod file by adding: | ||
| 9 | |||
| 10 | {{code title="Main.wod Changes"}} | ||
| 11 | JavaClientLink: WOHyperlink { | ||
| 12 | href = javaClientLink; | ||
| 13 | } | ||
| 14 | {{/code}} | ||
| 15 | |||
| 16 | 1. Modify the Main.java file by adding: | ||
| 17 | |||
| 18 | {{code title="Main.java Changes"}} | ||
| 19 | |||
| 20 | public String javaClientLink() { | ||
| 21 | return WOJavaClientComponent.webStartActionURL(context(), "JavaClient"); | ||
| 22 | } | ||
| 23 | |||
| 24 | {{/code}} | ||
| 25 | |||
| 26 | 1. Create a WOComponent named JavaClient | ||
| 27 | 1. Modify the JavaClient.html replacing the contents with: | ||
| 28 | |||
| 29 | {{code title="JavaClient.html"}} | ||
| 30 | <WEBOBJECT NAME=JavaClientComponent></WEBOBJECT> | ||
| 31 | {{/code}} | ||
| 32 | |||
| 33 | 1. Modify the JavaClient.wod file by adding: | ||
| 34 | |||
| 35 | {{code title="JavaClient.wod Contents"}} | ||
| 36 | |||
| 37 | JavaClientComponent: WOJavaClientComponent { | ||
| 38 | applicationClassName = "com.webobjects.eogeneration.EODynamicApplication"; | ||
| 39 | applicationName = "WebStartJBNDTest"; | ||
| 40 | applicationDescription = "WebStartJBNDTest"; | ||
| 41 | downloadClientClasses = "noDownloadClientClasses"; | ||
| 42 | vendor = "My Company"; | ||
| 43 | } | ||
| 44 | |||
| 45 | {{/code}} | ||
| 46 | |||
| 47 | 1. Add the following frameworks to the project build path: | ||
| 48 | JavaDirectToWeb | ||
| 49 | JavaDTWGeneration | ||
| 50 | JavaEOApplication | ||
| 51 | JavaEOControl | ||
| 52 | JavaEODistribution | ||
| 53 | JavaEOGeneration | ||
| 54 | JavaEOInterface | ||
| 55 | JavaEOInterfaceSwing | ||
| 56 | JavaEOProject | ||
| 57 | JavaEORuleSystem | ||
| 58 | JavaFoundation | ||
| 59 | JavaJDBCAdaptor | ||
| 60 | JavaWebObjects | ||
| 61 | JavaWOExtensions | ||
| 62 | 1. Create a ClasspathClient.txt file in the root of the project and paste the following as contents: | ||
| 63 | |||
| 64 | {{code title="ClasspathClient.txt File"}} | ||
| 65 | |||
| 66 | # ApplicationClass == com.webobjects.eoapplication.client.EOClientApplicationSupport | ||
| 67 | # JDB == jdb | ||
| 68 | # JDBOptions == | ||
| 69 | # JVM == java | ||
| 70 | # JVMOptions == | ||
| 71 | APPROOT/WebServerResources/Java/WebStartJNLPTest.jar | ||
| 72 | /System/Library/Frameworks/JavaFoundation.framework/WebServerResources/Java/JavaFoundation.jar | ||
| 73 | WOROOT/Library/Frameworks/JavaEOControl.framework/WebServerResources/Java/JavaEOControl.jar | ||
| 74 | WOROOT/Library/Frameworks/JavaXML.framework/WebServerResources/Java/JavaXML.jar | ||
| 75 | WOROOT/Library/Frameworks/JavaDirectToWeb.framework/WebServerResources/Java/JavaDirectToWeb.jar | ||
| 76 | WOROOT/Library/Frameworks/JavaEOApplication.framework/WebServerResources/Java/JavaEOApplication.jar | ||
| 77 | WOROOT/Library/Frameworks/JavaEODistribution.framework/WebServerResources/Java/JavaEODistribution.jar | ||
| 78 | WOROOT/Library/Frameworks/JavaEOGeneration.framework/WebServerResources/Java/JavaEOGeneration.jar | ||
| 79 | WOROOT/Library/Frameworks/JavaEOInterface.framework/WebServerResources/Java/JavaEOInterface.jar | ||
| 80 | WOROOT/Library/Frameworks/JavaEOInterfaceSwing.framework/WebServerResources/Java/JavaEOInterfaceSwing.jar | ||
| 81 | WOROOT/Library/Frameworks/JavaEORuleSystem.framework/WebServerResources/Java/JavaEORuleSystem.jar | ||
| 82 | WOROOT/Library/Frameworks/JavaWOJSPServlet.framework/WebServerResources/Java/JavaWOJSPServlet_client.jar | ||
| 83 | HOMEROOT/Library/Java | ||
| 84 | LOCALROOT/Library/Java | ||
| 85 | WOROOT/Library/Java | ||
| 86 | /Network/Library/Java | ||
| 87 | WOROOT/Library/Frameworks/JavaVM.framework/Classes/classes.jar | ||
| 88 | WOROOT/Library/Frameworks/JavaVM.framework/Classes/ui.jar | ||
| 89 | |||
| 90 | {{/code}} | ||
| 91 | |||
| 92 | 1. Create a javaclientbuild.xml file in root of the project and paste the follwing as contents: | ||
| 93 | |||
| 94 | {{code title="javaclientbuild.xml"}} | ||
| 95 | |||
| 96 | <project name="javaclient" default="javaclient" basedir="."> | ||
| 97 | <target name="setProps"> | ||
| 98 | <property file="${user.home}${file.separator}build.properties"/> | ||
| 99 | <property file="build.properties"/> | ||
| 100 | <property file="${user.home}${file.separator}Library${file.separator}wobuild.properties"/> | ||
| 101 | <condition property="wo.properties.check.failed"> | ||
| 102 | <not> | ||
| 103 | <and> | ||
| 104 | <isset property="wo.wosystemroot"/> | ||
| 105 | <isset property="wo.wolocalroot"/> | ||
| 106 | </and> | ||
| 107 | </not> | ||
| 108 | </condition> | ||
| 109 | <fail message="Could not find ${user.home}${file.separator}Library${file.separator}wobuild.properties." if="wo.properties.check.failed"/> | ||
| 110 | </target> | ||
| 111 | <target name="javaclient" depends="setProps"> | ||
| 112 | <mkdir dir="build/${project.name}.woa/Contents/WebServerResources/Java"/> | ||
| 113 | |||
| 114 | <!-- project client-side classes --> | ||
| 115 | <copy todir="build/${project.name}.woa/Contents/WebServerResources/Java/"> | ||
| 116 | <fileset dir="${classes.dir}"> | ||
| 117 | <include name="**/client/**/*.class,**/common/**/*.class,**/BMGenericRecord.class"/> | ||
| 118 | <exclude name="**/server/**/*.class"/> | ||
| 119 | </fileset> | ||
| 120 | </copy> | ||
| 121 | |||
| 122 | <jar basedir="${classes.dir}" | ||
| 123 | includes="**/client/**/*.class,**/common/**/*.class,**/BMGenericRecord.class" | ||
| 124 | excludes="**/server/**/*.class" | ||
| 125 | jarfile="build/${project.name}.woa/Contents/WebServerResources/Java/${project.name}.jar"> | ||
| 126 | </jar> | ||
| 127 | |||
| 128 | <!-- Launch Scripts and WOBootstrap.jar--> | ||
| 129 | <mkdir dir="build/${project.name}.woa/Contents/MacOS"/> | ||
| 130 | <mkdir dir="build/${project.name}.woa/Contents/UNIX"/> | ||
| 131 | <mkdir dir="build/${project.name}.woa/Contents/Windows"/> | ||
| 132 | |||
| 133 | <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/UnixLaunch.sh" | ||
| 134 | tofile="build/${project.name}.woa/Contents/${project.name}"/> | ||
| 135 | <chmod file="build/${project.name}.woa/Contents/${project.name}" perm="ugo+rx"/> | ||
| 136 | <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WinLaunch.CMD" | ||
| 137 | tofile="build/${project.name}.woa/Contents/${project.name}.CMD"/> | ||
| 138 | <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WOBootstrap.jar" | ||
| 139 | tofile="build/${project.name}.woa/Contents/WOBootstrap.jar"/> | ||
| 140 | |||
| 141 | <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/UnixLaunchClient.sh" | ||
| 142 | tofile="build/${project.name}.woa/Contents/MacOS/${project.name}_Client"/> | ||
| 143 | <chmod file="build/${project.name}.woa/Contents/MacOS/${project.name}_Client" perm="ugo+rx"/> | ||
| 144 | <copy file="ClasspathClient.txt" tofile="build/${project.name}.woa/Contents/MacOS/ClasspathClient.txt"/> | ||
| 145 | |||
| 146 | <copy file="/Library/Application Support/Apple/Developer Tools/WebObjects Support/WinLaunch.CMD" | ||
| 147 | tofile="build/${project.name}.woa/Contents/Windows/${project.name}.CMD"/> | ||
| 148 | |||
| 149 | </target> | ||
| 150 | </project> | ||
| 151 | |||
| 152 | {{/code}} | ||
| 153 | |||
| 154 | 1. Right-click on the javaclientbuild.xml file and select "Run As -> Ant Build" | ||
| 155 | 1. Right-click on the project and select "Run As -> WebObjects Application" | ||
| 156 | 1. Select your.app.Application as the Application class | ||
| 157 | 1. Copy the Direct Connect URL from the Eclipse console and paste it into your browser. You should get a "click here" link. | ||
| 158 | 1. Click it. |