如何从另一个.jar文件调用paint类

时间:2014-02-17 14:35:49

标签: java eclipse paint

我在Eclipse中创建了一个.jar文件来调用paint类。当我完成它给我一个错误:

JAR export finished with warnings. See details for additional information.
  Exported with compile warnings: Graphics/src/G1.java
  Jar export finished with problems. See details for additional information.
    Could not find main method from given launch configuration.

以下是调用paint方法的代码:

public class G1Starter {
   public void main(String[] args)
   {
       Graphics1 g1 = new Graphics1();
       g1.repaint();
   }
}

我尝试在main课程中制作Graphics1方法但不起作用。

2 个答案:

答案 0 :(得分:3)

添加static关键字,以便应用程序具有有效的入口点

public static void main(String[] args) 

答案 1 :(得分:0)

方法'main'应为'static'

public static void main(String[] args)