I have tried the certificate solution:
javac HelloWorld.java
jar cvf HelloWorld.jar HelloWorld.class
jarsigner -keystore myKeystore HelloWorld.jar myself
and placed the jar and the html file in my web server.
See codes:
index.html:
<html>
<head>
</head>
<body>
<applet archive="HelloWorld.jar" code="HelloWorld.class" width=150
height=50></applet>
<br>
<br>
In the applet field above it should appear the text :
<br>
<br>
<html><head>
<br>
<br>
<br>
instead, you can see:
<br>
<br>
Empty Text
<br>
<br>
</body>
</html>
HelloWorld.java:
import java.applet.*;
import java.awt.*;
import java.net.*;
import java.net.*;
import java.io.*;
public class HelloWorld extends Applet {
//This causes the Browser to Redirect, and is not what we want...
//public void init() {
//
//AppletContext appletContext;
//URL my_url;
// try {
// my_url = new URL("http://www.yahoo.com");
// appletContext = getAppletContext();
// appletContext.showDocument(my_url);
// } catch (Exception e) {
// System.out.println("Exception!");
// }
//}
URL MyURL;
BufferedReader InFile;
String inputLine;
public void init() {
inputLine = "Empty Text";
try {
MyURL = new URL("http://www.yahoo.com");
InFile = new BufferedReader(new InputStreamReader(MyURL.openStream()));
inputLine = InFile.readLine();
} catch (Exception MyException) {
System.out.println(MyException);
}
}
public void paint(Graphics g) {
g.drawString(inputLine, 50,25);
}
}
When I browse that index.html file, I get the "Empty Text" string, and
not the first line of the www.yahoo.com server...
Am I doing something wrong?...
> Use a test certificate -- go to java.sun.com and read how to create a test
> certificate and use it to digitially sign. The other alternative, for you to
[quoted text clipped - 63 lines]
> >
> > Fran.

Signature
Francisco Camarero GSM: +41 764 5432 78
ETZ J86, Gloriastrasse 35 telephone: +41 1 632 76 50
CH-8092 Zurich telefax: +41 1 632 11 94
Switzerland e-mail: camarero@iis.ee.ethz.ch
Roedy Green - 12 Jul 2003 04:30 GMT
> MyURL = new URL("http://www.yahoo.com");
try running as an application first. then once it is working, flip to
applet and sign.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Ike - 12 Jul 2003 04:34 GMT
I dont think you can have an applet read from a server OTHER than the server
that it resides on. Unless your applet resides on http://www.yahoo.com I
dont think you can read from that -Ike
> I have tried the certificate solution:
>
[quoted text clipped - 148 lines]
> > >
> > > Fran.
Francisco Camarero - 14 Jul 2003 10:40 GMT
So, I think that looks like a Definitive Negative answer to my problem...
Thanks anyway!
> I dont think you can have an applet read from a server OTHER than the server
> that it resides on. Unless your applet resides on http://www.yahoo.com I
> dont think you can read from that -Ike