error while running jar file

Reply

Join Date: Feb 2007
Posts: 35
Reputation: Venks is an unknown quantity at this point 
Solved Threads: 0
Venks's Avatar
Venks Venks is offline Offline
Light Poster

error while running jar file

 
0
  #1
Mar 5th, 2007
Hai friends iam doing project in swing ,in my project i want to send email while running my project..
i added the following code for email:



String host = "mail.gitech.in";
String from = "
from@mail.com"
String to = "
tomail@gitech.in";

// Get system properties
try
{
Properties props = System.getProperties();


// Setup mail server
props.put("mail.smtp.host", host);

// Get session
Session session = Session.getDefaultInstance(props, null);

// Define message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject("The Subject");
message.setText(msg);

// Send message
Transport.send(message);

}
cathch(Exception e){}

my problem is while running jar file from command prompt(java -jar jarfilename .jar) means its working fine , but while double clicking jar file means it gives "could not find the main class. program will exit" ,help me please..
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,190
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 483
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: error while running jar file

 
0
  #2
Mar 5th, 2007
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: error while running jar file

 
0
  #3
Mar 5th, 2007
That doesn't solve the problem, it masks it but it will come back to bite you later.

The problem here is almost certainly classpath related.
Most likely the jar depends on other jars that aren't on the classpath (like mail.jar, activation.jar, and things like that).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC