Seeking Advice

Discussion in 'Java' started by Rahul Sharma, Sep 2, 2006.

  1. Rahul Sharma

    Rahul Sharma Guest

    I am new to java though I do have the basic knowledge.
    How should I apporach.

    I have one question too.

    I am working on the client server application using RMI concept
    developed in java. When I tried to make a jar file
    of my application ,though the jar file was made but double clicking it
    on the windows platform
    did not executed my application. Told me could not find main class
    though I had specified the main class the text file and used in
    developing the jar file.
    What could be the problem?

    Also send me good
    links so that I can study java in depth.
     
    Rahul Sharma, Sep 2, 2006
    #1
    1. Advertising

  2. Rahul Sharma wrote:
    > I am new to java though I do have the basic knowledge.
    > How should I apporach.
    >
    > I have one question too.


    Just one? ( famous last words ;)

    > I am working on the client server application using RMI concept
    > developed in java. When I tried to make a jar file
    > of my application ,though the jar file was made but double clicking it
    > on the windows platform
    > did not executed my application. Told me could not find main class


    The exact and specific message being what?
    (please quote error messages word for word -
    copy/paste is best)

    > though I had specified the main class the text file and used in
    > developing the jar file.
    > What could be the problem?


    Lack of a blank line at the end of the manifest file
    (+ a score of other things)

    Andrew T.
     
    Andrew Thompson, Sep 2, 2006
    #2
    1. Advertising

  3. Rahul Sharma wrote:

    Sub: Seeking Advice

    Oh, before I forget. The reason I repsonded to your
    post originally was to point out that 'Seeking Advice'
    is a poor title for a post.

    People start threads on these groups for a number
    of basic reasons. They might be ..
    - Seeking advice
    - Starting a discussion (which is often a troll, or an advocacy
    matter)
    - Promoting a product/project or job they have.

    The vast majority are the first category, so it is best for
    posts that are 'Seeking Advice' to be more specific
    what they want advice on - to attract the attention of the
    people who can answer the question.

    In this case, a Subject line of 'Jar - main class not found'
    might be good.

    Andrew T.
     
    Andrew Thompson, Sep 2, 2006
    #3
  4. Rahul Sharma

    Rahul Sharma Guest

    Thanks for your response.

    Andrew Thompson


    Now please disscuss how can i solve this problem.


    Waiting for your response.
     
    Rahul Sharma, Sep 2, 2006
    #4
  5. Rahul Sharma

    Rahul Sharma Guest

    Re: developing jar file

    the exact error msg is

    could not find main class program will exit
     
    Rahul Sharma, Sep 2, 2006
    #5
  6. Rahul Sharma wrote:
    > Thanks for your response.


    You are welcome.

    > Now please disscuss how can i solve this problem.


    I did that on my first post. There was a question, as
    well as one possible reason your Jar does not work
    as you expect.

    > Waiting for your response.


    (my advice) Be patient, read replies carefully, and
    answer whatever questions are asked.

    Andrew T.
     
    Andrew Thompson, Sep 2, 2006
    #6
  7. Re: developing jar file

    Rahul Sharma schrieb:
    > the exact error msg is
    >
    > could not find main class program will exit
    >


    Make sure that there's a Main-Class entry in the JAR file's manifest.
    Also ensure that this entry contains a fully qualified class name and
    that the appropriate class file exists within the jar.

    Bye
    Michael
     
    Michael Rauscher, Sep 2, 2006
    #7
  8. Rahul Sharma

    Guest

    Hi Rahul,

    I try to solve all my problems by creating an ant
    (ant.apache.org/manual/index.html) build file. I always do a full build
    by cleaning up the old classes directory and then compile everything
    fresh. One of my ant targets is mainly a jar task as shown below. The
    ant jar task will ensure your manifest works. Having a consistent build
    script that comunicates how the build is to be done each and every time
    is a great thing to do and is well worth the time.

    <jar destfile="${jar.dir}/myjar.jar" basedir="./classes">
    <manifest>
    <attribute name="Built-By" value="${user.name}" />
    <attribute name="Main-Class" value="my.path.MyMainApp" />
    <attribute name="Class-Path" value="." />
    </manifest>
    </jar>

    Cheers,

    Dan Andrews

    - - - - - - - - - - - - - - - - - - - - - - - -
    Ansir Development Limited www.ansir.ca
    - - - - - - - - - - - - - - - - - - - - - - - -

    Rahul Sharma wrote:
    > I am new to java though I do have the basic knowledge.
    > How should I apporach.
    >
    > I have one question too.
    >
    > I am working on the client server application using RMI concept
    > developed in java. When I tried to make a jar file
    > of my application ,though the jar file was made but double clicking it
    > on the windows platform
    > did not executed my application. Told me could not find main class
    > though I had specified the main class the text file and used in
    > developing the jar file.
    > What could be the problem?
    >
    > Also send me good
    > links so that I can study java in depth.
     
    , Sep 2, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bill
    Replies:
    3
    Views:
    695
  2. iksrazal
    Replies:
    2
    Views:
    357
    enrique
    Apr 27, 2005
  3. Steve W. Jackson

    Seeking class hierarchy advice

    Steve W. Jackson, Apr 26, 2006, in forum: Java
    Replies:
    1
    Views:
    286
    Chris Uppal
    Apr 27, 2006
  4. Dave
    Replies:
    2
    Views:
    381
    David Harmon
    Apr 13, 2004
  5. Eric
    Replies:
    0
    Views:
    303
Loading...

Share This Page