Main method not found error in an applet

喜欢而已 提交于 2019-11-28 12:27:23

问题


At my school I am using Notepad++ to write an applet, and I need to package it in a jar so I can sign it. I am attempting to do this with a batch file like this:

CD C:\Users\name\Java\bin
javac className.java
jar cvfm className.jar Manifest.txt classFolder
java -jar className.jar
PAUSE

And then I get a main method not found exception. There is not much I can do in terms of debugging, or opening up my jar, because as I said before, it is at school and so much of the functionality is blocked. I can provide more details if needed, thanks.


回答1:


Applets don't have a main method, so you cannot run it in the conventional way with the java command.

To run the applet, create an HTML file with the applet in it, and run appletviewer or view the page in a web browser.




回答2:


You shouldn't run an applet that way. It's not an application to run via the java command, and usually doesn't have a main method (unless you're writing some dual-purpose program). Run it with HTML code. The applet tutorial will show you this, and surely you've read this already.



来源:https://stackoverflow.com/questions/19989318/main-method-not-found-error-in-an-applet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!