Results 1 to 11 of 11
  1. #1
    Petee is offline Member
    Join Date
    Sep 2011
    Posts
    10
    Rep Power
    0

    Default How to run my program?

    So I have just started java about 2 days ago and i have started making my first real application. I have started making a calculator and it is not yet complete, you can only do + and only 2 numbers, e.g. 50+50 not 50+50+50. So anyway, I have saved it as a .java file, compiled it into a .class file and now I'm guessing because you cant open .class files I have to make some sort of .exe file to run it? I honestly have no idea what to do. :(

    I have used eclipse to type the code and run it to see if it works, then copy and pasted it into notepad++ to save as a .java file. Then I installed something from java website to let me compile things in cmd.

  2. #2
    DIego912 is offline Member
    Join Date
    Sep 2011
    Posts
    20
    Rep Power
    0

    Default Re: How to run my program?

    Run it with Eclipse IDE !

  3. #3
    Petee is offline Member
    Join Date
    Sep 2011
    Posts
    10
    Rep Power
    0

    Default Re: How to run my program?

    um... i have eclipse ide...

  4. #4
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default Re: How to run my program?

    In eclipse there should be a run button, it looks like a play button. However; you will need to write a main method which the compiler searches for before running anything.

  5. #5
    Petee is offline Member
    Join Date
    Sep 2011
    Posts
    10
    Rep Power
    0

    Default Re: How to run my program?

    I don't think you guys read my entire post, I HAVE run it with eclipse, and i HAVE compiled it into a .class file, I want to know HOW TO RUN IT without ECLIPSE. If you understand me now...

  6. #6
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default Re: How to run my program?

    You mean through cmd? Or a clickable file? If you want a clickable file, you need to create a executable jar file, google can help you here. If you mean through cmd, open cmd, cd to file location and type "java filename" with no extension. If the file is HelloWorld.class, type
    Java Code:
    java HelloWorld

  7. #7
    Petee is offline Member
    Join Date
    Sep 2011
    Posts
    10
    Rep Power
    0

    Default Re: How to run my program?

    yes I want a clickable file. I searched on google and found nothing :(

  8. #8
    Petee is offline Member
    Join Date
    Sep 2011
    Posts
    10
    Rep Power
    0

    Default Re: How to run my program?

    cant anyone help?

  9. #9
    Iron Lion is offline Senior Member
    Join Date
    Nov 2010
    Posts
    210
    Rep Power
    4

  10. #10
    Solarsonic is offline Senior Member
    Join Date
    Mar 2011
    Posts
    261
    Rep Power
    4

    Default Re: How to run my program?

    Follow this guide. JAR's are Java's version of EXE's.

  11. #11
    jammas615 is offline Senior Member
    Join Date
    Jul 2011
    Location
    Melbourne, Victoria, Australia
    Posts
    155
    Rep Power
    4

    Default Re: How to run my program?

    Eclipse can export your project into a .jar very quickly and easily.
    To make a .jar:
    1. Go File -> Export
    2. In the export window, find Java and click the plus next to it.
    3. Now select 'Runnable Jar' and click next
    4. For launch configuration, select your project from the 'Launch configuration dropdown and make your export destination where you want your .jar file to be placed
    5. Make sure 'Extract required libraries' is selected and click Finish (if you get a warning just click ok)

Similar Threads

  1. Replies: 2
    Last Post: 04-02-2011, 12:57 PM
  2. Replies: 13
    Last Post: 03-22-2011, 06:49 AM
  3. changing my program to array working program
    By Chewart in forum New To Java
    Replies: 39
    Last Post: 11-18-2009, 06:53 PM
  4. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 09:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •