.Net Web应用程序问题中的Java Applet

时间:2012-07-23 20:14:07

标签: java html applet

如何在我的.Net Web应用程序中放置Java Applet?

我正在尝试以下代码

                        <applet code="com.griaule.fingerprintsdk.appletsample.FormMain" 
                        archive="C:\Users\lucas\workspace\applet-chave\bin\SignedFingerprintSDKJava.jar, C:\Users\lucas\workspace\applet-chave\bin\SignedFingerprintSDKJavaAppletSample.jar, C:\Users\lucas\workspace\applet-chave\bin\sqljdbc4.jar" height="550" width="550">
                    </applet>

但我收到以下错误

   java.net.MalformedURLException: unknown protocol: c
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at sun.plugin.util.ProgressMonitorAdapter.setProgressFilter(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.setupProgress(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
java.net.MalformedURLException: unknown protocol: c
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at sun.plugin.util.ProgressMonitorAdapter.setProgressFilter(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.setupProgress(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
java.net.MalformedURLException: unknown protocol: c
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at sun.plugin.util.ProgressMonitorAdapter.setProgressFilter(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.setupProgress(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

如果我在.net项目中插入.jar,则会出现错误IllegalArgumentException,如果我在jar文件的路径之前插入文件:\,就会发生错误SecurityException,就像我说的那样评价。

1 个答案:

答案 0 :(得分:3)

Java applet是使用HTML标记配置的,因此.Net的引用与此无关。

我猜您的问题在于您正在配置属性存档中定义的类路径。指定的jar引用必须与您的代码库相关。它们不能是计算机上的绝对文件路径。

你应该写点像

first.jar,second.jar

并将jar放在可通过HTTP访问

的位置