我使用 parse4j 让用户注册一个帐户并登录,以便用户可以在线查看他们的分数问题是我无法运行我的应用程序并且它说很多错误
我将 parse4j-1.0.jar 文件导入到我的 eclipse 项目中,并按照说明编写
这是我的代码
package com.card.lab;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.parse4j.ParseException;
import org.parse4j.ParseUser;
import org.parse4j.callback.LoginCallback;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.parse4j.callback.*;
import org.parse4j.*;
public class SignIN extends JFrame{
JTextField user = new JTextField();
JTextField pass = new JTextField();
JButton signIn = new JButton();
JButton signUp = new JButton();
ParseUser userr = new ParseUser();
ParseUser sign = new ParseUser();
LoginCallback back;
SignIN(){
Parse.initialize("jNKMBNdtX5Vq9tS6jVsNLEO89fvZQ1el2D3xnTeP","ZnhzdUVXXaiDGQRfn1lOXifclxSFQDW18Y7gbQBb");
this.setLayout(new GridLayout(4,1));
this.setBackground(new Color(222,252,226));
this.setSize(400,400);
signIn.setText("SIGN IN");
signUp.setText("SIGN UP");
this.add(user);
this.add(pass);
this.add(signIn);
this.add(signUp);
this.setVisible(true);
signUp.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
userr.setUsername(user.getText());
userr.setPassword(pass.getText());
try {
userr.signUp();
userr.loginInBackground(user.getText(), pass.getText(),back);
if(sign!=null){
System.out.println("LOG IN");
}
else{
System.out.println("ERROR SIGN IN");
}
dispatch();
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
signIn.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
sign.loginInBackground(user.getText(), pass.getText(),back);
if(sign!=null){
System.out.println("LOG IN");
}
else{
System.out.println("ERROR SIGN IN");
}
}
});
}
public void dispatch(){
this.setVisible(false);
this.dispose();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new SignIN();
}
}
错误是
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONException
at com.card.lab.SignIN.<init>(SignIN.java:24)
at com.card.lab.SignIN.main(SignIN.java:87)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
我不明白为什么会这样
任何帮助表示赞赏,如果您需要任何其他信息,请告诉我!
谢谢
更新
我已经导入 parse4j-1.0.jar 和 json-20150729.jar 并且错误已更改为
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.parse4j.ParseObject.<clinit>(ParseObject.java:42)
at com.card.lab.SignIN.<init>(SignIN.java:25)
at com.card.lab.SignIN.main(SignIN.java:88)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more