Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Pedroalves

[Resolvido] login

Recommended Posts

não estou a conseguir fazer o login da-me este erros

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: classes/login

at gestaviao.MENUPRINCIPAL.jButton1ActionPerformed(MENUPRINCIPAL.java:146)

at gestaviao.MENUPRINCIPAL.access$000(MENUPRINCIPAL.java:17)

at gestaviao.MENUPRINCIPAL$1.actionPerformed(MENUPRINCIPAL.java:90)

at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)

at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)

at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)

at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)

at java.awt.Component.processMouseEvent(Component.java:6505)

at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)

at java.awt.Component.processEvent(Component.java:6270)

at java.awt.Container.processEvent(Container.java:2229)

at java.awt.Component.dispatchEventImpl(Component.java:4861)

at java.awt.Container.dispatchEventImpl(Container.java:2287)

at java.awt.Component.dispatchEvent(Component.java:4687)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)

at java.awt.Container.dispatchEventImpl(Container.java:2273)

at java.awt.Window.dispatchEventImpl(Window.java:2713)

at java.awt.Component.dispatchEvent(Component.java:4687)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)

at java.awt.EventQueue.access$000(EventQueue.java:101)

at java.awt.EventQueue$3.run(EventQueue.java:666)

at java.awt.EventQueue$3.run(EventQueue.java:664)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)

at java.awt.EventQueue$4.run(EventQueue.java:680)

at java.awt.EventQueue$4.run(EventQueue.java:678)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Caused by: java.lang.ClassNotFoundException: classes.login

at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

at java.lang.ClassLoader.loadClass(ClassLoader.java:423)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

... 39 more

 

como estou a usar classes não estou a conseguir ir buscar os dados segue-se o codigo

do login

package gestaviao;
import java.util.*;
import java.sql.*;
import HelperDB.DBAccessObj;
import classes.login;
import javax.swing.JOptionPane;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
*
* @author Alves
*/
public class MENUPRINCIPAL extends javax.swing.JPanel {
private JPanel previousPanel = null;
   JFrame parent = null;

   private DBAccessObj dbo;
 // private String username = "";
 //private String password="";
   // private String Password="";

   /**
    * Creates new form Login
    */
   public MENUPRINCIPAL(JFrame fparent, JPanel previousPanel, DBAccessObj dbo) {
       initComponents();
       this.parent = fparent;
       this.previousPanel = previousPanel;
       this.jMenuBar1.setVisible(true);





   }



   /**
    * This method is called from within the constructor to initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is always
    * regenerated by the Form Editor.
    */
   @SuppressWarnings("unchecked")
   // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
   private void initComponents() {

       jMenuBar1 = new javax.swing.JMenuBar();
       jMenu1 = new javax.swing.JMenu();
       jMenu2 = new javax.swing.JMenu();
       jMenu3 = new javax.swing.JMenu();
       ERRO = new javax.swing.JFrame();
       USERNAME = new javax.swing.JTextField();
       PASSWORD = new javax.swing.JPasswordField();
       jButton1 = new javax.swing.JButton();
       jLabel1 = new javax.swing.JLabel();
       jLabel2 = new javax.swing.JLabel();

       jMenu1.setText("File");
       jMenuBar1.add(jMenu1);

       jMenu2.setText("Edit");
       jMenuBar1.add(jMenu2);

       jMenu3.setText("jMenu3");
       jMenuBar1.add(jMenu3);

       javax.swing.GroupLayout ERROLayout = new javax.swing.GroupLayout(ERRO.getContentPane());
       ERRO.getContentPane().setLayout(ERROLayout);
       ERROLayout.setHorizontalGroup(
           ERROLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
           .addGap(0, 400, Short.MAX_VALUE)
       );
       ERROLayout.setVerticalGroup(
           ERROLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
           .addGap(0, 300, Short.MAX_VALUE)
       );

       USERNAME.setText("jTextField1");

       PASSWORD.setText("jPasswordField1");

       jButton1.setText("jButton1");
       jButton1.addActionListener(new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent evt) {
               jButton1ActionPerformed(evt);
           }
       });

       jLabel1.setText("jLabel1");

       jLabel2.setText("jLabel2");

       javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
       this.setLayout(layout);
       layout.setHorizontalGroup(
           layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
           .addGroup(layout.createSequentialGroup()
               .addGap(518, 518, 518)
               .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                   .addComponent(jButton1)
                   .addGroup(layout.createSequentialGroup()
                       .addGap(21, 21, 21)
                       .addComponent(USERNAME, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                   .addGroup(layout.createSequentialGroup()
                       .addComponent(PASSWORD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                       .addGap(18, 18, 18)
                       .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                           .addGroup(layout.createSequentialGroup()
                               .addGap(10, 10, 10)
                               .addComponent(jLabel2))
                           .addComponent(jLabel1))))
               .addContainerGap(727, Short.MAX_VALUE))
       );
       layout.setVerticalGroup(
           layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
           .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
               .addGap(250, 250, 250)
               .addComponent(USERNAME, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
               .addGap(18, 18, 18)
               .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                   .addComponent(PASSWORD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                   .addComponent(jLabel1))
               .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
               .addComponent(jLabel2)
               .addGap(120, 120, 120)
               .addComponent(jButton1)
               .addContainerGap(304, Short.MAX_VALUE))
       );
   }// </editor-fold>                        

   private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         

       //String username = "";
  //   String password="";

 //     username= String.format(USERNAME.getText());
// password =String.format(PASSWORD.getText());
  // this.jLabel1.setText(username);
  // this.jLabel2.setText(password);   

      login b = new login(dbo);



try{         

               b.retrievelogin(this.USERNAME.getText(),this.PASSWORD.getText());

               if(b.getTipo().equals("1")){

  this.ERRO.setVisible(true);
this.ERRO.setSize(321, 192);
this.ERRO.setAlwaysOnTop(true);
     USERNAME.setText(null);
PASSWORD.setText(null);
/*
this.MENUPRINCIPAL.setVisible(true);
this.MENUPRINCIPAL.setSize(1360, 780);
jLabel46.setText("NOME DO UTILIZADOR "+rset1.getString(3));
jLabel47.setText("TIPO DE UTILIZADOR "+rset1.getString(2));
this.getFrame().setVisible(false);
}

else if(rset.getString(1).equals(pass)&&(rset.getString(2).equals("2"))){
this.MENUPRINCIPALFUNCIONARIO.setVisible(true);
this.MENUPRINCIPALFUNCIONARIO.setSize(434, 336);
this.getFrame().setVisible(false);
}
   else if(rset.getString(1).equals(pass) && (rset.getString(2).equals("5")))
   {
this.BLOQUEADO.setVisible(true);
this.BLOQUEADO.setSize(434, 336);
      */
   }

else{
     this.ERRO.setVisible(true);
this.ERRO.setSize(321, 192);
this.ERRO.setAlwaysOnTop(true);
     USERNAME.setText(null);
PASSWORD.setText(null);
}
}
catch(SQLException e){
               System.out.println("ERRO: " + e.getMessage());
               javax.swing.JOptionPane.showMessageDialog(null,"ERRO " + e.getMessage(), "ERRO", javax.swing.JOptionPane.ERROR_MESSAGE);
           }
          /* */
          /* */
               // TODO add your handling code here:
   }                                        

   // Variables declaration - do not modify                     
   private javax.swing.JFrame ERRO;
   private javax.swing.JPasswordField PASSWORD;
   private javax.swing.JTextField USERNAME;
   private javax.swing.JButton jButton1;
   private javax.swing.JLabel jLabel1;
   private javax.swing.JLabel jLabel2;
   private javax.swing.JMenu jMenu1;
   private javax.swing.JMenu jMenu2;
   private javax.swing.JMenu jMenu3;
   private javax.swing.JMenuBar jMenuBar1;
   // End of variables declaration                   
}

codigo do classe login

package classes;

import HelperDB.DBAccessObj;
import java.math.BigInteger;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.security.*;
import java.security.MessageDigest;

/**
*
* @author Alves
*/
public class login {
     public class MD5Digest
   extends GeneralDigest
{
   private static final int    DIGEST_LENGTH = 16;

   private int     H1, H2, H3, H4;         // IV's

   private int[]   X = new int[16];
   private int     xOff;

   /**
    * Standard constructor
    */
   public MD5Digest()
   {
       reset();
   }

   /**
    * Copy constructor.  This will copy the state of the provided
    * message digest.
    */
   public MD5Digest(MD5Digest t)
   {
       super(t);

       H1 = t.H1;
       H2 = t.H2;
       H3 = t.H3;
       H4 = t.H4;

       System.arraycopy(t.X, 0, X, 0, t.X.length);
       xOff = t.xOff;
   }

   public String getAlgorithmName()
   {
       return "MD5";
   }

   public int getDigestSize()
   {
       return DIGEST_LENGTH;
   }

   protected void processWord(
       byte[]  in,
       int     inOff)
   {
       X[xOff++] = (in[inOff] & 0xff) | ((in[inOff + 1] & 0xff) << 8)
           | ((in[inOff + 2] & 0xff) << 16) | ((in[inOff + 3] & 0xff) << 24);

       if (xOff == 16)
       {
           processBlock();
       }
   }

   protected void processLength(
       long    bitLength)
   {
       if (xOff > 14)
       {
           processBlock();
       }

       X[14] = (int)(bitLength & 0xffffffff);
       X[15] = (int)(bitLength >>> 32);
   }

   private void unpackWord(
       int     word,
       byte[]  out,
       int     outOff)
   {
       out[outOff]     = (byte)word;
       out[outOff + 1] = (byte)(word >>> 8);
       out[outOff + 2] = (byte)(word >>> 16);
       out[outOff + 3] = (byte)(word >>> 24);
   }

   public int doFinal(
       byte[]  out,
       int     outOff)
   {
       finish();

       unpackWord(H1, out, outOff);
       unpackWord(H2, out, outOff + 4);
       unpackWord(H3, out, outOff + 8);
       unpackWord(H4, out, outOff + 12);

       reset();

       return DIGEST_LENGTH;
   }

   /**
    * reset the chaining variables to the IV values.
    */
   public void reset()
   {
       super.reset();

       H1 = 0x67452301;
       H2 = 0xefcdab89;
       H3 = 0x98badcfe;
       H4 = 0x10325476;

       xOff = 0;

       for (int i = 0; i != X.length; i++)
       {
           X[i] = 0;
       }
   }

   //
   // round 1 left rotates
   //
   private static final int S11 = 7;
   private static final int S12 = 12;
   private static final int S13 = 17;
   private static final int S14 = 22;

   //
   // round 2 left rotates
   //
   private static final int S21 = 5;
   private static final int S22 = 9;
   private static final int S23 = 14;
   private static final int S24 = 20;

   //
   // round 3 left rotates
   //
   private static final int S31 = 4;
   private static final int S32 = 11;
   private static final int S33 = 16;
   private static final int S34 = 23;

   //
   // round 4 left rotates
   //
   private static final int S41 = 6;
   private static final int S42 = 10;
   private static final int S43 = 15;
   private static final int S44 = 21;

   /*
    * rotate int x left n bits.
    */
   private int rotateLeft(
       int x,
       int n)
   {
       return (x << n) | (x >>> (32 - n));
   }

   /*
    * F, G, H and I are the basic MD5 functions.
    */
   private int F(
       int u,
       int v,
       int w)
   {
       return (u & v) | (~u & w);
   }

   private int G(
       int u,
       int v,
       int w)
   {
       return (u & w) | (v & ~w);
   }

   private int H(
       int u,
       int v,
       int w)
   {
       return u ^ v ^ w;
   }

   private int K(
       int u,
       int v,
       int w)
   {
       return v ^ (u | ~w);
   }

   protected void processBlock()
   {
       int a = H1;
       int b = H2;
       int c = H3;
       int d = H4;

       //
       // Round 1 - F cycle, 16 times.
       //
       a = rotateLeft(a + F(b, c, d) + X[ 0] + 0xd76aa478, S11) + b;
       d = rotateLeft(d + F(a, b, c) + X[ 1] + 0xe8c7b756, S12) + a;
       c = rotateLeft(c + F(d, a, B) + X[ 2] + 0x242070db, S13) + d;
       b = rotateLeft(b + F(c, d, a) + X[ 3] + 0xc1bdceee, S14) + c;
       a = rotateLeft(a + F(b, c, d) + X[ 4] + 0xf57c0faf, S11) + b;
       d = rotateLeft(d + F(a, b, c) + X[ 5] + 0x4787c62a, S12) + a;
       c = rotateLeft(c + F(d, a, B) + X[ 6] + 0xa8304613, S13) + d;
       b = rotateLeft(b + F(c, d, a) + X[ 7] + 0xfd469501, S14) + c;
       a = rotateLeft(a + F(b, c, d) + X[ 8] + 0x698098d8, S11) + b;
       d = rotateLeft(d + F(a, b, c) + X[ 9] + 0x8b44f7af, S12) + a;
       c = rotateLeft(c + F(d, a, B) + X[10] + 0xffff5bb1, S13) + d;
       b = rotateLeft(b + F(c, d, a) + X[11] + 0x895cd7be, S14) + c;
       a = rotateLeft(a + F(b, c, d) + X[12] + 0x6b901122, S11) + b;
       d = rotateLeft(d + F(a, b, c) + X[13] + 0xfd987193, S12) + a;
       c = rotateLeft(c + F(d, a, B) + X[14] + 0xa679438e, S13) + d;
       b = rotateLeft(b + F(c, d, a) + X[15] + 0x49b40821, S14) + c;

       //
       // Round 2 - G cycle, 16 times.
       //
       a = rotateLeft(a + G(b, c, d) + X[ 1] + 0xf61e2562, S21) + b;
       d = rotateLeft(d + G(a, b, c) + X[ 6] + 0xc040b340, S22) + a;
       c = rotateLeft(c + G(d, a, B) + X[11] + 0x265e5a51, S23) + d;
       b = rotateLeft(b + G(c, d, a) + X[ 0] + 0xe9b6c7aa, S24) + c;
       a = rotateLeft(a + G(b, c, d) + X[ 5] + 0xd62f105d, S21) + b;
       d = rotateLeft(d + G(a, b, c) + X[10] + 0x02441453, S22) + a;
       c = rotateLeft(c + G(d, a, B) + X[15] + 0xd8a1e681, S23) + d;
       b = rotateLeft(b + G(c, d, a) + X[ 4] + 0xe7d3fbc8, S24) + c;
       a = rotateLeft(a + G(b, c, d) + X[ 9] + 0x21e1cde6, S21) + b;
       d = rotateLeft(d + G(a, b, c) + X[14] + 0xc33707d6, S22) + a;
       c = rotateLeft(c + G(d, a, B) + X[ 3] + 0xf4d50d87, S23) + d;
       b = rotateLeft(b + G(c, d, a) + X[ 8] + 0x455a14ed, S24) + c;
       a = rotateLeft(a + G(b, c, d) + X[13] + 0xa9e3e905, S21) + b;
       d = rotateLeft(d + G(a, b, c) + X[ 2] + 0xfcefa3f8, S22) + a;
       c = rotateLeft(c + G(d, a, B) + X[ 7] + 0x676f02d9, S23) + d;
       b = rotateLeft(b + G(c, d, a) + X[12] + 0x8d2a4c8a, S24) + c;

       //
       // Round 3 - H cycle, 16 times.
       //
       a = rotateLeft(a + H(b, c, d) + X[ 5] + 0xfffa3942, S31) + b;
       d = rotateLeft(d + H(a, b, c) + X[ 8] + 0x8771f681, S32) + a;
       c = rotateLeft(c + H(d, a, B) + X[11] + 0x6d9d6122, S33) + d;
       b = rotateLeft(b + H(c, d, a) + X[14] + 0xfde5380c, S34) + c;
       a = rotateLeft(a + H(b, c, d) + X[ 1] + 0xa4beea44, S31) + b;
       d = rotateLeft(d + H(a, b, c) + X[ 4] + 0x4bdecfa9, S32) + a;
       c = rotateLeft(c + H(d, a, B) + X[ 7] + 0xf6bb4b60, S33) + d;
       b = rotateLeft(b + H(c, d, a) + X[10] + 0xbebfbc70, S34) + c;
       a = rotateLeft(a + H(b, c, d) + X[13] + 0x289b7ec6, S31) + b;
       d = rotateLeft(d + H(a, b, c) + X[ 0] + 0xeaa127fa, S32) + a;
       c = rotateLeft(c + H(d, a, B) + X[ 3] + 0xd4ef3085, S33) + d;
       b = rotateLeft(b + H(c, d, a) + X[ 6] + 0x04881d05, S34) + c;
       a = rotateLeft(a + H(b, c, d) + X[ 9] + 0xd9d4d039, S31) + b;
       d = rotateLeft(d + H(a, b, c) + X[12] + 0xe6db99e5, S32) + a;
       c = rotateLeft(c + H(d, a, B) + X[15] + 0x1fa27cf8, S33) + d;
       b = rotateLeft(b + H(c, d, a) + X[ 2] + 0xc4ac5665, S34) + c;

       //
       // Round 4 - K cycle, 16 times.
       //
       a = rotateLeft(a + K(b, c, d) + X[ 0] + 0xf4292244, S41) + b;
       d = rotateLeft(d + K(a, b, c) + X[ 7] + 0x432aff97, S42) + a;
       c = rotateLeft(c + K(d, a, B) + X[14] + 0xab9423a7, S43) + d;
       b = rotateLeft(b + K(c, d, a) + X[ 5] + 0xfc93a039, S44) + c;
       a = rotateLeft(a + K(b, c, d) + X[12] + 0x655b59c3, S41) + b;
       d = rotateLeft(d + K(a, b, c) + X[ 3] + 0x8f0ccc92, S42) + a;
       c = rotateLeft(c + K(d, a, B) + X[10] + 0xffeff47d, S43) + d;
       b = rotateLeft(b + K(c, d, a) + X[ 1] + 0x85845dd1, S44) + c;
       a = rotateLeft(a + K(b, c, d) + X[ 8] + 0x6fa87e4f, S41) + b;
       d = rotateLeft(d + K(a, b, c) + X[15] + 0xfe2ce6e0, S42) + a;
       c = rotateLeft(c + K(d, a, B) + X[ 6] + 0xa3014314, S43) + d;
       b = rotateLeft(b + K(c, d, a) + X[13] + 0x4e0811a1, S44) + c;
       a = rotateLeft(a + K(b, c, d) + X[ 4] + 0xf7537e82, S41) + b;
       d = rotateLeft(d + K(a, b, c) + X[11] + 0xbd3af235, S42) + a;
       c = rotateLeft(c + K(d, a, B) + X[ 2] + 0x2ad7d2bb, S43) + d;
       b = rotateLeft(b + K(c, d, a) + X[ 9] + 0xeb86d391, S44) + c;

       H1 += a;
       H2 += b;
       H3 += c;
       H4 += d;

       //
       // reset the offset and clean out the word buffer.
       //
       xOff = 0;
       for (int i = 0; i != X.length; i++)
       {
           X[i] = 0;
       }
   }
}

/**
* base implementation of MD4 family style digest as outlined in
* "Handbook of Applied Cryptography", pages 344 - 347.
*
* @version $Id: GeneralDigest.java,v 1.2 2004/06/27 17:00:55 bheineman Exp $
*/
abstract class GeneralDigest
//    implements Digest - mdb: we don't care about this interface
{
   private byte[]  xBuf;
   private int     xBufOff;

   private long    byteCount;

 /**
  * Standard constructor
  */
 protected GeneralDigest()
 {
   xBuf = new byte[4];
   xBufOff = 0;
 }

 /**
  * Copy constructor.  We are using copy constructors in place
  * of the Object.clone() interface as this interface is not
  * supported by J2ME.
  */
 protected GeneralDigest(GeneralDigest t)
 {
       xBuf = new byte[t.xBuf.length];
   System.arraycopy(t.xBuf, 0, xBuf, 0, t.xBuf.length);

   xBufOff = t.xBufOff;
   byteCount = t.byteCount;
 }

   public void update(
       byte in)
   {
       xBuf[xBufOff++] = in;

       if (xBufOff == xBuf.length)
       {
           processWord(xBuf, 0);
           xBufOff = 0;
       }

       byteCount++;
   }

   public void update(
       byte[]  in,
       int     inOff,
       int     len)
   {
       //
       // fill the current word
       //
       while ((xBufOff != 0) && (len > 0))
       {
           update(in[inOff]);

           inOff++;
           len--;
       }

       //
       // process whole words.
       //
       while (len > xBuf.length)
       {
           processWord(in, inOff);

           inOff += xBuf.length;
           len -= xBuf.length;
           byteCount += xBuf.length;
       }

       //
       // load in the remainder.
       //
       while (len > 0)
       {
           update(in[inOff]);

           inOff++;
           len--;
       }
   }

   public void finish()
   {
       long    bitLength = (byteCount << 3);

       //
       // add the pad bytes.
       //
       update((byte)128);

       while (xBufOff != 0)
       {
           update((byte)0);
       }

       processLength(bitLength);

       processBlock();
   }

   public void reset()
   {
       byteCount = 0;

       xBufOff = 0;
   for ( int i = 0; i < xBuf.length; i++ ) {
     xBuf[i] = 0;
   }
   }

   protected abstract void processWord(byte[] in, int inOff);

   protected abstract void processLength(long bitLength);

   protected abstract void processBlock();
}

