Fighting with Eclipse
FMC

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.

Archon

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

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
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

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++
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
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

Hard Rock
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.)

nonnus29
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

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.

FMC
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.

Thread #594728. Printed from Allegro.cc