Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Fighting with Eclipse

Credits go to amarillion, Archon, Crazy Photon, Hard Rock, Johan Henriksson, nonnus29, and Steve++ for helping out!
This thread is locked; no one can reply to it. rss feed Print
Fighting with Eclipse
FMC
Member #4,431
March 2004
avatar

I'm having a hard time making Eclipse run a java project.
In my workspace directory i have the following directories: projects\diadia\diadia_1_1\

Inside diadia_1_1 is the source code of the project, each file starting with the appropriate package projects.diadia.diadia_1_1;

What i do is:
new-> Java-Project
Create from existing source (i give it the projects directory)
Project name: projects
[Finish]

When i try to run, by right-clicking and selecting run, the class file with the main method i get: "Launch error: selection does not contain a main type".

This must be something really stupid on my part, as i'm totally new to eclipse.
Any help is welcome.

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

Archon
Member #4,195
January 2004
avatar

With Eclipse, I believe that you have to set up "execution" settings.

You can have multiple projects open at the same time after all.

Johan Henriksson
Member #11
April 2000
avatar

right click on class file? .class? you should right-click the corresponding .java. you can also open up the run dialog. it says there which class contains the entry point in case it's wrong.

nonnus29
Member #2,606
August 2002
avatar

Quote:

Fighting with Eclipse

Use Netbeans.

I'm joking (mostly). I don't think I've ever gotten the 'create project from existing source' to work in any ide I've use. The last one I did I cut an pasted every source file into a new file in the ide.

:-/

amarillion
Member #940
January 2001
avatar

Archon is right, you have to tell eclipse how you want the project to be executed in the Run Dialog.

I the latest version of eclipse, if you have the java file containing the main method opened in front of you and you press the run button (green arrow in the toolbar), it will automatically create a configuration that is correct most of the time.

Steve++
Member #1,816
January 2002

Quote:

Use Netbeans.

I'm joking (mostly).

Actually, Netbeans 6 is much more user freindly than eclipse. And you won't have the same trouble running your projects. Code completion is much, much better than Eclipse, IntelliJ IDEA and previous Netbeans versions. The base Java SE IDE is only a 21MB, with the full version being 169MB. Unless you're doing any Java EE stuff, the base IDE is fine.

FMC
Member #4,431
March 2004
avatar

amarillion said:

I the latest version of eclipse, if you have the java file containing the main method opened in front of you and you press the run button (green arrow in the toolbar), it will automatically create a configuration that is correct most of the time.

Nope, still complains about missing main

Btw if i run it manually, it works:

javac projects\diadia\diadia_1_1*.java
java projects.diadia.diadia_1_1.Gioco

Steve++ said:

Actually, Netbeans 6 is much more user freindly than eclipse. And you won't have the same trouble running your projects. Code completion is much, much better than Eclipse, IntelliJ IDEA and previous Netbeans versions. The base Java SE IDE is only a 21MB, with the full version being 169MB. Unless you're doing any Java EE stuff, the base IDE is fine.

Might decide to use it, but i hate to leave unfinished business ;)

nonnus29 said:

I'm joking (mostly). I don't think I've ever gotten the 'create project from existing source' to work in any ide I've use. The last one I did I cut an pasted every source file into a new file in the ide.

Actually the first time i tried to run it, it worked! :P Never been able to repeat the miracle, though...

Johan said:

right click on class file? .class? you should right-click the corresponding .java. you can also open up the run dialog. it says there which class contains the entry point in case it's wrong.

There is no configured file in the run dialog... just the one i created (and isn't working).

Quote:

With Eclipse, I believe that you have to set up "execution" settings.

Any ideas how? :)

I attached a little video of what i tried, a picture is worth 1000 words afterall...
VIDEO

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

Hard Rock
Member #1,547
September 2001
avatar

Quote:

Actually, Netbeans 6 is much more user freindly than eclipse. And you won't have the same trouble running your projects. Code completion is much, much better than Eclipse, IntelliJ IDEA and previous Netbeans versions. The base Java SE IDE is only a 21MB, with the full version being 169MB. Unless you're doing any Java EE stuff, the base IDE is fine.

I found Eclipse's code completion to be pretty much spot on. I've had trouble with Visual Studio's code completion for C# in a few specific cases, but off the top of my head Eclipse has been excellent for me, I can't remember it failing in that respect. So I'm not really sure how Netbean's code completion could be much better. I do remember the auto generated Swing UI code being hideous in comparison to Eclipse's plugins which sucked equally, but that may have changed in the current version?

That and the new Netbeans seems to be a much bigger memory hog then Eclipse now. But it does have rails support so it's the new IDE I'm going to be trying for now since Rails desperately needs a kick ass IDE (I've had some problems with Netbeans and rails, nothing major though, and I haven't used it long enough to say for sure.)

_________________________________________________
Hard Rock
[ Stars Dev Company ][ Twitter ][Global Warming: ARA My TINS 07 Entry][Pong Ultra Website][GifAllegS Ver 1.07]
"Well there's also coolwebsearch but we'll let that be an IE exclusive feature" - arielb on the New Browser Plugins "What's better, HTML or Variables?"

nonnus29
Member #2,606
August 2002
avatar

Quote:

Rails

You should try Groovy and Grails; the biggest obstacle for RoR is scalability. With Grails you can deploy you application as a .war file to any J2EE server. Instant scalability.

Crazy Photon
Member #2,588
July 2002
avatar

From the video I noticed that you don't have your build path set up correctly, as the packages appear as folders and the classes as just plain Java files, try to configure the build path so that the root folder of the project is considered as a source folder.

-----
Resistance is NEVER futile...

FMC
Member #4,431
March 2004
avatar

Crazy Photon said:

From the video I noticed that you don't have your build path set up correctly, as the packages appear as folders and the classes as just plain Java files, try to configure the build path so that the root folder of the project is considered as a source folder.

Yep, you are right.

I managed to make it work, do you know how? I had to create an empty project and then import the new stuff... stupid Eclipse. :P

Cookies for moral support and help.

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

Go to: