i cannot run it in GUI mode......
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, January 14, 2003 08:02 PM

import java.util.*; import java.io.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class sms2 extends JApplet implements ActionListener { private JLabel from = new JLabel("From:"); private JLabel to = new JLabel("To:"); private JTextField txtFrom = new JTextField(5); private JTextField txtTo = new JTextField(5); private JButton Send =new JButton("Send"); private Container c; public void init() { c=getContentPane(); c.setLayout(new FlowLayout()); c.add(from);    More>>

import java.util.*;


import java.io.*;


import javax.mail.*;


import javax.mail.internet.*;


import javax.activation.*;


import java.awt.*;


import java.awt.event.*;


import javax.swing.*;



public class sms2 extends JApplet implements ActionListener


{



private JLabel from = new JLabel("From:");


private JLabel to = new JLabel("To:");


private JTextField txtFrom = new JTextField(5);


private JTextField txtTo = new JTextField(5);


private JButton Send =new JButton("Send");


private Container c;



public void init()


{


c=getContentPane();


c.setLayout(new FlowLayout());


c.add(from);


c.add(txtFrom);


c.add(txtTo);


c.add(Send);


Send.addActionListener(this);


}



public void actionPerformed(ActionEvent e)


{



try{


String to = txtTo.getText();


String from =txtFrom.getText();


String host = "host address insert in here";


String messageBody = "testing";



Properties props = new Properties();


props.put("mail.smtp.host", host);



Session session = Session.getInstance(props,null);


session.setDebug(true);



Message msg = new MimeMessage(session);


msg.setFrom(new InternetAddress(from));


InternetAddress[] address = {new InternetAddress(to)};


msg.setRecipients(Message.RecipientType.TO, address);


msg.setSubject("testing");


msg.setSentDate(new java.util.Date());


msg.setText(messageBody );


Transport.send(msg);



}



catch(AddressException eee)


{ System.err.println(eee);}



catch(MessagingException ee)


{ System.err.println(ee);}


}


}



i get this acception:


java.lang.NoClassDefFoundError:

javax/mail/MessagingException


at java.lang.Class.newInstance0(Native Method)


at java.lang.Class.newInstance(Class.java:232)


at sun.applet.AppletPanel.createApplet(AppletPanel.java:581)


at sun.applet.AppletPanel.runLoader(AppletPanel.java:510)


at sun.applet.AppletPanel.run(AppletPanel.java:288)


at java.lang.Thread.run(Thread.java:479)



please help me?? i dont know wat seem to be the error here..??

   <<Less

Re: i cannot run it in GUI mode......

Posted By:   John_Zukowski  
Posted On:   Wednesday, January 22, 2003 05:17 AM

Make sure you provide the JavaMail classes with the applet. They are not available with the JRE in the browser by default.
About | Sitemap | Contact