Home : Course Map : Chapter 20 :
Client/Server Demo Support Files
JavaTech
Course Map
Chapter 20

Introduction
Simulation
Server Demo
Client Demo
Demo Support

Exercises

     About JavaTech
     Codes List
     Exercises
     Feedback
     References
     Resources
     Tips
     Topic Index
     Course Guide
     What's New

The "Putting it all TogetherDistributed Computing Demo" includes the following files in addition to the class and interface files.

The directory tree for the various files in this demonstration go as the following diagram:

javatech-20
  |
  |__ext - hist.jar
  |
  |
__ src
        |
        |__ javatech
              |
              |__ all20
                    |
                    |__ client
                    |
                    |__ server
                          |
                          |__ impl

The support files reside in the javatech-20 directory.

java.policy


grant {
   permission java.net.SocketPermission "*:1024-65535", "connect,accept";
   permission java.net.SocketPermission "*:80", "connect";
};

 

The build, cleanup, and run command files are listed below. (To fit within the table here, in some places the command lines are broken where indicated. In the actual files there are no line breaks.)

build.bat

@rem Builds the RMI example from Chapter 20.

@rem Set up some local environment variables
setlocal
set class_dir=build/classes
set ifc_dir=src/javatech/all20/server
set impl_dir=src/javatech/all20/server/impl
set client_dir=src/javatech/all20/client
set histjar=ext/hist.jar

@rem Create the build and classes directories
mkdir build
mkdir build\classes

@rem Compile everything
set cp=%class_dir%;%histjar%
javac -classpath %cp% -d %class_dir% %ifc_dir%/*.java
javac -classpath %cp% -d %class_dir% %impl_dir%/*.java
javac -classpath %cp% -d %class_dir% %client_dir%/*.java

@rem Run the rmic compiler to generate stubs and skeletons for Server and
@rem ServerFactory
rmic -classpath %cp% -d %class_dir% javatech.all20.server.impl.ServerFactory
rmic -classpath %cp% -d %class_dir% javatech.all20.server.impl.Server

@rem Create a client-only jar file from which to run the client.
@rem cd to the top of the classes directory
@rem cd build\classes
@rem jar the needed files with the proper directory structure
@rem jar cf client.jar javatech/all20/server/ServerInterface.class javatech/all20/client/Client.class

@rem move the new jar file up to the root directory
@rem move client.jar ..\..
@rem and cd back to the root directory
@rem cd ..\..

endlocal

clean.bat
@rem Clean up the build directory by deleting it.
rmdir/s/q build
client.bat
@rem Run the client application with arguments from the command line
java -Dserver.port=3001 -classpath build/classes;ext/hist.jar ...no break... javatech.all20.client.Client %*
server.bat

@rem Run the server
java -Dserver.port=3001 -classpath build/classes ...no break... javatech.all20.server.impl.ServerFactory

 

The hist.jar file in the ext/ subdirectory holds the class files described in Chapter 6: Tech : Histogrram Demo

These are used by the Client class here to display the output of the simulation.

Most recent update: Oct. 14, 2005

  
  Part I Part II Part III
Java Core 1  2  3  4  5  6  7  8  9  10  11  12 13 14 15 16 17
18 19 20
21
22 23 24
Supplements

1  2  3  4  5  6  7  8  9  10  11  12

Tech 1  2  3  4  5  6  7  8  9  10  11  12
Physics 1  2  3  4  5  6  7  8  9  10  11  12

Java is a trademark of Sun Microsystems, Inc.