   private int codusername;
   private String username;
   private String password;
   private String mail;
   private String Tipo;
   private DBAccessObj dbo;


public login() {
       this.dbo = new DBAccessObj();
       this.dbo.openConnection();
   }

   public login(DBAccessObj dbo) {
       this.dbo = dbo;
       this.dbo.openConnection();
   }

   /** define o nome do autor
    *
    * @param name nome do autor
    */
   public void setusername(String username) {
       this.username = username;
   }

   public void setpassword(String password) {
       this.password = password;
   }


public void setmail(String mail) {
       this.mail = mail;
   }
public void setTipo(String Tipo){
this.Tipo=Tipo;
}

public String getusername() {
       return username;
   }
 public String getmail() {
       return mail;
   }
   public String getpassword() {
       return password;
   }

public String getTipo() {
       return Tipo;
   }



   public int getCodUsername() {
       return codusername ;
   }


   public void create() throws SQLException{
        try  {

      MessageDigest MD5 = MessageDigest.getInstance("MD5");

 MD5.update(password.getBytes());
 BigInteger hash = new BigInteger(1, MD5.digest());
 password = hash.toString(16);
} catch(NoSuchAlgorithmException ex)  {
 ex.printStackTrace();
}
       String sqlCommand = "INSERT INTO USERNAME (USERNAME, PASSWORD, MAIL, TIPO) VALUES('" + this.username + "', '" + this.password + "', '" + this.mail + "', '" + this.Tipo + "')";

       this.dbo.executeSQL(sqlCommand);

   }

