Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


bhawana
abt java
1 Answer(s)      4 years ago
Posted in : Java Beginners


hiiiii
i m new to this language
i have some problem with my java code ... i working on netbeans ..
i write a code for user authetication ... in this code it take user name password and a user certificate(which is given by master ) the problem is this that when i run this desktop application on netbeans its works but when i run this by commmand prompt or by double clickin on jar file it gives wrong out put and says certificate is tempered ..
i found out that when it reads that file by executing in netbeans it reads its correctly but when i run this program by command prompt the file contents change ...
i dnt know why ... plz help

Advertisement
View Answers

August 6, 2010 at 12:43 PM


Hi Friend,

It seems that you haven't set the Path variable in Environment Variables. Anyways we are sending you the Login Code in swings.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
class LoginDemo extends JFrame{
JButton SUBMIT;
JPanel panel;
JLabel label1,label2;
final JTextField text1;
final JPasswordField text2;
LoginDemo(){
label1 = new JLabel();
label1.setText("UserName:");
text1 = new JTextField(15);
label2 = new JLabel();
label2.setText("Password:");
text2 = new JPasswordField(15);
SUBMIT=new JButton("Login");
panel=new JPanel(new GridLayout(4,2));
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
panel.add(SUBMIT);
add(panel,BorderLayout.CENTER);
SUBMIT.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
String value1=text1.getText();
String value2=text2.getText();
String user1="";
String pass1="";
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test";, "root", "root");
Statement st = con.createStatement();
ResultSet res = st.executeQuery("SELECT * FROM login where username='"+value1+"' && password='"+value2+"'");
while (res.next()) {
user1 = res.getString("username");
pass1 = res.getString("password");
}
if (value1.equals(user1) && value2.equals(pass1)) {
JOptionPane.showMessageDialog(null,"Welcome");
}
else{
JOptionPane.showMessageDialog(null,"Incorrect login or password","Error",JOptionPane.ERROR_MESSAGE);
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
});
}
public static void main(String arg[]) {
LoginDemo frame=new LoginDemo();
frame.pack();
frame.setVisible(true);
}
}

Thanks


