作者pokl123 (00)
看板java
標題[問題] 不能執行..
時間Sat May 31 02:17:43 2008
可以編譯
但是執行時出現"目前檔案中沒有一個類別程式包含有main"
可是裡面明明就有main..
請問如何解決呢?
擷取main部分
public static void main(String[] args)
{
String datafile = "sudoku.txt";
if (args.length > 1) {
datafile = args[0];
}
System.out.println("Read puzzle file:" + datafile);
ReadPuzzle(datafile);
PrintPuzzle();
// Solve the puzzle
long starttime = System.currentTimeMillis();
SolvePuzzle();
long endtime = System.currentTimeMillis();
System.out.println("\nSolve puzzle in " + (endtime - starttime) +
" microseconds.");
PrintPuzzle();
boolean success = CheckRule();
if (success) {
System.out.println("Good Job!");
}
else {
System.out.println("Oops! test failed, try again.");
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.223.163.126
1F:推 qrtt1:對一下檔名和類別名稱一不一樣 05/31 08:29
2F:推 PsMonkey: z-3-2 先看完 05/31 20:28
3F:→ pokl123:不好意思..我看完還是不知道為什麼耶.. 05/31 21:42
4F:→ csihcs:if main is in class pack.A then cmd line:"java pack.A" 05/31 23:20
5F:→ csihcs:or cmd line:"java -cp . pack.A" 05/31 23:22
6F:推 Victor12:我是java初學者,我也看不太懂,c大的意思是用視窗模式將 06/01 00:17
7F:→ Victor12:class檔封裝嗎?? 06/01 00:19