简体   繁体   中英

Eclipse: No Java-Application

I read that problem already sometimes here but no of these could help me so i decided just to ask now. I'm learning java ath the moment and i had this:

import java.util.Scanner;

public class Divisionberechnung 
{
public static void main (String[] args)
{
    Scanner scan = new Scanner (System.in);

    int dividend, divisor ;
    int quotient, rest ;

    System.out.println("Dividend eingeben:");
    dividend = scan.nextInt();

    System.out.println("Divisor eingeben:");
    divisor = scan.nextInt();

    quotient = dividend / divisor;
    rest = dividend % divisor;

    System.out.println( dividend + " / " + divisor + " ist " + quotient );
    System.out.println( dividend + " % " + divisor + " ist " + rest );
    System.out.println( quotient + " * " + divisor + " + " + rest + " ist " +      (quotient*divisor+rest));    
}

}

When i started Eclipse and just began to write this and ended it runned normal and worked. But when i closed Eclipse and opened that file again i couldn't choose run as Java Apllication anymore. When i click on Run there just appears a window where i can choose between two "Ant Builds". But No Java Apllication? Where is the problem?

You can try and add a new run configuration: Run -> Run Configurations ... -> Select "Java Appliction" and click "New".

Alternatively use the shortcut: place the cursor in the class, then press Alt + Shift + X to open up a context menu, then press J.

Go to Run -> run Configurations -> Double Click Java Application -> New Configuration

Make sure that your project name and main class name appears correctly and click run.

From Next time when you will do Run , it will pick this last used configuration.

Here is how you change your view and Prespective , In your case you Will want to choose "JAVA" And "! Console"

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM