我的代码没有运行,所以我使用eclipse调试器,一旦我到达printf部分,它就显示一条错误消息:找不到源代码。
下面是调试器错误消息。但是,它仍然在控制台上打印出find,并且仅在调试器窗口中显示错误消息,并且不允许我继续执行存在“真实”错误的下一行。下面是堆栈跟踪。
System.out.printf("a: %d\n", curElement.a);
System.out.printf("%d %d %d %d ", curElement.a, curElement.b, curElement.c, curElement.io);
上面的这两行似乎在调试器窗口中出现“找不到源”错误。你能帮我解决我的printf问题吗?谢谢。
public class Scheduling2 {
public static void main(String args[]) {
try {
String fileAddress = args[0];
File fileInput = new File(fileAddress); //Read
Scanner scan = new Scanner(fileInput);
int numProcesses = scan.nextInt();
Queue<Process> processes = new LinkedList<Process>();
ArrayList<Process> allProcesses = new ArrayList<Process>();
//LinkedList processes = new LinkedList(); //No need to define the size
int currNumProcesses = 0;
//Adding each process to processes queue
for (int m = 0; m < numProcesses; m++) {
int a = scan.nextInt();
int b = scan.nextInt();
int c = scan.nextInt();
int io = scan.nextInt();
Process thisProcess = new Process(a, b, c, io);
thisProcess.id = m;
processes.add(thisProcess);
allProcesses.add(thisProcess);
currNumProcesses++;
}
printQueue(processes, numProcesses);
FCFS(processes, numProcesses, allProcesses);
printQueue(processes, numProcesses);
}
catch (Exception e){
e.printStackTrace();
System.out.printf(" Error: File not foundd. \n");
}
}
public static void printQueue (Queue processes, int numProcesses) {
Process curElement = (Process) processes.poll();
System.out.printf("The original input was: ");
while(curElement != null) {
System.out.printf("a: %d\n", curElement.a);
System.out.printf("%d %d %d %d ", curElement.a, curElement.b, curElement.c, curElement.io);
curElement = (Process) processes.poll();
}
System.out.print("\n\n");
}
红颜莎娜
相关分类