Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Some wrong with "java -jar"

 
Dee RenJie
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to run my client with "java -jar client.jar"
run my server with "java -jar server.jar".
My class map is:
class
-client
-server
-db
-share
The db package and share package are both used by client and server. How should I package them?
jar -cvfm client.jar ClientManifest.mf client db share
jar -cvfm server.jar ServerManifest.mf server db share
Is is right? Can client.ajr and server.jar has the same contents of sahre package and db package.
some body help me!!
Thanks in advance!!
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12012
216
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dee,
Can client.ajr and server.jar has the same contents of sahre package and db package.
Yes they can have identical files in both jar files. This is probably the easiest solution for the examiner to operate with. I did the same for my assignment.
In real life (not the exam) you might want to think about having separate jar files for each package. So one jar file for the db package, another for the client, and so on. Then you can access them by setting your classpath correctly. The advantage this gives you is that if you need to send out an update to the GUI client, you only need to send one small jar file that is specific to the GUI, and not the huge jar file that has everything in it.
Regards, Andrew
 
Dee RenJie
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Andrew. But I still have some questions.
I defined a interface XXModel that defines all the public methods of Data.class. The server package has a class that implements that interface, the class is used in network mode.
and Data class in db package also implents that interface. But it only used by the client(in local mode). Is it appropriate if I package whole db pacage and server package into a jar file(server.jar). Do eliminate the Data.class and only contain the DataInfo.class,DatabaseEXception.class and FieldInfo.class?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12012
216
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dee,
If it is only one or two files in the server jar file that will not be used by the server code, then I dont think you should worry too much about it.
If you had an entire package that is not used, then that might be a different matter.
For the Fly By Night assignment, having an extra file in the server jar could only fall under general considerations. Even then it would require a fairly open category for the examiner to be able to deduct marks for it. I dont think we should get paranoid about what the examiner may deduct points for.
Regards, Andrew
 
Dee RenJie
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi AndRew!Thank you for your reply!
I have made the server.jar and client.jar.
But there is a error when I start the client in Network mode. The client can not find the XXXModelImpl_stub.class. This file is in the server package. What should I do???
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12012
216
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dee
Try putting the stub files into the client jar file. That way it will not need to dynamically load them.
Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic