About Me

My photo
India
Hey there, lovely people! I'm Hemant Menaria, and I'm passionate about programming. Having completed my MCA in 2011, I've delved into the world of coding with fervor. I believe in sharing knowledge, making complex concepts easy to grasp for everyone. JAVA, PHP, and ANDROID hold a special place in my heart, and I spend most of my time immersed in them. Currently, I'm deeply engaged in API/Webservice frameworks and crafting Hybrid mobile applications to enhance flexibility in the digital realm. If you ever find yourself stuck with a programming challenge, feel free to reach out to me at +91-8955499900 or drop me a line at hemantmenaria008@gmail.com. I'm always eager to help fellow enthusiasts navigate the intricacies of coding!

Friday, July 19, 2013

Eclipse “Failed to load JNI shared library”

Problem: When I try opening Eclipse, a pop-up dialog states:
Failed to load the JNI shared library "C:/JDK/bin/client/jvm.dll"`.
Following this, Eclipse force closes.

Solution:

Working pairings of OS, JDK and Eclipse:


  • 32-bit OS - 32-bit JDK - 32-bit Eclipse (32-bit only)
  • 64-bit OS - 32-bit JDK - 32-bit Eclipse
  • 64-bit OS - 64-bit JDK - 64bit Eclipse (64-bit only)

I had several JDKs and JREs installed.
Each of them had their own entry in the PATH variable, all was working more or less.
Judging from the PATH variables, some installations were completely useless, since they were never used. Of course, the "inactive" Javas could be referenced manually from within Eclipse if I needed, but I never did that, so I really did not need them. (At least I thought so at that time...)
I cleaned up the mess, deinstalled all current Java's, installed only JDK + JRE 1.7 64-bit.
One of the Eclipse 'installations' failed afterwards with the Failed to Load the JNI shared Library and a given path relative to the fresh installed JDK where it thought the jvm.dll to be.
The failing Eclipse was the only one of all my IDEs that was still a 32-bit version on my otherwise all-64-bit setup.
Adding VM arguments, like so often mentioned, in the eclipse.ini was no use in my case (because I had only the wrong JDK/JRE to relate to.)
I was also unable to find out how to check if this Eclipse was a 32-bit or 64-bit version (I could not look it up in the Task Manager, since this Eclipse 'installation' would not start up. And since it had been a while since I had set it up, I could not remember its version either.)
In case you use a newer JDK and a older JRE you might be in for trouble, too, but then it is more likely a java.lang.UnsupportedClassVersionError appears, IIRC.

 

 

Wednesday, April 10, 2013


// How to send an email by Java application using Gmail/ Yahoo/ Hotmail


import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;


public class sendmail {
public static void main(String[] args) {
   

            try{
                String host = "smtp.gmail.com";
                String from = "from@gmail.com";
                String pass = " njkgyddddshqd ";  //if you are getting any error related to authentication use application specific password here.
                Properties props = System.getProperties();
                props.put("mail.smtp.starttls.enable", "true"); // added this line
                props.put("mail.smtp.host", host);
                props.put("mail.smtp.user", from);
                props.put("mail.smtp.password", pass);
                props.put("mail.smtp.port", "587");
                props.put("mail.smtp.auth", true);

                String[] to = {"to@gmail.com"}; // added this line

                Session session = Session.getDefaultInstance(props, null);
                MimeMessage message = new MimeMessage(session);
                message.setFrom(new InternetAddress(from));

                InternetAddress[] toAddress = new InternetAddress[to.length];

                // To get the array of addresses
                for( int i=0; i < to.length; i++ ) { // changed from a while loop
                    toAddress[i] = new InternetAddress(to[i]);
                }
                System.out.println(Message.RecipientType.TO);

                for( int i=0; i < toAddress.length; i++) { // changed from a while loop
                    message.addRecipient(Message.RecipientType.TO, toAddress[i]);
                }
                message.setSubject("sending in a group");
                message.setText("Welcome to JavaMail");
                Transport transport = session.getTransport("smtp");
                transport.connect(host, from, pass);
                transport.sendMessage(message, message.getAllRecipients());
                transport.close();
            }catch (MessagingException mex) {
                mex.printStackTrace();
            }
}
}


/*********************************************/

if you are getting any type of error then read below carefully


My client isn't accepting my username and password

We suggest making some adjustments in your mail client's settings so you aren't always prompted to enter your username and password. Please check the following settings in your mail client:
  • Make sure that you've entered your full email address (e.g. username@gmail.com)
  • Re-enter your password to ensure that it's correct. Keep in mind that passwords are case-sensitive.
  • Make sure your mail client isn't set to check for new mail too often. If your mail client checks for new messages more than once every 10 minutes, your client might repeatedly request your username and password.
Now, please follow the steps below to resolve the problem:
  1. Open your web browser and sign in to Gmail at http://mail.google.com/mail. If you see a word verification request, type the letters in the distorted picture and finish signing in.
  2. Close your browser and try accessing your messages in your email client again.
  3. If you're still having problems, visit http://www.google.com/accounts/DisplayUnlockCaptcha and sign in with your Gmail username and password. If necessary, enter the letters in the distorted picture.
  4. Click Continue.
  5. Restart your mail client and try accessing messages in your email client again.  
Note: use that application specific password at the place of original password of sender password.

read more on : http://support.google.com/mail/answer/14257