关于java编程出现错误的问题,如何解决呢?

来源:百度知道 编辑:UC知道 时间:2024/06/05 22:56:26
我编写了一个calcutator的applet小程序,编译是通过了,但是运行的时候提示有错误,得不出正确的结果,没有出现小程序查看器,具体错误提示如下:
--------------------Configuration: <Default>--------------------
java.lang.NoSuchMethodError: main
Exception in thread "main"
Process completed.
这个问题应该如何解决呢?是不是关系到了环境变量的设置问题呢?
我用的是jcreator pro4.5版,并且我之前有尝试过重新安装jdk,但是在卸载java tm se development kit 6 update 11和java(tm) 6 update 11时提示click ok to try again,or enter an alternate path to a folder containing the installation package "jre.msi" in the box below.
另外这个程序也没有调用main方法,也生成了html文件。

。。。用的什么工具!??? myeclipse 出这个问题??还是你直接javac ***.java 编译的?

可能是你工具的问题 jcreator 好多年没用了
建议你还下 myeclipse 1.6 完整版吧 里面自带jdk

那你到底有没有 写 main方法呢?我郁闷了 纯粹的一个函数 或者一个类是执行不出什么东西的!! main是入口!

看看main方法

很明显 找不到main方法呀~~看看你程序的那个地方是不是调用了main

你创建html文件没?创建一个html文件,格式如下:
<applet code="**.class" width="600" height="400">
</applet>
之后你在命令提示符下打javac **.java
运行时后打appletviewer **.html就可以了!