简体   繁体   English

如何更新本地Java小程序以在浏览器中进行测试

[英]How to update a local java applet to test in browser

So I have this applet on my computer, and it runs fine on Eclipse. 因此,我在计算机上安装了这个applet,并且在Eclipse上运行良好。

This is someone else's project, and they created a webpage which runs the applet. 这是别人的项目,他们创建了一个运行小程序的网页。 I am trying to update the code to test it, I open the HTML page from my computer, which I am assuming loads the updated .java file? 我正在尝试更新代码以对其进行测试,因此我从计算机上打开了HTML页面,我假设该页面会加载更新的.java文件?

But this is not working, the loaded applet has not been updated. 但这不起作用,加载的小程序尚未更新。 Do I have to convert the .java file to something else for the browser to load it? 我是否需要将.java文件转换为其他文件以供浏览器加载? I am inexperienced with making java work with browsers. 我对使Java与浏览器一起使用没有经验。 And I already have a .html file which somehow loads, I have tried reading it but I don't see any code which calls myFile.java 而且我已经有一个.html文件,它以某种方式加载,我尝试读取它,但是没有看到任何代码调用myFile.java。

The html page does not load .java (java source code) file. html页面不会加载.java(java源代码)文件。 It loads a compiled java file. 它加载一个编译的Java文件。

After updating the .java file, export it with Export->Jar. 更新.java文件后,使用Export-> Jar将其导出。

Html file should have something like following. HTML文件应具有以下内容。

<applet code = 'AppletClassName' 
      archive = 'NameOfExportedJarFile.jar', 
      width = 500, 
      height = 500 />

See the answer by medopal in How to build a java applet? 请参阅“ 如何构建Java小程序”中 medopal的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM