初始化错误....找不到可运行的方法...在java.lang.construcor.newinstance [英] Initialisation error....no runnable methods found...at java.lang.construcor.newinstance
本文介绍了初始化错误....找不到可运行的方法...在java.lang.construcor.newinstance的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
import java.sql.*;
//import org.junit.Ignore;
//@Ignore
public class SelectApp {
public SelectApp() {
}
public static void main(String args[]) {
String url = "jdbc:oracle:thin:@localhost:1521:XE";
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection(url, "system", "nachiket");
Statement select = con.createStatement();
ResultSet result = select.executeQuery
("SELECT * FROM HR.EMPLOYEES");
System.out.println("Got results:");
while(result.next()) { // process results one row at a time
System.out.print(result.getInt("EMPLOYEE_ID") + " - ");
System.out.print(result.getString("FIRST_NAME")+ "- " );
System.out.print(result.getString("LAST_NAME")+ " - ");
System.out.println(result.getString("EMAIL"));
}
select.close();
con.close();
}
catch( Exception e ) {
// System.out.println("Failed to load Oracle driver.");
e.printStackTrace();
return;
}
}
}
大家好,
上面是代码,当我运行它时,出现以下错误
Hi all,
Above is the code, when I run it I get following error
Testcase: initializationError(SelectApp): Caused an ERROR
No runnable methods
java.lang.Exception: No runnable methods
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
如果我在任何地方出错,请提供帮助.
Please help, if I am going wrong anywhere.
推荐答案
检查这些
JUnit错误– java.lang.Exception:没有可运行的方法 [ ^ ]
JUnit:如何避免无可运行方法"在测试实用程序类中 [ ^ ]
Check these
JUnit error – java.lang.Exception: No runnable methods[^]
JUnit: how to avoid "no runnable methods" in test utils classes[^]
嘿,谢谢,它起作用了... @ IGNORE也可以起作用..非常感谢.. .
Hey thanks it worked.....also @IGNORE will work....thanks a lot...
这篇关于初始化错误....找不到可运行的方法...在java.lang.construcor.newinstance的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文