简体   繁体   English

无法读取 AppletViewer 属性文件 - Applet

[英]Can't read AppletViewer properties file - Applet

I created a Java applet program and compiled it.我创建了一个 Java 小程序并编译了它。 As a result of the compilation, it generated a class file.作为编译的结果,它生成了一个class文件。 But, it showed the following warning message while running the applet with the command prompt using the appletviewer command.但是,它在使用appletviewer命令通过命令提示符运行小程序时显示以下警告消息。

D:\Applets\Applets>appletviewer FirstApplet.java

Warning: Can't read AppletViewer properties file: C:eswaran_s.VMSPL\.hotjava\properties Using defaults.

When I run this command once again, it does not show the warning message, but the applet is not running.当我再次运行此命令时,它没有显示警告消息,但小程序没有运行。

How can I solve this issue?我该如何解决这个问题?

My solution to this problem was to simply (in Eclipse) go to Run-> Run configurations... and open the JRE card where I set Java SE to a newer installed version. 我解决这个问题的方法是简单地(在Eclipse中)转到Run-> Run configurations ...并打开JRE卡,我将Java SE设置为更新的安装版本。 (in my case from SE 6 to SE 7) (在我的情况下从SE 6到SE 7)

The file .appletviewer should be in your home folder. 文件.appletviewer应该在您的主文件夹中。 If it's not exist then default file is created. 如果它不存在则创建默认文件。 You can also place it in the %USERPROFILE%\\.hotjava\\properties . 您也可以将它放在%USERPROFILE%\\.hotjava\\properties

If you run appletviewer it runs because you got any message from it. 如果您运行appletviewer它会运行,因为您收到了任何消息。 Suppose your instance is created on the %PATH% . 假设您的实例是在%PATH%上创建的。 But to run properly you should supply the argument text file that contains deprecated <APPLET> tag. 但要正常运行,您应该提供包含不推荐的<APPLET>标记的参数文本文件。 It doesn't matter what extension it has. 它有什么扩展并不重要。

Your extension is wrong. 你的扩展是错误的。 You should pass HTML file path like this: 您应该像这样传递HTML文件路径:

D:\Applets\Applets>appletviewer htmlfile_name.html 

Instead of this: 而不是这个:

D:\Applets\Applets>appletviewer FirstApplet.java 

It is often very difficult to write, compile and run applets in the applet viewer from the command prompt. 从命令提示符处编写,编译和运行applet查看器中的applet通常非常困难。 A better way would be to download the program Eclipse from the Internet. 更好的方法是从Internet下载Eclipse程序。 I often got lots of errors when trying to run programs from the command prompt, and Eclipse automaticly compiles, emphasises special words (like new, break, byte, short etc.) and even error checks your code (it underlines errors with a squiggly red line like Microsoft word's spellcheck). 尝试从命令提示符运行程序时,我经常遇到很多错误,Eclipse会自动编译,强调特殊字(如new,break,byte,short等)甚至错误检查你的代码(它强调错误的波浪形红色像Microsoft Word的拼写检查一样。 All my problems have been solved! 我所有的问题都解决了! I seriously recommend downloading it. 我认真推荐下载它。

i think your jdk miss some package or loss path so re-installed jdk latest version and run your program. 我认为你的jdk错过了一些软件包或丢失路径,所以重新安装了jdk最新版本并运行你的程序。 and check your htm program is correct or not may be some time occurred due to wrong htm program. 并检查你的htm程序是否正确可能是由于错误的htm程序发生了一段时间。

I had the same problem following the instructions for a similar tutorial from Oracle's Java: A Beginner's Guide - Sixth Edition (pg 515). 我按照Oracle Java的类似教程的说明遇到了同样的问题:初学者指南 - 第六版(第515页)。 The directions tell you to immediately run the .java file with the applet viewer. 方向告诉您立即使用applet viewer运行.java文件。 However, you must first compile it. 但是,您必须先编译它。 So, C:>javac FirstApplet.java. 所以,C:> javac FirstApplet.java。 This will compile the program and create your FirstApplet class file, which is what is currently missing from your execution. 这将编译程序并创建您的FirstApplet类文件,这是您执行时当前缺少的。 Then, C:>appletviewer FirstApplet.java. 然后,C:> appletviewer FirstApplet.java。 Your applet should run fine. 你的小程序应该运行正常。 Seems odd that the tutorial would leave out this instruction. 似乎奇怪的是教程会遗漏这条指令。

向RAB教授破解代码(大多数浏览器都弃用了Applet)

First, make sure you have the javadoc folder (simply labelled "doc" once extracted) inside your jdk folder as advised here: 首先,确保你的jdk文件夹中有一个javadoc文件夹(简单地标记为“doc”),如下所示:

http://www.jcreator.com/installation.htm http://www.jcreator.com/installation.htm

You can download the doc file from here for Java SE 8: 您可以从此处下载适用于Java SE 8的doc文件:

http://www.oracle.com/technetwork/java/javase/documentation/jdk8-doc-downloads-2133158.html http://www.oracle.com/technetwork/java/javase/documentation/jdk8-doc-downloads-2133158.html

Make sure you build the project first before running it (Menu/Build/Build Project). 确保在运行之前先构建项目(Menu / Build / Build Project)。

Now run your project. 现在运行你的项目。

如果您使用命令行运行文件,请在导入包后使用此特定行。

/*<applet code = "Class_name.class" width=300 height=250></applet>*/

我已在提示中更改此行并准备好:

D:\Applets\Applets>appletviewer FirstApplet.java 

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

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