Related Tutorials/Questions & Answers:
abt proj - Java Beginners
abt proj  which topic i have to study carefully ,when I am going to start java project using swings  Hi Friend, Learn awt, swing... http://www.roseindia.net/java/example/java/awt/ http://www.roseindia.net
abt java project - Java Beginners
abt java project  if we want to create a pannel on the button how to write on the code in side the button plz help
Advertisements
abt java - Java Beginners
abt java   hiiiii i m new to this language i have some problem with my java code ... i working on netbeans .. i write a code for user authetication ... in this code it take user name password and a user certificate(which
abt proj - Java Beginners
abt proj  if we have already make login page and resister page, if i click on the login button we go to the home page ,home page contain some data plz help
abt proj - Java Beginners
abt proj  I made login page, when i click on login button , thaen how to go on home page on home page containe some tab like add, delete, update,etc... the following link: http://www.roseindia.net/java/example/java/swing/add_edit_and_delete
abt java project - Java Beginners
abt java project  I don't know too much about java , and I am working on java project, where editor is eclipse and backend postgresql How can i take help about my project, which book I should refers plz help me
abt java project - Java Beginners
abt java project  How to make the home page that contain four tabbedPane like additem, deleteitem ,update etc, so plz help me thanx  Hi.../java/example/java/swing/add_edit_and_delete_employee_inf.shtml If you want
abt java project - Java Beginners
abt java project  this program compile sucessfully but data is not store in data base if any thing correction plz do it import java.awt.*; import javax.swing.*; import java.sql.*; import java.awt.event.*; public class
absolutely no idea abt a program - Java Beginners
absolutely no idea abt a program  write a program in java/blue...(" "); System.out.print(arr[j]); } } } For more information on java visit to : http://www.roseindia.net/java Thanks
abt jmeter - Java Server Faces Questions
abt jmeter  how to use jmeter for testing the program?   Hi friend, For using jmeter for testing visit to : http://www.roseindia.net/jmeter/ http://www.roseindia.net/jmeter/using-jmeter.shtml Thanks
abt the bank application
abt the bank application  pls can u send to me the user table and transaction table sql statement with their datatype used in this bank application to my email
need to ans abt db - JSP-Servlet
need to ans abt db  helllo can you tell me m just starting to knowing abt servlet and i trying to making e-mail site so can you tell me with the java servlet wht is the backhand database to use to proper with that site
java programming - Java Beginners
java programming  heloo expert, thanks for your coding i recently asked about the question on abt how to program a atm system may i noe in which platform can i run those codes ?? netbeans ?? any suggestions
Platform Independent In Java - Java Beginners
Platform Independent In Java   Hi Friends, I want to know abt platform indepent in java. Write once run anywhere means, after compilation wil get .class file. Can we execute .class file in another platform
java - Java Beginners
java  how i can get information abt the installed softwares of an operating system
scope of Java Swing in IT ?
scope of Java Swing in IT ?  Hi....... I am fresher ,now I m working in Java Swing developing desktop apps. I am confused abt use of Java Swing... the "How much scope of Java Swing in IT now ?" & wht should i do
Java sorting
Java sorting  can somebody help me know how java sorts? means which... the following links: Java bubble sort Java Heap Sort Java Insertion Sort Java Merge Sort Java Selection Sort Java Quick Sort   hello
HSQLDB - Java Server Faces Questions
HSQLDB  HSQLDB IS THERE ANYBODY knows abt hsqldb,anybody is thr contact me i want to know
Java
have clear idea abt this, Please help me, Its very urgent. Kindly provide me
Interview question - Java Interview Questions
Interview question   Hi Friends, Give me details abt synchronization in interview point of view. I mean ow to explain short and neat. Thanks
Synchronization with Multithreading - Java Beginners
i know abt synchronization is , we can implement synchronized keyword... information on Thread visit to : http://www.roseindia.net/java/thread/SynchronizedThreads.shtml http://www.roseindia.net/java/thread/ Thanks
Abstract class - Java Beginners
Abstract class  Why can use abstract class in java.?when abstract class use in java.plz Explain with program.   abstract class abs{ public... are overrided in which that is implemented . thats all abt abstract classes
Java Barcode Program with Oracle database
idea abt this...Please can anyone give me some idea. Do I need to buy Java...Java Barcode Program with Oracle database  Hi Everyone, I need help.... Please explain in detail as am new to this Java Barcode. I am dealing
java - Java Beginners
java  if m required to determine if x is a perfect number hw do i go abt doing it   Hi friend, Use the following code: public class PerfectNumber{ public static void main(String[]args){ int x = 28; int
counting identifiers,no.of inputs and outputs - Java Magazine
is the basic for me.......... can any one help me abt this by giving guidelines... not getting....... plsssssss any one tell me it can be java for example #include
java - Development process
and concurrent programming paradigms of Java. Use JDBC to connect to a back-end... KUMARESH for my sister DHANA // And dedicated to my java Professor... fMenu; JMenu hMenu; JMenuItem hMen, abt; JMenuItem eMen
Clustering
Clustering  Plz let me know abt Clustering in Java with an example
java
java  diff bt core java and java
java
java  what is java
when do we get null pointer exception in java
when do we get null pointer exception in java  can anybody explain me abt null pointer exception? like in wt situation do v get NPE? Are these 2 strings same? String str; String str=null
Java
Java   Whether Java is pure object oriented Language
java
java  different between java & core java
java
java  explain technologies are used in java now days and structure java
java
java   why iterator in java if we for loop
JAVA
JAVA  how the name came for java language as "JAVA
java
java  is java open source
java
java  what is java reflection
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
java  write a java program using filenotfoundexception
Java
Java  how to draw class diagrams in java
java
java   difference between class and interface
java
java  explain object oriented concept in java
java
java  is java purely object oriented language
Java
Java   Whether Java is Programming Language or it is SOftware
java
java  what are JAVA applications development tools
java
java  how use java method
java
java  send me java interview questions
java
java  Write a java code to print "ABABBABCABABBA
java
java  why to set classpath in java
Advertisements
 

 

 

DMCA.com