Java Security Question - Applets
Cere (cere@mindspring.com)
Mon, 12 Apr 1999 13:20:44 -0700
From: "Cere" <cere@mindspring.com>
To: "JDK (Net)" <java-net@java.sun.com>,
Subject: Java Security Question - Applets
Date: Mon, 12 Apr 1999 13:20:44 -0700
------=_NextPart_000_001E_01BE84E7.45358600
Content-Type: multipart/alternative; boundary="----=_NextPart_001_001F_01BE84E7.45358600"
X-Sun-Content-Length: 2906
------=_NextPart_001_001F_01BE84E7.45358600
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am just beginning to learn Java programming, and i have been working =
with JDK 1.2.
I want to eventually be able to make a telnet applet that allows you to =
telnet to places,=20
via a web page. My first 'step' in making something, dealing with =
java.net.*; has me
very frustrated. My program is a simple applet, that grabs the 'ip' =
address of the host name
you input to the applet. However, i am coming up with a Security error =
on this. And i don't
know how to get around it, or what i am doing wrong.=20
If this program doesn't work, how in the world would i be able to =
connect to a telnet=20
connection over the web ? via an applet ?
I have included my java file with this letter, so you may better assist =
me with my problem.
Thankyou for your time.
Arathena
------=_NextPart_001_001F_01BE84E7.45358600
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
I am just beginning to learn Java =
programming,=20
and i have been working with JDK 1.2.
I want to eventually be able to make =
a telnet=20
applet that allows you to telnet to places,
via a web page. My first 'step' in =
making=20
something, dealing with java.net.*; has me
very frustrated. My program is a =
simple applet,=20
that grabs the 'ip' address of the host name
you input to the applet. However, i =
am coming up=20
with a Security error on this. And i don't
know how to get around it, or what i =
am doing=20
wrong.
If this program doesn't work, how in =
the world=20
would i be able to connect to a telnet
connection over the web ? via an =
applet=20
?
I have included my java file with =
this letter,=20
so you may better assist me with my problem.
Thankyou for your time.
Arathena
------=_NextPart_001_001F_01BE84E7.45358600--
------=_NextPart_000_001E_01BE84E7.45358600
Content-Type: application/octet-stream; name="IpAddress2.java"
Content-Disposition: attachment;
filename="IpAddress2.java"
X-Sun-Content-Length: 1216
// Programmer: Arathena
// Purpose: Applet that finds an ip address from a host
// Date: 4/10/99
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.net.*;
/**
**/
public class IpAddress2 extends Applet implements ActionListener {
InetAddress Address;
TextArea textarea;
TextField textfield;
String ip;
public void init() {
textfield = new TextField(20);
add(textfield);
textfield.addActionListener(this);
textarea = new TextArea(10,40);
add(textarea);
} // End of init
public void actionPerformed(ActionEvent e) {
try {
ip = textfield.getText();
System.out.println(ip);
Address = InetAddress.getByName(ip);
System.out.println(Address);
textarea.append(Address.toString()+"\n");
textfield.setText("");
repaint();
} catch(UnknownHostException u) {
String err = u.toString();
System.out.println( err );
System.out.println("Unknown host"); }
catch (SecurityException s) {
String err = s.toString();
System.out.println( err );
System.out.println("SECURITY ERROR - DENIED!"); }
} // End of actionPerformed()
} // End of IpAddress2() class
------=_NextPart_000_001E_01BE84E7.45358600--