• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sample Project  RSS feed

Sean Keane
Ranch Hand
Posts: 590
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sure the book SCJD Exam with J2SE 5, Second Edition has been mentioned a good bit on this site. The sample code for the book is freely available from the site associated with the book. I've attached the sample code with instructions of how to build it (see code.zip at the bottom of this post).

This should be useful for people starting off with this assignment - when you see it running I'm sure you'll be off to buy the book anyhow!

Commands To Build The Source

The commands to build this are actually inside the the attached zip file. But I've listed them here in case anyone is interested. Simply unzip code.jar and run these commands to build it.

mkdir classes
cd src

javac -cp ..\classes\ -d ..\classes sampleproject\db\*.java
javac -cp ..\classes\ -d ..\classes sampleproject\remote\*.java
javac -cp ..\classes\ -d ..\classes sampleproject\sockets\*.java
javac -cp ..\classes\ -d ..\classes sampleproject\direct\*.java
javac -cp ..\classes\ -d ..\classes sampleproject\gui\*.java

cd ..\classes
rmic sampleproject.remote.DvdDatabaseImpl

cd ..
jar -cfm sampleproject.jar Manifest.mf -C classes .

Commands To Run The Application

To run the application in standalone mode run the command below and select the file dvd_db.dvd when the dialog pops up:

javaw -jar sampleproject.jar alone

To run in client\server mode run the commands below to start the server; when the window pops up set the Database Location field to the file dvd_db.dvd, set the Server port field to 1099, and choose RMI server:

javaw -jar smapleproject.jar server

Now click on the Start server button. The status bar will display Server running and everything bar the Exit button will be disabled on the window.

Then to start the client run the command below; when the dialog pops up set the Database Location field to be localhost, set the Server port field to 1099, and choose RMI server

javaw -jar sampleproject.jar

Et voila! The client window should launch !

P.S. I assume I am not breaking any copyright issues here as firstly the code is freely available to anyone from the website associated with the book - regardless of whether they bought the book or not. Secondly, the commands I have listed are merely generic commands to compile, and the commands to run the tool could be easily figured out from looking at one single class ApplicationRunner.java.

[edit] added the code.zip as attachment to this post
Filename: code.zip
File size: 69 Kbytes
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!