Running a java applet from netbeans?

爱⌒轻易说出口 提交于 2019-12-17 20:19:35

问题


I am trying to run a Java applet from NetBeans, and in trying to run it, I get a 'main class not found' error. I can avoid this by doing SHIFT+F6, but that'll only work if I am currently writing in the main class. I will be working on a somewhat large project, and it's going to have multiple files, and eventually it will be quite cumbersome to always navigate back to the main class to the 'main' file and run it from there. Is there any sort of configurations I can edit to tell NetBeans that I want to run my project (not the individual file) as an applet? I have NetBeans set up from this tutorial.


回答1:


In netbeans, right click on the project and chose properties. Under Application > Webstart, there is an option Applet class. specify the full path to your main class (i.e with package names).




回答2:


Step 1:

Step 2:

Press Shift + F6 to run applet.




回答3:


This are the <applet> parameters that worked for me:

<applet codebase="../../build/classes/" code="_package_/_JApplet_.class" width="500" height="500></applet>

*Replace _package_ and _JApplet_ with your package and applet class.



来源:https://stackoverflow.com/questions/7054382/running-a-java-applet-from-netbeans

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