run configurations错误

  1. 要想运行java application(即运行java 项目),必须要有入口方法(即main方法)

  2. main方法的参数也要写对,不然,右键——》运行里也看不到java application



举例,

package net.caokou;

public class PingPong extends Thread{
	private String word;
	private int delay;
	
	public PingPong(String whatToSay, int delayTime)
	{
		word = whatToSay;
		delay = delayTime;
	}
	
	public void run()
	{
		try
		{
			for(;;)
			{
				System.out.println(this + ":  " + Thread.currentThread());
				System.out.print(word + " ");
				Thread.sleep(delay);
			}
		}
		catch(InterruptedException e)
		{
			return;
		}
	}
	
	public static void main(String[] args)
	{
		new PingPong("ping",33).start();
		new PingPong("PONG",100).start();
	}
}




----------------

参考:

1.java用eclipse写完后run里面只有run configurations

你可能感兴趣的:(run configurations错误)