Eclipse "This selection cannot be launched and there are no recent launches" 处理错误

Eclipse "This selection cannot be launched and there are no recent launches" processing error

我一直在尝试通过下载处理并使用 eclipse 运行在 eclipse 中进行处理。每次我尝试 运行 它说的任何东西时 "This selection cannot be launched and there are no recent launches" 我四处寻找同样的问题,但 none 其中的问题是用于处理的,而且大部分只是用于默认 java 或 android 我尝试进行 运行 配置,但无济于事。 代码

import processing.core.PApplet;
import processing.core.PImage;


public class processing extends PApplet
{
PImage background;
PImage paddleImage;

public void setup()
{
    size(800, 600);
    background = loadImage("background.png");
    paddleImage = loadImage("paddle.png");
}
public void draw()
{
    background(background);
}
public class Paddle
{
    PImage sprite;
    float xPos;
    float yPos;

    public Paddle(PImage paddleSprite, float xStart, float yStart)
    {
        sprite = paddleSprite;
        xPos = xStart;
        yPos = yStart;
    }
}
}

如果您 运行 在 eclipse 中,则需要 main() 方法。

public static void main(String... args){
    String[] pArgs = {"MySketch"};
    MySketch mySketch = new MySketch();
    PApplet.runSketch(pArgs, mySketch);
}

此代码假设您有一个名为 MySketch 的 class 扩展 PApplet.