This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Sample Project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Sample Project" Watch "Sample Project" New topic
Author

Sample Project

Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

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


[Download code.zip] Download



SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sample Project