在 Eclipse 中导出 .jar Applet

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11354458/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:28:28  来源:igfitidea点击:

Exporting .jar Applet in Eclipse

javaeclipsejarapplet

提问by 36redsoxfan

I have an applet and I can't export it to a runnable jar because it doesn't have a main class( public static void main(String args[]) ) I need a runnable jar because I have a program that has many classes and packages. How do I make this work. If the answer is adding a main method what do I put in the main method?

我有一个小程序,我无法将它导出到可运行的 jar,因为它没有主类( public static void main(String args[]) )我需要一个可运行的 jar,因为我有一个包含许多类的程序和包裹。我如何使这项工作。如果答案是添加一个 main 方法,我在 main 方法中放什么?

UpdateI tried to use a normal .jar but still nothing. Here is a reply i sent to better describe what is happening

更新我尝试使用普通的 .jar 但仍然没有。这是我发送的回复以更好地描述正在发生的事情

"I still get the class not found error. I have a .jar that has a "main" folder. Then in the "main" folder I have all my classes. My main class is Render.class so in html i use this code to open the applet: "

“我仍然遇到找不到类的错误。我有一个 .jar 有一个“main”文件夹。然后在“main”文件夹中我有我所有的类。我的主类是 Render.class 所以在 html 中我使用这个代码打开小程序:“

回答by bmargulies

If it's an applet it isn't a 'runnable jar'. Luckily, you don't need one. You just need an ordinary jar. Eclipse will make one of those.

如果它是小程序,则它不是“可运行的 jar”。幸运的是,你不需要一个。你只需要一个普通的罐子。Eclipse 将成为其中之一。