无法读取 AppletViewer 属性文件 - Applet
我创建了一个Java applet 程序并编译了它。编译的结果是生成一个class
文件。但是,在使用 appletviewer
命令通过命令提示符运行小程序时,它显示了以下警告消息。
D:\Applets\Applets>appletviewer FirstApplet.java
Warning: Can't read AppletViewer properties file: C:eswaran_s.VMSPL\.hotjava\properties Using defaults.
当我再次运行此命令时,它不会显示警告消息,但小程序未运行。
我该如何解决这个问题?
I created a Java applet program and compiled it. As a result of the compilation, it generated a class
file. But, it showed the following warning message while running the applet with the command prompt using the appletviewer
command.
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
我对这个问题的解决方案是简单地(在 Eclipse 中)转到 Run->运行配置...并打开 JRE 卡,我在其中将 Java SE 设置为较新的安装版本。 (就我而言,从 SE 6 到 SE 7)
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. (in my case from SE 6 to SE 7)
文件
.appletviewer
应位于您的主文件夹中。如果不存在则创建默认文件。您还可以将其放置在%USERPROFILE%\.hotjava\properties
中。如果您运行 appletviewer,它就会运行,因为您从中收到了任何消息。假设您的实例是在
%PATH%
上创建的。但为了正确运行,您应该提供包含已弃用的The file
.appletviewer
should be in your home folder. If it's not exist then default file is created. You can also place it in the%USERPROFILE%\.hotjava\properties
.If you run appletviewer it runs because you got any message from it. Suppose your instance is created on the
%PATH%
. But to run properly you should supply the argument text file that contains deprecated<APPLET>
tag. It doesn't matter what extension it has.你的扩展名是错误的。您应该像这样传递 HTML 文件路径:
而不是这样:
Your extension is wrong. You should pass HTML file path like this:
Instead of this:
从命令提示符在小程序查看器中编写、编译和运行小程序通常非常困难。更好的方法是从 Internet 下载 Eclipse 程序。当尝试从命令提示符运行程序时,我经常遇到很多错误,Eclipse 会自动编译、强调特殊单词(如 new、break、byte、short 等),甚至错误检查代码(它用波浪形的红色强调错误)像 Microsoft Word 的拼写检查一样的行)。我所有的问题都已经解决了!我强烈推荐下载它。
It is often very difficult to write, compile and run applets in the applet viewer from the command prompt. A better way would be to download the program Eclipse from the Internet. 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). All my problems have been solved! I seriously recommend downloading it.
我认为你的jdk错过了一些包或丢失路径,所以重新安装jdk最新版本并运行你的程序。并检查您的 htm 程序是否正确,有时可能是由于 htm 程序错误而发生的。
i think your jdk miss some package or loss path so re-installed jdk latest version and run your program. and check your htm program is correct or not may be some time occurred due to wrong htm program.
按照 Oracle 的 Java:初学者指南 - 第六版(第 515 页)中类似教程的说明,我遇到了同样的问题。说明告诉您立即使用小程序查看器运行 .java 文件。但是,您必须首先对其进行编译。因此,C:>javac FirstApplet.java。这将编译程序并创建 FirstApplet 类文件,这是当前执行中缺少的文件。然后,C:>appletviewer FirstApplet.java。您的小程序应该运行良好。教程省略了这条指令,这似乎很奇怪。
I had the same problem following the instructions for a similar tutorial from Oracle's Java: A Beginner's Guide - Sixth Edition (pg 515). The directions tell you to immediately run the .java file with the applet viewer. However, you must first compile it. So, C:>javac FirstApplet.java. This will compile the program and create your FirstApplet class file, which is what is currently missing from your execution. Then, C:>appletviewer FirstApplet.java. Your applet should run fine. Seems odd that the tutorial would leave out this instruction.
向 RAB 教授损坏的代码致敬(Applet 在大多数浏览器中已被弃用)
Shoutout to RAB teaching broken code (Applets have been deprecated in most browsers)
首先,确保您的 jdk 文件夹中有 javadoc 文件夹(解压后简单地标记为“doc”),如下所示:
http://www.jcreator.com/installation.htm
您可以从此处下载 Java SE 8 的文档文件:
http://www.oracle.com/technetwork/ java/javase/documentation/jdk8-doc-downloads-2133158.html
确保在运行项目之前先构建项目(菜单/构建/构建项目)。
现在运行您的项目。
First, make sure you have the javadoc folder (simply labelled "doc" once extracted) inside your jdk folder as advised here:
http://www.jcreator.com/installation.htm
You can download the doc file from here for Java SE 8:
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).
Now run your project.
如果您使用命令行运行该文件,请在导入包后使用此特定行。
if you are using command line to run the file, use this particular line after importing packages.
我已经在提示中更改了这一行并准备好:
I have change this line in the prompt and ready: