File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes SecurityException when running applet in IE5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "SecurityException when running applet in IE5" Watch "SecurityException when running applet in IE5" New topic
Author

SecurityException when running applet in IE5

Merete Lorenzen
Greenhorn

Joined: Feb 23, 2001
Posts: 1
The following applet will not run in the browser. Viewing the java console shows:
"com.ms.security.SecurityExceptionEx[administrator/Patient.HentOverskrift]: java.io.IOException: bad path: C:\JBuilder3\myclasses\sun\jdbc\odbc\JdbcOdbcDriver.class
..."
How do I solve this problem?
Here is part of the applet:
package administrator;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.sql.*;
public class Patient extends Applet {
boolean isStandalone = false;
int antal = 10, t;
int[] Indlaegsnr = new int[antal];
Label[] Tekst = new Label[antal];
Button[] Knap = new Button[antal];
int y = 0;
Panel panel1 = new Panel();
Panel panel2 = new Panel();
Panel panel3 = new Panel();
GridLayout gridLayout3 = new GridLayout(10,1,0,15);
GridLayout gridLayout4 = new GridLayout(10,1,0,15);
BorderLayout borderLayout1 = new BorderLayout(15,15);
BorderLayout borderLayout2 = new BorderLayout();

//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
//Construct the applet
public Patient() {
}
//Initialize the applet
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
this.setBackground(Color.white);
this.setSize(new Dimension(500, 377));
this.setLayout(borderLayout2);
panel1.setBackground(Color.white);
panel1.setLayout(borderLayout1);
panel2.setLayout(gridLayout3);
panel3.setLayout(gridLayout4);
panel2.setBackground(Color.white);
panel3.setBackground(Color.white);
t=0;
this.add(panel1, BorderLayout.CENTER);
panel1.add(panel2, BorderLayout.WEST);
panel1.add(panel3, BorderLayout.CENTER);
for(int i=0; i<antal;i++) {
Tekst[i] = new Label();
Knap[i] = new Button();
Knap[i].setLabel(" ");
Knap[i].setBackground(new java.awt.Color(185, 225, 255));
Knap[i].addActionListener(new java.awt.event.ActionListener() {
String knapnr = String.valueOf(t);
public void actionPerformed(ActionEvent e) {
Knap_actionPerformed(e, knapnr);
}
});
t+=1;
}
// int knapantal = 3;
int knapantal = HentOverskrift();
if (knapantal!= 0) {
for(int a=0; a<knapantal;a++) {
panel2.add(Knap[a], null);
panel3.add(Tekst[a], null);
}
}
else {
Tekst[0].setText("Der er intet indl�g under dette emne.");
}
}
//Start the applet
public void start() {
}
//Stop the applet
public void stop() {
}
//Destroy the applet
public void destroy() {
}
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}
//Get parameter info
public String[][] getParameterInfo() {
return null;
}
public int HentOverskrift(){
Connection con;
Statement stmt;
ResultSet svar;
int nr = 0;
String minodbc = ("jdbcdbc:ventev");
String minquery = ("SELECT overskrift, o_id FROM oversigt WHERE E_id = 'Pat_H' ORDER BY o_id DESC");
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e) {
System.out.println("Kan ikke finde driveren");
}
try {
// etablerer forbindelse til den angivne (JDBC-ODBC-bridgen)
con = DriverManager.getConnection(minodbc,"dba","sql");
stmt = con.createStatement(); // Opretter et SQL-udtryk og afleverer et objekt
svar = stmt.executeQuery(minquery); // Executes a query.
while(svar.next()) {
Indlaegsnr[nr] = svar.getInt("o_id");
Tekst[nr].setText(svar.getString("overskrift"));
nr++;
}
stmt.close();
con.close();
}
catch(SQLException e ) {
System.out.println("SQL fejl 1: " + e.getMessage());
}
return nr;
}
}
Jukka Sundberg
Greenhorn

Joined: Jun 21, 2001
Posts: 1
Did you ever solve the problem? I am in a similiar situation, with my swing components in my applet.
Originally posted by Merete Lorenzen:
The following applet will not run in the browser. Viewing the java console shows:
"com.ms.security.SecurityExceptionEx[administrator/Patient.HentOverskrift]: java.io.IOException: bad path: C:\JBuilder3\myclasses\sun\jdbc\odbc\JdbcOdbcDriver.class
..."
How do I solve this problem?
Here is part of the applet:
package administrator;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.sql.*;
public class Patient extends Applet {
boolean isStandalone = false;
int antal = 10, t;
int[] Indlaegsnr = new int[antal];
Label[] Tekst = new Label[antal];
Button[] Knap = new Button[antal];
int y = 0;
Panel panel1 = new Panel();
Panel panel2 = new Panel();
Panel panel3 = new Panel();
GridLayout gridLayout3 = new GridLayout(10,1,0,15);
GridLayout gridLayout4 = new GridLayout(10,1,0,15);
BorderLayout borderLayout1 = new BorderLayout(15,15);
BorderLayout borderLayout2 = new BorderLayout();

//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
//Construct the applet
public Patient() {
}
//Initialize the applet
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
this.setBackground(Color.white);
this.setSize(new Dimension(500, 377));
this.setLayout(borderLayout2);
panel1.setBackground(Color.white);
panel1.setLayout(borderLayout1);
panel2.setLayout(gridLayout3);
panel3.setLayout(gridLayout4);
panel2.setBackground(Color.white);
panel3.setBackground(Color.white);
t=0;
this.add(panel1, BorderLayout.CENTER);
panel1.add(panel2, BorderLayout.WEST);
panel1.add(panel3, BorderLayout.CENTER);
for(int i=0; i<antal;i++) {
Tekst[i] = new Label();
Knap[i] = new Button();
Knap[i].setLabel(" ");
Knap[i].setBackground(new java.awt.Color(185, 225, 255));
Knap[i].addActionListener(new java.awt.event.ActionListener() {
String knapnr = String.valueOf(t);
public void actionPerformed(ActionEvent e) {
Knap_actionPerformed(e, knapnr);
}
});
t+=1;
}
// int knapantal = 3;
int knapantal = HentOverskrift();
if (knapantal!= 0) {
for(int a=0; a<knapantal;a++) {
panel2.add(Knap[a], null);
panel3.add(Tekst[a], null);
}
}
else {
Tekst[0].setText("Der er intet indl�g under dette emne.");
}
}
//Start the applet
public void start() {
}
//Stop the applet
public void stop() {
}
//Destroy the applet
public void destroy() {
}
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}
//Get parameter info
public String[][] getParameterInfo() {
return null;
}
public int HentOverskrift(){
Connection con;
Statement stmt;
ResultSet svar;
int nr = 0;
String minodbc = ("jdbc dbc:ventev");
String minquery = ("SELECT overskrift, o_id FROM oversigt WHERE E_id = 'Pat_H' ORDER BY o_id DESC");
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e) {
System.out.println("Kan ikke finde driveren");
}
try {
// etablerer forbindelse til den angivne (JDBC-ODBC-bridgen)
con = DriverManager.getConnection(minodbc,"dba","sql");
stmt = con.createStatement(); // Opretter et SQL-udtryk og afleverer et objekt
svar = stmt.executeQuery(minquery); // Executes a query.
while(svar.next()) {
Indlaegsnr[nr] = svar.getInt("o_id");
Tekst[nr].setText(svar.getString("overskrift"));
nr++;
}
stmt.close();
con.close();
}
catch(SQLException e ) {
System.out.println("SQL fejl 1: " + e.getMessage());
}
return nr;
}
}

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SecurityException when running applet in IE5