   public void retrievelogin(String username,String password ) throws SQLException{
               try  {

      MessageDigest MD5 = MessageDigest.getInstance("MD5");

 MD5.update(password.getBytes());
 BigInteger hash = new BigInteger(1, MD5.digest());
 password = hash.toString(16);
} catch(NoSuchAlgorithmException ex)  {
 ex.printStackTrace();
}
       String sqlCommand = "SELECT TIPO,PASSWORD FROM USERNAME WHERE USERNAME = '" + username + "AND PASSWORD="+password+"'";
       ResultSet login;

       login = this.dbo.executeQuery(sqlCommand);
       //this.dbo.endTran();

       this.codusername = login.getInt("CODUSERNAME");
       this.username = login.getString("USERNAME");
       this.password = login.getString("PASSWORD");
       this.mail = login.getString("MAIL");
       this.Tipo=login.getString("TIPO");


   }

   public void update() {
       String sqlCommand = "UPDATE USERNAME SET PASSWORD = '" + this.password + "', MAIL = '" + this.mail + "'";

       //this.dbo.beginTran();
       this.dbo.executeSQL(sqlCommand);
       //this.dbo.endTran();
   }

   public void delete() {
       String sqlCommand = "DELETE FROM USERNAME WHERE USERNAME = '" + this.username+ "'";

       //this.dbo.beginTran();
       this.dbo.executeSQL(sqlCommand);
       //this.dbo.endTran();
   }



}

Compartilhar este post


Link para o post
Compartilhar em outros sites

não

estão em projectos diferentes

 

alguem me pode dizer onde esta o erro

 

Se eles estão em projetos diferentes, então você precisa importar as classes do outro projeto no classpath desse projeto.

 

Gere um .jar do outro projeto, e inclua-o no seu classpath.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.