• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to create/run client.jar

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having trouble creating ad runnning the client.jar. How should I get it right.
Here is my directory structure:-
c:\suncertify\client
All the client classes have package statement as :-
package suncertify.client;
I can run my client as :-
cd c:\suncertify\client
set classpath=c:\;
suncertify.client.FBNClient hostname portnumber
This is what I do to create jar file
Manifest file:-
Manifest-Version: 1.0
Created-By: 1.2.2 (Sun Microsystems Inc.)
Main-Class: suncertify.client.FBNClient
I create jar file as:-
cd \
<c:\> jar -cvfm client.jar suncertify\client\manifest.mf suncertify\client\*.class
Then I run it as :-
java -jar client.jar hostname portnumber
This gives me a nullpointer exception.
So what am I doing wrong??
Thanks.
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Samuel,
normally NullPointerExceptions have nothing to do with the .jar file but with your code. Try to find out where the NullPointerException acutally occurrs.
When something is wrong with the .jar, you usually get exceptions like FileNotFound or Zip...
[ September 05, 2002: Message edited by: Mag Hoehme ]
 
Samual Harvey
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Initially when I was creating the jar file using the command:-
<c:>jar cvfm client.jar c:\suncertify\client\manifest.mf c:\suncertify\client\*.class
I was getting FileNotFoundException.
SO I changed c:\suncertify to suncertify\. But this started giving NullPOinterr...
But at the same time when I run the same using the class name directly it works. Why it does not gives me a Null Pointer exception there?
Thanks.
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Samual,
Do you have your Main-Class set in the manifest? Once I created my jar files, I just used Enzip to reload the packages and left the mainfest directory alone. Any zip program will work.
Michael Morris
 
Samual Harvey
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it is working now. I tested on different machines. Also on JRE it works.
One question:-
Right now I am building jar file using all the client/server/db classes. What is the better way to distribute the files.
This is what I tried keeping db common in both client and server. But then the client complains about the stub file. I know there is a way to resolve the problem of stub file. I guess RMI allows the client to download the stub files from the server . I just dont remember how to do this.
Thanks.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Samual,


Right now I am building jar file using all the client/server/db classes. What is the better way to distribute the files.


That's what I did. Simple and no headaches or worrying if a stub is going to properly load.
Michael Morris
 
Samual Harvey
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Morris:

That's what I did. Simple and no headaches or worrying if a stub is going to properly load.
Michael Morris


How many jar files did u created. I mean if you are keeping all the directories in one jar file then you don't need multiple jar files. Did u created one for server and one for client?
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Samual,


... I mean if you are keeping all the directories in one jar file then you don't need multiple jar files.


Yes, but you can only have one main class per executable jar file. So you really need two jars: 1 client and 1 server.


Did u created one for server and one for client?


I had one for the client and one for the server. They were both placed in the submission jar.
Michael Morris
 
Uh oh, we're definitely being carded. Here, show him this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic