| | |
error while running jar file
![]() |
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..
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..
try to read this
http://www.javalobby.org/articles/java2exe/
http://www.javalobby.org/articles/java2exe/
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
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
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).
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.
![]() |
Similar Threads
- Error coming while running an App (JSP)
- How can i capture a crash while running a batch file? (Windows NT / 2000 / XP)
- How to create a JAR file ? (Java)
- Accessing Images in JAR file (Java)
- Loading classes from a .jar file (Java)
Other Threads in the Java Forum
- Previous Thread: In about Jboss.xml
- Next Thread: how to pop up an html file from your Java GUI
| Thread Tools | Search this Thread |
-xlint add android api applet application array arrays automation bank bi binary blackberry bluetooth chat class clear client code compile compiler component database dice digit eclipse equation error event formatingtextintooltipjava fractal freeze functiontesting game gameprogramming givemetehcodez graphics gui health html hyper ide idea image infinite int integer j2me java javame javaprojects jetbrains jni jpanel jtable julia learningresources linux list login main map method methods mobile myregfun netbeans newbie nonstatic notdisplaying openjavafx pearl problem program programming project qt recursion scanner screen scrollbar server set sms sort sorting spamblocker sql sqlserver storm string superclass swing system thread threads tree variablebinding windows xor






