Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Sample Project

Ranch Hand
Posts: 590
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 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 -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

[edit] added the as attachment to this post
File size: 69 Kbytes
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic