Results 1 to 11 of 11
Thread: How to run my program?
- 10-01-2011, 05:37 AM #1
Member
- Join Date
- Sep 2011
- Posts
- 10
- Rep Power
- 0
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.
- 10-01-2011, 05:45 AM #2
Member
- Join Date
- Sep 2011
- Posts
- 20
- Rep Power
- 0
Re: How to run my program?
Run it with Eclipse IDE !
- 10-01-2011, 05:46 AM #3
Member
- Join Date
- Sep 2011
- Posts
- 10
- Rep Power
- 0
Re: How to run my program?
um... i have eclipse ide...
- 10-01-2011, 05:55 AM #4
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,068
- Blog Entries
- 3
- Rep Power
- 13
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.
- 10-01-2011, 05:57 AM #5
Member
- Join Date
- Sep 2011
- Posts
- 10
- Rep Power
- 0
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...
- 10-01-2011, 06:08 AM #6
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,068
- Blog Entries
- 3
- Rep Power
- 13
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
- 10-01-2011, 06:12 AM #7
Member
- Join Date
- Sep 2011
- Posts
- 10
- Rep Power
- 0
Re: How to run my program?
yes I want a clickable file. I searched on google and found nothing :(
- 10-01-2011, 01:21 PM #8
Member
- Join Date
- Sep 2011
- Posts
- 10
- Rep Power
- 0
Re: How to run my program?
cant anyone help?
- 10-01-2011, 01:24 PM #9
Senior Member
- Join Date
- Nov 2010
- Posts
- 210
- Rep Power
- 10
Re: How to run my program?
- 10-02-2011, 04:00 AM #10
Senior Member
- Join Date
- Mar 2011
- Posts
- 261
- Rep Power
- 9
- 10-02-2011, 04:46 AM #11
Senior Member
- Join Date
- Jul 2011
- Location
- Melbourne, Victoria, Australia
- Posts
- 155
- Rep Power
- 9
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
-
How to code a program to send messages to a chat program?
By josh2992 in forum New To JavaReplies: 2Last Post: 04-02-2011, 01:57 PM -
How would I open a program from a single button of another program. Help...
By decgaid06 in forum New To JavaReplies: 13Last Post: 03-22-2011, 07:49 AM -
changing my program to array working program
By Chewart in forum New To JavaReplies: 39Last Post: 11-18-2009, 07:53 PM -
How to execute an External Program through Java program
By Java Tip in forum java.ioReplies: 0Last Post: 04-04-2008, 03:40 PM -
How to execute an External Program through Java program
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 10:33 PM
Bookmarks