Witam otóż mam Problem : chcę zakończyć wybrany process w JAVA To działa Process proc = Runtime.getRuntime().exec("c:\Program Files\Gadu-Gadu 10\gg.exe");
proc.destrcode>o ile process nie jest uruchomiony gdy uruchamiam Ten kod A 2 problem to jak wysłać E-mial z załącznikiem z ? Mam taki kod ale nie moze się połączyć z serwerem
String to = "E--mial";
String from = "E-,ial";
String host = "poczta.wp.pl";
String filename = "c:\z.txt";
boolean debug = Boolean.valueOf(filename).booleanValue();
String msgText1 = "Sending a file.\n";
String subject = "Sending a file";
Properties props = System.getProperties();
props.put( host, props);
Session session = Session.getInstance(props, null);
session.setDebug(debug);
try {
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(msgText1);
MimeBodyPart mbp2 = new MimeBodyPart();
mbp2.attachFile(filename);
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
msg.setContent(mp);
Transport.send(msg);
} catch (MessagingException mex) {
mex.printStackTrace();
Exception ex = null;
if ((ex = mex.getNextException()) != null) {
ex.printStackTrace();
}
} catch (IOException ioex) {
ioex.printStackTrace();
}
}
}
Dzięki z góry.