• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Sample Project

Ranch Hand
Posts: 590
Eclipse IDE Chrome 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
Ever since I found this suit I've felt strange new needs. And a tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic