Can I make .class files run like executable .jar files on a Windows platform?

Discussion in 'Java' started by phillipedison1891@yahoo.com, Mar 9, 2005.

  1. Guest

    I have a friend who likes to send his Java creations to me by e-mail in
    ..class form. One problem, though: When I go to the command prompt and
    type in java sampleProgram.class, it gives me a "NoClassDefFoundError".
    I don't want to have to recompile the source code with NetBeans. How
    can I make the source code run?
    , Mar 9, 2005
    #1
    1. Advertising

  2. Malte Guest

    Re: Can I make .class files run like executable .jar files on a Windowsplatform?

    wrote:
    > I have a friend who likes to send his Java creations to me by e-mail in
    > .class form. One problem, though: When I go to the command prompt and
    > type in java sampleProgram.class, it gives me a "NoClassDefFoundError".
    > I don't want to have to recompile the source code with NetBeans. How
    > can I make the source code run?
    >


    Try to leave out the .class part.
    Malte, Mar 9, 2005
    #2
    1. Advertising

  3. You usually will type in

    % java sampleProgram

    If the file is called sampleProgram.class that he sent you. You should
    not append .class to the end of the 'java' command.
    Collin VanDyck, Mar 9, 2005
    #3
  4. Malte Guest

    Re: Can I make .class files run like executable .jar files on a Windowsplatform?

    wrote:
    > I have a friend who likes to send his Java creations to me by e-mail in
    > .class form. One problem, though: When I go to the command prompt and
    > type in java sampleProgram.class, it gives me a "NoClassDefFoundError".
    > I don't want to have to recompile the source code with NetBeans. How
    > can I make the source code run?
    >


    Tell your friend that convention suggests that class names be written
    with the first letter capitalized: SampleProgram rather than sampleProgram.

    Not that it solves your problem, of course.
    Malte, Mar 9, 2005
    #4
    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. cyril
    Replies:
    2
    Views:
    3,857
    cyril
    Aug 25, 2004
  2. kamal
    Replies:
    0
    Views:
    406
    kamal
    Mar 10, 2005
  3. cyberco
    Replies:
    4
    Views:
    3,748
    Roedy Green
    Feb 14, 2006
  4. Replies:
    15
    Views:
    483
    Dave Thompson
    Aug 21, 2006
  5. Jason Cavett
    Replies:
    8
    Views:
    616
    Sanjay
    May 16, 2007
Loading...

Share This Page