Unable to compile / run in Eclipse-Java

I try to compile and run a simple program in Eclipse, and whenever I click run, it says that I need to choose what to run: and there is the possibility of creating two ant collections. I do not know what ant builds is or what to do it. When I try to start using ant build, it says: "Build failed: could not find the ant file to run." I have the latest version of java, and everything should work fine, but when I can never overcome the ant build problem.

Thanks for any advice!

+4
source share
3 answers

First, make sure you create a regular “Java Project”, and not something else.

If something is wrong with the build configuration, and I think there is, go to: Run> Run Configurations ... On the left you will see a list of configurations, make sure your configuration runs as a "Java application", if not, delete all configurations by selecting them, and then click Delete.

If everything is ok, your program should work fine

+4
source
  • Create a Java project from the menu: File> New> Java Project
    Only the project name is required (if necessary, you can configure all other parameters later).

  • Go to the new project and select the src folder.

  • New> Package

  • >
    : public static void main (...) runnable.

  • main(), :

    System.out.println( "HALLO" );

  • > Java

0

buildCommand nature .project . Java Nature, Java. Run As... .

<projectDescription>
    ...
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>
0

Source: https://habr.com/ru/post/1529695/


All Articles