Note that there are some explanatory texts on larger screens.

plurals
  1. POPermission for java applet to be used on web browser
    primarykey
    data
    text
    <p>I have created an applet that I would like to run on web browser. The applet contains features such as sending an email and opening another applet using URI.</p> <p>The interface works fine. However, </p> <p>these parts seem to need a permission. </p> <pre><code>........................................................... //creating session Session session = Session.getDefaultInstance(props, null); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); // to add recipients InternetAddress[] toAddress = new InternetAddress[to.size()]; // To get the array of recipients addresses for( int i=0; i &lt; to.size(); i++ ) { toAddress[i] = new InternetAddress(to.get(i)); } System.out.println(Message.RecipientType.TO); //adding recipients for( int i=0; i &lt; toAddress.length; i++) { message.addRecipient(Message.RecipientType.TO, toAddress[i]); } message.setSubject(subject); message.setText("This is Zaid's app"); // check if animation was selected if(animation) fileName= attachment +".gif"; else fileName = attachment +".JPEG"; //add the attachment MimeBodyPart attachMent = new MimeBodyPart(); FileDataSource dataSource= new FileDataSource(new File("ScaryImages//"+ fileName)); attachMent.setDataHandler(new DataHandler(dataSource)); attachMent.setFileName(fileName); attachMent.setDisposition(MimeBodyPart.ATTACHMENT); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(attachMent); message.setContent(multipart); //this is the sender variable Transport transport = session.getTransport("smtp"); //trying to send... try{ System.out.println("connecting..."); transport.connect(host, from, pass); System.out.println("sending...Please wait..."); transport.sendMessage(message, message.getAllRecipients()); transport.close(); System.out.println("sent"); JOptionPane.showMessageDialog(null,"Your Email has been sent successfully!"); } catch(Exception e) { //exception handling, the problem is mainly the connection JOptionPane.showMessageDialog(null,"Connection Problem has been detected! Please Try again."); e.printStackTrace(System.out); } //remove loading label anyway finally{ EmailApplet.removeLoadingLabel(); } ....................... </code></pre> <p>also this,</p> <p>try {</p> <pre><code> java.net.URI uri = new java.net.URI( arg ); desktop.browse( uri ); } </code></pre> <p>Can you please tell me what permission and where should I provide? Thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload