• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX:URLyBird One or two runme.jar

 
Leo Tien
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my assignment , it saids "The executable JAR containing the programs.This must be called runme.jar." Whether this means only have one runme.jar , but the project contains three parts: client, server and db. How can run the server if i use runme.jar to execute client application?
And, how can i build this executable JAR file?
Help me, thanks.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Leo
All the classes you create will be in the one jar file named runme.jar. The user selects what mode to run it in by using a parameter on the command line:
  • java -jar runme.jar - the client starts up in networked mode
  • java -jar runme.jar alone - the client starts up in non networked mode
  • java -jar runme.jar server - the server starts up


  • You should look at the Sun Jar tutorial.
    On this page you will find information on how to create a jar file, and how to make an executable jar file.
    Regards, Andrew
     
    Leo Tien
    Ranch Hand
    Posts: 156
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks,Andrew. I see!
     
    peter mosor
    Greenhorn
    Posts: 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    hy there
    how do I create a manifest file for that?
    the manifest file must it have 2 main class declartions, one for
    the server process and the other for the client process?
    if you run: java -jar runme.jar server - the server starts up
    then the server process starts and the main class is, let's say
    'Server.class'
    does the manifest file has to know the different parameters
    'alone','server', etc..
    and if yes how do you declare it then ?

    peter
     
    Philippe Maquet
    Bartender
    Posts: 1872
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Peter,
    Welcome to this forum.
    You need only one main class. This will receive all possible command-line arguments ("server", "alone", or none). Depending on the received command-line arg, your unique main method will instantiate a server app, a client app or a stand-alone app.
    Best,
    Phil.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic