我必须建立一个决策支持系统,但在Java方面没有太多经验.因此,在我使用Eclipse(使用Connector/J)连接到MySql之后,eclipse开始搞乱我的其他项目.现在,当我尝试在eclipse中运行其他项目时(与MySql无关,例如猜猜游戏),以下错误消息显示:
Launch configuration DocsConnectionPropsHelper references non-existing project MySql connection test.
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决这个问题吗?
UPDATE.似乎当我按下"RUN"时,elcipse没有运行我正在使用的项目,而是其他
有没有办法删除Futon中的多个数据库?我没有在一个数据库中创建多个文档,而是运行了erlang查询并创建了大约3000个数据库.我可以一起批量删除它们吗?谢谢
import java.util.Random;
import java.util.Scanner;
public class Game {
public static void main(String[] args) {
System.out.println("Guess a number betwwen 1 and 1000");
Random rand = new Random();
int secretNumber = rand.nextInt (1000);
Scanner keyboard = new Scanner(System.in);
int guess;
do {
guess = keyboard.nextInt();
if (guess == secretNumber)
System.out.println("You WON!!! Congratulations!");
else if (guess < secretNumber)
System.out.println("Nope, to low");
else if (guess > secretNumber)
System.out.println("Sorry, to high");
} while (guess != secretNumber);
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能在这段代码中添加一条语句,如果不是NUMERIC INPUT System.out.println("输入无效,请仅使用类型编号!")
所以在一个类中我有这个字符串:String LB = lcfield.getText();存储在里面写的任何内容JTextField.在另一个类中,我有一个SQL语句,我需要使用与LB字符串中的任何内容相同的值.
如何调用此字符串?
我试图用MySql数据填充JTable.事情是当我运行Login类时,我收到消息"java.SQLException:没有为参数2指定值",当我运行JTable类时,我一直收到java.lang.NullPointerException错误.我有三个类:1 - 连接到DB:
import java.sql.Connection;
import java.sql.DriverManager;
import javax.swing.JOptionPane;
public class javaconnect {
Connection conn = null;
public static Connection ConnecrDB() {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/mydb",
"root", "root");
JOptionPane.showMessageDialog(null, "Connected");
return con;
} catch (Exception e) {
System.out.println("ERROR: " + e.getMessage());
}
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
第二类是登录框架:
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.*;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.sql.Connection;
import …Run Code Online (Sandbox Code Playgroud)