Last modified by Lazy Lazarus on 2025/03/28 11:42

Hide last authors
David Avendasora 5.1 1 This tutorial will get you started with Direct to Java Client, also known as D2JC, by simply creating a new project in WOLips and adding an EOModel, then launching it. The first few steps involve downloading and installing the D2JC WOLips Project Template. These steps shouln't be required for much longer.
David Avendasora 3.1 2
3 ==== Create a Project Templates directory ====
4
Lazy Lazarus 7.1 5 [[image:Create_a_Project_Templates_directory.png]]
David Avendasora 5.1 6 You need to create a "Project Templates" directory in ~~/Library/Application Support/WOLips/
David Avendasora 3.1 7
8 ==== Download the D2JC Project Template ====
9
Lazy Lazarus 7.1 10 [[image:Download_the_D2JC_Project_Template.png]]
David Avendasora 5.1 11 You can add new project templates to WOLips in addition to the built-in ones it ships with.
David Avendasora 3.1 12
Lazy Lazarus 7.1 13 Go to [[WOLips Project Templates>>doc:WOL.Home.WOLips.WOLips Project Templates.WebHome]] and download the D2JC Project Template.
David Avendasora 3.1 14
David Avendasora 5.1 15 ==== Save the Project Template ====
David Avendasora 3.1 16
Lazy Lazarus 7.1 17 [[image:Save_the_Project_Template.png]]
David Avendasora 3.1 18 Save the template .zip file in the Project Templates directory, then unzip it.
19
20 ==== New Project from Template ====
21
Lazy Lazarus 7.1 22 [[image:New_Project_from_Template.png]]
David Avendasora 3.1 23 Start Eclipse and Select File -> New -> Other... -> WOLips -> WOProject From Template
24
25 ==== Select the template ====
26
Lazy Lazarus 7.1 27 [[image:Select_the_template.png]]
David Avendasora 3.1 28 Select Direct To Java Client WebStart Project from the list of Templates
29
30 ==== Define Packages ====
31
Lazy Lazarus 7.1 32 [[image:Define_Packages.png]]
David Avendasora 3.1 33 Define the Java Packages for your project. One of the key concepts to understand with a Java Client appication is that there can be both client-side and server-side classes for each of your Entities. The incremental and Ant builders for the client-side classes specifically lookes for classes with "client" in their package name to determine if they should be part of the client-side classes, so make sure your Client-Side EOF Class Package includes "client" in it at some point.
34
35 ==== Name your Project ====
36
Lazy Lazarus 7.1 37 [[image:Name_your_Project.png]]
David Avendasora 3.1 38 Give it a name just like you would with any other WebObjects Application. Just click Finished here instead of "Next" as we will add your EOModel to the project later.
39
40 ==== Launch the Application ====
41
Lazy Lazarus 7.1 42 [[image:Launch_the_Application.png]]
David Avendasora 3.1 43 Launch the Application just like any other WebObjects application.
44
45 ==== Select the Application class ====
46
Lazy Lazarus 7.1 47 [[image:Select_the_Application_class.png]]
David Avendasora 3.1 48 Select the Application class that is in your Base Package.
49
Lazy Lazarus 11.1 50 ==== Possible problem: Can't connect to localhost/127.0.0.1 ====
Lazy Lazarus 8.1 51
52 When using Mac OS X 10.15 Catalina and OpenJDK 11 you may find the WebObjects server may not be reached by the Java Client via localhost (127.0.0.1) even though accessing the WebObjects server application via web browser works well.
53
Lazy Lazarus 10.1 54 You will experience client network/socket exceptions like "host down" or "connection refused" when you call the client execution script via terminal.
Lazy Lazarus 8.1 55
Lazy Lazarus 10.1 56 [[image:change_wo-host.png]]
Lazy Lazarus 8.1 57
58 Solve this by changing the launch parameter ##-WOHost## to a local IP of the machine like ##192.168.0.112##.
59
David Avendasora 3.1 60 ==== Missing EOModel Error ====
61
Lazy Lazarus 7.1 62 [[image:Missing_EOModel_Error.png]]
David Avendasora 3.1 63 The application will launch like a Web Client WebObjects application, but instead of opening a Web browser and displaying the contents of the Main component, A D2JC application will call the client-side launch script that will automatically launch the Clent-Side application. Since we did not add an EOModel File to our project, WebObjects can't automatically create a Swing UI based on it, so we get this error instead.
64
65 ==== Quit the Java Client Application ====
66
Lazy Lazarus 7.1 67 [[image:Quit_the_Java_Client_Application.png]]
David Avendasora 3.1 68 You will see that the Java Client application is a regular application with it's own menu bar and default options. You can quit the Java Client application by iether selecting Quit from the application menu, or by using the standard keyboard shortcut.
69
70 ==== Quit the Server-Side Application ====
71
Lazy Lazarus 7.1 72 [[image:Quit_the_Server-Side_Application.png]]
David Avendasora 3.1 73 You notice that in Eclipse, the server-side appication is still running. When you quit the client side application, the server simply discarded any Objects associated with that instance of client-side application including Sessions, EditingContexts and EOs. You should now stop the server-side application.
David Avendasora 4.1 74
75 ==== Add an EOModel File ====
76
Lazy Lazarus 7.1 77 [[image:media_1246391006977.png]]
David Avendasora 4.1 78 Drop an EOModel into the project's Resources directory.
79
80 ==== Set WOLips to generate required files ====
81
Lazy Lazarus 7.1 82 [[image:media_1246384681240.png]]
David Avendasora 4.1 83 In order for the EOAssistant to be able to modify the user.d2wmodel file in your project root, WOLips must write out both the PB.project and .xcodeproj files when it builds. Without these checked, the EOAssistant will modify the user.d2wmodel file in your project's build directory, which will get erased any time you clean your project.
84
85 This is a work-around due to a bug in WebObject's EOAssistant. A Radar has been logged (7020811).
Lazy Lazarus 11.1 86
87 ==== Fix broken Swing bindings ====
88
89 Using a recent JDK (> 11 LTS) will break UI bindings because of then applied Java security constraints.
90
Lazy Lazarus 12.1 91 To turn off these constraints even for the autostarted Java Client Application modify the responsible script at ##/Library/Application Support/Apple/Developer Tools/WebObjects Support/UnixLaunchClient.sh##.
Lazy Lazarus 11.1 92
Lazy Lazarus 12.1 93 Look for line 227 setting the JVM options, add this option:
Lazy Lazarus 11.1 94
95 {{code language="sh"}}
Lazy Lazarus 12.1 96 DEFAULT_JVM_OPTIONS="--add-exports java.base/sun.security.action=ALL-UNNAMED"
Lazy Lazarus 11.1 97 {{/code}}
98
99 Rebuild the Java Client.