applet不允许你做这些的, As the applet overview lesson mentioned, existing applet viewers (including Web browsers) impose the following restrictions: Applets cannot load libraries or define native methods. Applets can use only their own Java code and the Java API the applet viewer provides. At a minimum, each applet viewer must provide access to the API defined in the java.* packages. An applet cannot ordinarily read or write files on the host that is executing it. The JDK Applet Viewer actually permits some user-specified exceptions to this rule, but Netscape Navigator 2.0, for example, does not. Applets in any applet viewer can read files specified with full URLs, instead of by a filename. A workaround for not being to write files is to have the applet forward data to an application on the host the applet came from. This application can write the data files on its own host. See Working with a Server-Side Application for more examples. An applet cannot make network connections except to the host that it came from. The workaround for this restriction is to have the applet work with an application on the host it came from. The application can make its own connections anywhere on the network. See Using a Server to Work Around Security Restrictions for an example. An applet cannot start any program on the host that is executing it. Again, an applet can work with a server-side application instead. An applet cannot read certain system properties. See Reading System Properties for more information.
需要同步的数据做在Applet里,做成多线程的,走http协议跟服务器上servlet连接,这样就没什么安全限制了,我知道申银万国的股票实时分析图就是这样做的。
<head>
</head><body>
<script language=javascript>
document.write("<APPLET CODE='test.class' WIDTH=600 HEIGHT=100>");
document.write("<PARAM name=url value='");
document.write(window.location.href);
document.write("'></applet>");
</script>
</body>
</html>
import javax.swing.*;
import java.awt.*;public class test extends JApplet { public test() {
getRootPane().putClientProperty("defeatSystemEventQueueCheck",
Boolean.TRUE);
} public void init() {
String strL = getParameter("url");
JLabel label = new JLabel(
"You are successfully running a Swing applet!" +
strL);
label.setHorizontalAlignment(JLabel.CENTER); label.setBorder(BorderFactory.createMatteBorder(1,1,2,2,Color.black)); getContentPane().add(label, BorderLayout.CENTER);
}}
我在本地(也就是客户端)有一个applet,
而在远程主机也有一个java程序(肯能使applet,也可能是application)两者通过socket进行通信,在客户端打开以web连接的同时(不同时也可以)
我想要让远程主机上的程序控制其本地打开一个相同的连接(或者页面),
所以不知道该怎么实现,
主要是一些关键问题:如
本地的applet怎样得到另一个ie窗口打开的连接;
而远程的程序怎样控制其ie 同样打开一个这样的连接。====================================================狼的心.....................碎了。====================================================
2.自己写个jni程序吧
As the applet overview lesson mentioned, existing applet viewers (including Web browsers) impose the following restrictions: Applets cannot load libraries or define native methods.
Applets can use only their own Java code and the Java API the applet viewer provides. At a minimum, each applet viewer must provide access to the API defined in the java.* packages. An applet cannot ordinarily read or write files on the host that is executing it.
The JDK Applet Viewer actually permits some user-specified exceptions to this rule, but Netscape Navigator 2.0, for example, does not. Applets in any applet viewer can read files specified with full URLs, instead of by a filename. A workaround for not being to write files is to have the applet forward data to an application on the host the applet came from. This application can write the data files on its own host. See Working with a Server-Side Application for more examples. An applet cannot make network connections except to the host that it came from.
The workaround for this restriction is to have the applet work with an application on the host it came from. The application can make its own connections anywhere on the network. See Using a Server to Work Around Security Restrictions for an example. An applet cannot start any program on the host that is executing it.
Again, an applet can work with a server-side application instead. An applet cannot read certain system properties.
See Reading System Properties for more information.
我觉得楼主没有把问题说明清楚。
我的applet的通信对象是远程的一个对等的客户端程序。我只要把我目前的一个网页连接发给它,问题是怎么得到我本地的这个连接,
因为连接和applet不是在一个窗口内打开的。。