UCAExc:::4.0.1 通过 appletviewer 实用程序在 applet 代码中访问被拒绝的异常 运行
UCAExc:::4.0.1 access denied exception running in applet code via the appletviewer utility
public class SetupExam extends Applet {
/**
*
*/
private static final long serialVersionUID = -4106575420788590877L;
private JTextField td_tf;
private JTextField mfeq_tf;
private JTextField nmfe_tf;
/**
* Create the applet.
*/
public SetupExam() {
setLayout(null);
JLabel main_l = new JLabel("Exam");
main_l.setHorizontalAlignment(SwingConstants.CENTER);
main_l.setFont(new Font("Arial", Font.BOLD, 15));
main_l.setBounds(7, 4, 601, 42);
add(main_l);
JLabel cat_l = new JLabel("1.Category");
cat_l.setFont(new Font("Arial", Font.PLAIN, 15));
cat_l.setBounds(16, 80, 162, 32);
add(cat_l);
JLabel td_l = new JLabel("2.Time Duration");
td_l.setFont(new Font("Arial", Font.PLAIN, 15));
td_l.setBounds(16, 130, 162, 32);
add(td_l);
JLabel noq_l = new JLabel("3.Number of Questions");
noq_l.setFont(new Font("Arial", Font.PLAIN, 15));
noq_l.setBounds(13, 184, 165, 32);
add(noq_l);
JLabel mfeq_l = new JLabel("4.Marks for each Question");
mfeq_l.setFont(new Font("Arial", Font.PLAIN, 15));
mfeq_l.setBounds(13, 236, 178, 32);
add(mfeq_l);
JLabel nmfe_l = new JLabel("5.Negtive Mark For Each");
nmfe_l.setFont(new Font("Arial", Font.PLAIN, 15));
nmfe_l.setBounds(13, 293, 178, 32);
add(nmfe_l);
JComboBox cat_combo = new JComboBox();
cat_combo.setEditable(true);
cat_combo.setBounds(237, 80, 208, 32);
add(cat_combo);
td_tf = new JTextField();
td_tf.setBounds(237, 130, 208, 32);
add(td_tf);
td_tf.setColumns(10);
mfeq_tf = new JTextField();
mfeq_tf.setColumns(10);
mfeq_tf.setBounds(237, 236, 208, 32);
add(mfeq_tf);
nmfe_tf = new JTextField();
nmfe_tf.setColumns(10);
nmfe_tf.setBounds(237, 293, 208, 32);
add(nmfe_tf);
JSpinner noq_spin = new JSpinner();
noq_spin.setModel(new SpinnerNumberModel(10, 1, 100, 1));
noq_spin.setBounds(237, 180, 208, 32);
add(noq_spin);
JButton sbmt_btn = new JButton(mfun());
sbmt_btn.setFont(new Font("Arial", Font.PLAIN, 12));
sbmt_btn.setBounds(228, 383, 126, 41);
add(sbmt_btn);
}
public String mfun()
{
try
{
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Connection con=DriverManager.getConnection("jdbc:ucanaccess://C:\workspace\exam.mdb");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("Select * from exam_setup");
while (rs.next())
{
//System.out.println(rs.getString(3));
return rs.getString(3);
}
} catch (Exception ex)
{
System.err.print("Exception: ");
System.err.println(ex.getMessage());
}
return null;
}
}
我正在使用 Ucanacess 4.0.1。
在此之前,我通过 Java 程序在 table 考试中插入数据来检查连接性,但是当我在我的小程序中添加代码时它不起作用。
我使用以下命令 运行 applet
appletviewer ExamSystem.html
输出:
Exception: UCAExc:::4.0.1 access denied ("java.util.logging.LoggingPermission" "control")
appletviewer
实用程序显然 运行 是受限环境中的小程序代码,很可能类似于 "sandbox" 用于 unsigned applet 的小程序代码。 UCanAccess 并非设计用于 运行 在这样的环境中。
public class SetupExam extends Applet {
/**
*
*/
private static final long serialVersionUID = -4106575420788590877L;
private JTextField td_tf;
private JTextField mfeq_tf;
private JTextField nmfe_tf;
/**
* Create the applet.
*/
public SetupExam() {
setLayout(null);
JLabel main_l = new JLabel("Exam");
main_l.setHorizontalAlignment(SwingConstants.CENTER);
main_l.setFont(new Font("Arial", Font.BOLD, 15));
main_l.setBounds(7, 4, 601, 42);
add(main_l);
JLabel cat_l = new JLabel("1.Category");
cat_l.setFont(new Font("Arial", Font.PLAIN, 15));
cat_l.setBounds(16, 80, 162, 32);
add(cat_l);
JLabel td_l = new JLabel("2.Time Duration");
td_l.setFont(new Font("Arial", Font.PLAIN, 15));
td_l.setBounds(16, 130, 162, 32);
add(td_l);
JLabel noq_l = new JLabel("3.Number of Questions");
noq_l.setFont(new Font("Arial", Font.PLAIN, 15));
noq_l.setBounds(13, 184, 165, 32);
add(noq_l);
JLabel mfeq_l = new JLabel("4.Marks for each Question");
mfeq_l.setFont(new Font("Arial", Font.PLAIN, 15));
mfeq_l.setBounds(13, 236, 178, 32);
add(mfeq_l);
JLabel nmfe_l = new JLabel("5.Negtive Mark For Each");
nmfe_l.setFont(new Font("Arial", Font.PLAIN, 15));
nmfe_l.setBounds(13, 293, 178, 32);
add(nmfe_l);
JComboBox cat_combo = new JComboBox();
cat_combo.setEditable(true);
cat_combo.setBounds(237, 80, 208, 32);
add(cat_combo);
td_tf = new JTextField();
td_tf.setBounds(237, 130, 208, 32);
add(td_tf);
td_tf.setColumns(10);
mfeq_tf = new JTextField();
mfeq_tf.setColumns(10);
mfeq_tf.setBounds(237, 236, 208, 32);
add(mfeq_tf);
nmfe_tf = new JTextField();
nmfe_tf.setColumns(10);
nmfe_tf.setBounds(237, 293, 208, 32);
add(nmfe_tf);
JSpinner noq_spin = new JSpinner();
noq_spin.setModel(new SpinnerNumberModel(10, 1, 100, 1));
noq_spin.setBounds(237, 180, 208, 32);
add(noq_spin);
JButton sbmt_btn = new JButton(mfun());
sbmt_btn.setFont(new Font("Arial", Font.PLAIN, 12));
sbmt_btn.setBounds(228, 383, 126, 41);
add(sbmt_btn);
}
public String mfun()
{
try
{
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Connection con=DriverManager.getConnection("jdbc:ucanaccess://C:\workspace\exam.mdb");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("Select * from exam_setup");
while (rs.next())
{
//System.out.println(rs.getString(3));
return rs.getString(3);
}
} catch (Exception ex)
{
System.err.print("Exception: ");
System.err.println(ex.getMessage());
}
return null;
}
}
我正在使用 Ucanacess 4.0.1。
在此之前,我通过 Java 程序在 table 考试中插入数据来检查连接性,但是当我在我的小程序中添加代码时它不起作用。 我使用以下命令 运行 applet
appletviewer ExamSystem.html
输出:
Exception: UCAExc:::4.0.1 access denied ("java.util.logging.LoggingPermission" "control")
appletviewer
实用程序显然 运行 是受限环境中的小程序代码,很可能类似于 "sandbox" 用于 unsigned applet 的小程序代码。 UCanAccess 并非设计用于 运行 在这样的环境中。