
打开Eclipse编简单程序,点击Run后d出create,manage and run configurations界面
具体也不大清楚怎么解决的,反正先是build了一下下,然后在ran as时就可以点击java applet或者java application了,我选择的后者,就可以运行出结果了
( 这个是转发的,供您参考,因为你这样的情况我没有遇到过)
照这个来吧,兄弟你写的代码很不规范,好好看看吧
public class DB {
public static Connection getConn() {
Connection conn = null;
try {
ClassforName("commysqljdbcDriver");
conn = DriverManagergetConnection("jdbc:mysql://localhost:3306/emsuser=root&password=root");
} catch (ClassNotFoundException e) {
eprintStackTrace();
} catch (SQLException e) {
eprintStackTrace();
}
/DataSource ds = null;
try {
Context initContext = new InitialContext();
Context ctx = (Context)initContextlookup("java:comp/env");
ds = (DataSource)ctxlookup("jdbc/ems");
Systemoutprintln("DataSourcegetConnection()");
conn = dsgetConnection();
} catch (Exception e) {
// TODO Auto-generated catch block
eprintStackTrace();
}/
return conn;
}
public static Statement getStatement(Connection conn) {
Statement stmt = null;
try {
if(conn != null) {
stmt = conncreateStatement();
}
} catch (SQLException e) {
eprintStackTrace();
}
return stmt;
}
public static ResultSet getResultSet(Statement stmt, String sql) {
ResultSet rs = null;
try {
if(stmt != null) {
rs = stmtexecuteQuery(sql);
}
} catch (SQLException e) {
eprintStackTrace();
}
return rs;
}
public static void closeConn(Connection conn) {
try {
if(conn != null) {
connclose();
conn = null;
}
} catch (SQLException e) {
eprintStackTrace();
}
}
public static void closeStmt(Statement stmt) {
try {
if(stmt != null) {
stmtclose();
stmt = null;
}
} catch (SQLException e) {
eprintStackTrace();
}
}
public static void closeRs(ResultSet rs) {
try {
if(rs != null) {
rsclose();
rs = null;
}
} catch (SQLException e) {
eprintStackTrace();
}
}
}
你都没有在Start类里的search里面将数组元素赋值,怎么可能输出遍历?你应该在search里面加上一句话
divinitial;将数组元素赋值。否则里面的元素都是null,都break了 所以没结果
Start类:其中的search()方法是实现遍历数组。
public class Start {
public void search(){
DVDSet dvd=new DVDSet();
divinitial();
for(int i=0;i<dvdnamelength;i++){
if(dvdname[i]==null){
break;
}else if(dvdstate[i]==0){ S
ystemoutprintln((i+1)+"\t已借出\t"+"<<"+dvdname[i]+">>\t"+dvddate[i]);
}else if(dvdstate[i]==1){
Systemoutprintln((i+1)+"\t可借\t"+"<<"+dvdname[i]+">>");
}
}
}
}
main方法:
public static void main(String[] args) {
Strat start = new Start();
startsearch();
}
你写的有点乱,我没测试,错的地方就是没初始化,你看看
解决方案1:
把ImagePlayjava文件和现在这个文件放到同一个项目的src目录下,然后正常运行。
解决方案2:
编译成class文件运行。
解决方案3:
按钮的事件监听
import javaawteventActionEvent;
import javaawteventActionListener;
import javaxswingJButton;
import javaxswingJFrame;
public class Read extends JFrame implements ActionListener {
private static final long serialVersionUID = 257376847217197209L;
JButton ReadPicture;
public Read() {
ReadPicture = new JButton("往事回顾");
ReadPicturesetActionCommand("save");
ReadPictureaddActionListener(this);
thisadd(ReadPicture);
thissetSize(200, 100);
thissetVisible(true);
thissetDefaultCloseOperation(JFrameEXIT_ON_CLOSE);
}
@Override
public void actionPerformed(ActionEvent e) {
if (egetActionCommand()equals("save")) {
// 这里面写要运行的另外一个java文件
Systemoutprintln("ImagePlayjava");
}
}
}
解决方案4:
文件放到同一个项目的src目录下或给一个绝对路径,在添加一个鼠标监听事件就可以
需要什么就建什么类,用数组代替数据库保存信息就行了。 主类应该是一个BMS(BookManageSystem),由于你不用数据库,所以数组随便放在哪里都可以。
主类用来执行增删改查 *** 作,数组里面放书的,将书建成一个类(Book),里面定义书应该有的属性,书名,书的作者,书的内容。。。。然后将书当做元素放进数组里面。增删改查就是对存放书的这个数组 *** 作就行了。
以上就是关于Java运行时出现Create,manage,and runconfigurations什么意思啊 急求全部的内容,包括:Java运行时出现Create,manage,and runconfigurations什么意思啊 急求、我用java写了一个登录窗口出现了问题。、请问:JAVA中两个类中的方法都需要调用另一个类的数组进行对数组的初始化和调用。等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)