From Library area on main web site
Exercise 0: Info
Exercise 1: Follow steps 1: 1-4 for NetBeans 6.5
To resolve import errors, had to add to Libraries
sgs-client.jar
sgs-server-api-0.9.9.jar
also added
sgs-client-0.9.9-sources.jar
to be able to look at source code.
Many errors is source code
(see fixes doc)
Ex1: Step 2 read Lesson and Tutorials again.
Replace pieces of code in SimpleServer.java with code from
..\solutions\exercise1\com\sun\sgs\darkmud\SimpleServer.java
Convert byte[] to ByteBuffer to send massages.
Add sendMessage also.
Build successful..woo hoo.
Try to run
java.lang.NoClassDefFoundError: com/sun/sgs/impl/kernel/Kernel
hmm..errors
Try adding sgs-server-0.9.9.jar to Libraries
Better, errors..don't have database??..try clean build from new NetBeans
project.
ref1: Server API Programming Guide.pdf "Project Darkstar
Server Application Tutorial 03/18/09"
NetBeans 6.5
File: New Project
1. Choose Project: Java: Java Class Library
2. Name and Location: myDarkMUD
Project Locaton: C:\DATA\GameDevelopment\myDarkMUD
Project Folder: C:\DATA\GameDevelopment\myDarkMUD\myDarkMUD
ref1 pg9: "... API classes are in com.sun.sgs.app.* package."
Nice, but which *.jar???
Found in sgs-serverapi-0.9.9.jar. So, RMC Libraries->Add Jar/Folder...
and browse to where Darkstar server lib is and add sgs-serverapi-0.9.9.jar
to Libraries. Used Relative Path.
Next, RMC Source Pakages->New->Java Package to add a folder named com.sun.sgs.darkmud
so the packages will match up with the source code from the 7400 DarkMud
example.
Next, copy SimpleServer.java file from 7400 Darkmud into the package.
hmm..no errors..good sign.
Build MyDarkMUD project..SUCCESSFUL..so far so good.
Results in
C:\DATA\GameDevelopment\myDarkMUD\myDarkMUD\dist\myDarkMUD.jar
file
Copy this file into sgs-server-dist-0.9.9\deploy folder just like for
the tutorial.
Go to tutorial\conf\ and copy and edit:
HelloWorld.boot to myDarkMUD.boot
Change SGS_PROPERTIES to
use myDarkMUD.properties file.
HelloWorld.properties to myDarkMUD.properties
Change .app.name to use
myDarkMUD instead of HelloWorld
Change .app.root to use
myDarkMUD instead of HelloWorld
This seems to set up the database automatically.
Change .app.listener to
use myDarkMUD instead of HelloWorld
opps..Refactor SimpleServer.java to myDarkMUD.java so that the *.jar
filename matches the class...rebuild..then copy into deploy folder to replace
first jar file.
ref1 pg 14: Open a command line window and run server
using
java -jar bin/sgs-boot.jar tutorial/conf/myDarkMUD.boot
from the server distribution directory..mine is at
C:\DATA\GameDevelopment\DarkStarGameEngine\DSG_0_9_9\sgs-server-dist-0.9.9\sgs-server-dist-0.9.9
can't find myDarkMUD class..did make a db folder though.
oops..change .app.listener to com.sun.sgs.darkmud.myDarkMUD..still
no class
hmm..copy in package-info.java file and rebuild..copy jar file into
deploy..error..no class
hmm..recall reading sgs-boot.properties file comments on SGS_DEPLOY
tag...it's set to =${SGS_HOME}/tutorial
hmm..copy myDarkMUD.jar into tutorial directory where tutorial.jar
is..AH hA..seems to work.
ref plan 1: client launch
Bring up simple client with another Command window and cd to the client
tutorial and use
java -cp tutorial-client.jar;../lib/sgs-client.jar
com.sun.sgs.tutorial.client.lesson1.HelloUserClient
Woo Hoo ..client logs in!!!..but nothing else happens..BUT, we can
compile and run..
Edit code to output text..no output..error on com.sun.sgs.impl.service....hmm..no
.impl type classes in Library
Add sgs-server-0.9.9.jar to Libraries..rebuild..still errors when client
connects.
Try using most of HelloEchoSessionListener code from ref1
pg 36-37
hmm..didn't like the private static final long serialVersionUID = 1L;
entry..comment out...delete db folder..helped..but Kernel problem
Had to rewrite the code to use referenced objects for the session..
Basically replaced SimpleListener method with
Load up 7400_Darkstar project. It sets the client as the main class.
So just compile and run project.
Logged in at pop-up..no server messages..error message is