Results 1 to 8 of 8
- 02-14-2013, 05:49 PM #1
Member
- Join Date
- Feb 2013
- Posts
- 5
- Rep Power
- 0
Confused - Trying to Run .java file in Eclipse
New to this IDE. I created a simple class and method in Eclipse. When I click on the file, Eclipse launches, and then brings up my source code. When I go to click run, I have two "Ant Build" options, but no matter which one I choose, an error comes up saying "unable to find ant file to run."
What is the process for compiling and running console programs?
- 02-14-2013, 05:53 PM #2
Re: Confused - Trying to Run .java file in Eclipse
How are you running this? Do you have a Java project set up? You should be able to click the run dropdown, then click run as, then click application.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 02-14-2013, 05:54 PM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Confused - Trying to Run .java file in Eclipse
Right click on the actual class you want to run and select Run As-> Java Application.
This tells Eclipse what your main class is.
It should then appear as an option in the run button drop down.Please do not ask for code as refusal often offends.
- 02-14-2013, 06:49 PM #4
Member
- Join Date
- Feb 2013
- Posts
- 5
- Rep Power
- 0
- 02-14-2013, 06:56 PM #5
Member
- Join Date
- Feb 2013
- Posts
- 5
- Rep Power
- 0
- 02-14-2013, 07:34 PM #6
Re: Confused - Trying to Run .java file in Eclipse
I'm pretty sure you need to create a project before you can run a file.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 02-15-2013, 09:26 AM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Confused - Trying to Run .java file in Eclipse
Yep.
Eclipse needs a project so it knows where to compile stuff to etc etc.Please do not ask for code as refusal often offends.
- 02-16-2013, 12:48 AM #8
Senior Member
- Join Date
- Jan 2013
- Location
- United States
- Posts
- 702
- Rep Power
- 1
Re: Confused - Trying to Run .java file in Eclipse
Yes. I have been using Eclipse for years. Just create a project. A simple skeletal Java file will be created for you. Just edit it as needed. Every time you save the file, the file will be compiled automatically. Then just left click the green arrow on the menu bar to run the program. Only in special situations do you need an ant file. I have hundreds of projects and only one ant file.
Recommend you check out the Eclipse tutorials under the getting started section.
Good luck!
Jim
Similar Threads
-
Eclipse / JPA and SaxParser - confused
By alexandra12 in forum EclipseReplies: 0Last Post: 08-05-2012, 02:10 AM -
Debugging .sh file running java code in Eclipse IDE (Helios 3.6)
By ArunJava in forum EclipseReplies: 0Last Post: 09-09-2011, 11:04 AM -
Confused about File Input and Output Assignment
By rugger06 in forum New To JavaReplies: 2Last Post: 04-17-2011, 02:10 AM -
Using a text file in Eclipse...I'm confused
By raindog308 in forum EclipseReplies: 1Last Post: 01-18-2011, 02:34 AM -
Error while executing java file in eclipse
By kutty in forum New To JavaReplies: 0Last Post: 10-20-2010, 01:14 PM


LinkBack URL
About LinkBacks
Reply With Quote


Bookmarks