Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/376.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 通过Netbeans编译,而不是';不能通过CMD编译_Javascript_Java_Storage - Fatal编程技术网

Javascript 通过Netbeans编译,而不是';不能通过CMD编译

Javascript 通过Netbeans编译,而不是';不能通过CMD编译,javascript,java,storage,Javascript,Java,Storage,我有我的代码来处理存储管理 页面替换方法分配。我的代码可以通过Netbeans工作,但不能通过CMD编译 你知道为什么吗 public class Paging { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException, IOException, IOException, IOException { BufferedRead

我有我的代码来处理存储管理 页面替换方法分配。我的代码可以通过Netbeans工作,但不能通过CMD编译

你知道为什么吗

public class Paging {

/**
 * @param args the command line arguments
 */
public static void main(String[] args) throws IOException, IOException, IOException, IOException {

    BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));

     try {
    URL url = new URL("www.csc.liv.ac.uk/~ped/COMP104/COMP104-2016-17/Page_Trace_Oldest");       

    URL url3 = new URL("www.csc.liv.ac.uk/~ped/COMP104/COMP104-2016-17/Page_Trace_Random");

    BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
    String str;
    while ((str = in.readLine()) != null) {
        str = in.readLine().toString();
        System.out.println(str);
     }
    in.close();
} catch (MalformedURLException e) {
} catch (IOException e) {
}
     URL url2 = new URL("www.csc.liv.ac.uk/~ped/COMP104/COMP104-2016-17/Page_Trace_LRU");
     BufferedReader in = new BufferedReader(new InputStreamReader(url2.openStream()));
    String str2;
    while ((str2 = in.readLine()) != null) {
        str2 = in.readLine().toString();
        System.out.println(str2);
     }
    in.close();

    URL url3 = new URL("www.csc.liv.ac.uk/~ped/COMP104/COMP104-2016-17/Page_Trace_Random");
     BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
    String str3;
    while ((str3 = in.readLine()) != null) {
        str2 = in.readLine().toString();
        System.out.println(str3);
     }
    in.close();



    int f, page = 0, ch, pgf = 0, n = 0, chn = 0;

    boolean flag;
    int pages[];
    do {

        System.out.println("Menu");
        System.out.println("1.FIFO");
        System.out.println("2.LRU");

        System.out.println("3.LFU");

        System.out.println("4.EXIT");

        System.out.println("ENTER YOUR CHOICE: ");

        try {
            ch = Integer.parseInt(obj.readLine());
        } catch (IOException ex) {
            Logger.getLogger(Paging.class.getName()).log(Level.SEVERE, null, ex);
        }

        switch (ch) {

            case 1:

                int pt = 0;

                System.out.println("Enter no. of frames (1-8): ");

                f = Integer.parseInt(obj.readLine());

                int frame[] = new int[f];

                for (int i = 0; i < f; i++) {

                    frame[i] = -1;

                }

                System.out.println("enter the no of pages ");

                n = Integer.parseInt(obj.readLine());

                pages = new int[n];

                System.out.println("enter the page no ");

                for (int j = 0; j < n; j++) {
                    pages[j] = Integer.parseInt(obj.readLine());
                }

                do {

                    int pg = 0;

                    for (pg = 0; pg < n; pg++) {

                        page = pages[pg];

                        flag = true;

                        for (int j = 0; j < f; j++) {

                            if (page == frame[j]) {

                                flag = false;

                                break;

                            }

                        }

                        if (flag) {

                            frame[pt] = page;

                            pt++;

                            if (pt == f) {
                                pt = 0;
                            }

                            System.out.print("frame :");

                            for (int j = 0; j < f; j++) {
                                System.out.print(frame[j] + "   ");
                            }

                            System.out.println();

                            pgf++;

                        } else {

                            System.out.print("frame :");

                            for (int j = 0; j < f; j++) {
                                System.out.print(frame[j] + "  ");
                            }

                            System.out.println();

                        }

                        chn++;

                    }

                } while (chn != n);

                System.out.println("Page fault:" + pgf);

                break;

            case 2:

                int k = 0;

                System.out.println("enter no. of frames: ");

        {
            try {
                f = Integer.parseInt(obj.readLine());
            } catch (IOException ex) {
                Logger.getLogger(Paging.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

                int frame1[] = new int[f];

                int a[] = new int[f];

                int b[] = new int[f];

                for (int i = 0; i < f; i++) {

                    frame1[i] = -1;

                    a[i] = -1;

                    b[i] = -1;

                }

                System.out.println("enter the no of pages ");

        {
            try {
                n = Integer.parseInt(obj.readLine());
            } catch (IOException ex) {
                Logger.getLogger(Paging.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

                pages = new int[n];

                System.out.println("enter the page no ");

                for (int j = 0; j < n; j++) {
            try {
                pages[j] = Integer.parseInt(obj.readLine());
            } catch (IOException ex) {
                Logger.getLogger(Paging.class.getName()).log(Level.SEVERE, null, ex);
            }
                }

                do {

                    int pg = 0;

                    for (pg = 0; pg < n; pg++) {

                        page = pages[pg];

                        flag = true;

                        for (int j = 0; j < f; j++) {

                            if (page == frame1[j]) {
                                flag = false;
                                break;
                            }

                        }

                        for (int j = 0; j < f && flag; j++) {

                            if (frame1[j] == a[f - 1]) {
                                k = j;

                                break;
                            }

                        }

                        if (flag) {

                            frame1[k] = page;

                            System.out.println("frame :");

                            for (int j = 0; j < f; j++) {
                                System.out.print(frame1[j] + "  ");
                            }

                            pgf++;

                            System.out.println();

                        } else {

                            System.out.println("frame :");

                            for (int j = 0; j < f; j++) {
                                System.out.print(frame1[j] + "  ");
                            }

                            System.out.println();

                        }

                        int p = 1;

                        b[0] = page;

                        for (int j = 0; j < a.length; j++) {

                            if (page != a[j] && p < f) {

                                b[p] = a[j];

                                p++;

                            }

                        }

                        for (int j = 0; j < f; j++) {

                            a[j] = b[j];

                        }

                        chn++;

                    }

                } while (chn != n);

                System.out.println("Page fault:" + pgf);

                break;

            case 3:

                k = 0;

                pgf = 0;

                int sml;

                System.out.println("enter no. of frames: ");

        {
            try {
                f = Integer.parseInt(obj.readLine());
            } catch (IOException ex) {
                Logger.getLogger(Paging.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

                int frame2[] = new int[f];

                int cnt[] = new int[f];

                flag = true;

                for (int i = 0; i < f; i++) {

                    frame2[i] = -1;

                    cnt[i] = 0;

                }

                System.out.println("enter the no of pages ");

        {
            try {
                n = Integer.parseInt(obj.readLine());
            } catch (IOException ex) {
                Logger.getLogger(Paging.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

                pages = new int[n];

                System.out.println("enter the page no ");

                for (int j = 0; j < n; j++) {
            try {
                pages[j] = Integer.parseInt(obj.readLine());
            } catch (IOException ex) {
                Logger.getLogger(Paging.class.getName()).log(Level.SEVERE, null, ex);
            }
                }

                do {

                    int pg = 0;

                    for (pg = 0; pg < n; pg++) {

                        page = pages[pg];

                        flag = true;

                        for (int j = 0; j < f; j++) {

                            if (page == frame2[j]) {

                                flag = false;

                                cnt[j]++;

                                break;

                            }

                        }

                        if (flag) {

                            sml = cnt[0];

                            for (int j = 0; j < f; j++) {

                                if (cnt[j] < sml) {

                                    sml = cnt[j];

                                    break;

                                }

                            }

                            for (int j = 0; j < f; j++) {

                                if (sml == cnt[j]) {

                                    frame2[j] = page;

                                    k = j;

                                    break;

                                }

                            }

                            cnt[k] = 1;

                            System.out.print("frame :");

                            for (int j = 0; j < f; j++) {

                                System.out.print(frame2[j] + "   ");

                                System.out.println();

                                pgf++;

                            }

                        } else {

                            System.out.print("frame :");

                            for (int j = 0; j < f; j++) {
                                System.out.print(frame2[j] + "  ");
                            }

                            System.out.println();

                        }

                        chn++;

                    }

                } while (chn != n);

                System.out.println("Page fault:" + pgf);

                break;

            case 4:

                break;

        }

    } while (ch != 4);
}
公共类分页{
/**
*@param指定命令行参数
*/
公共静态void main(字符串[]args)抛出IOException、IOException、IOException、IOException{
BufferedReader obj=新的BufferedReader(新的InputStreamReader(System.in));
试一试{
URL=新的URL(“www.csc.liv.ac.uk/~ped/COMP104/COMP104-2016-17/Page_Trace_laster”);
URL url3=新URL(“www.csc.liv.ac.uk/~ped/COMP104/COMP104-2016-17/Page_Trace_Random”);
BufferedReader in=新的BufferedReader(新的InputStreamReader(url.openStream());
字符串str;
而((str=in.readLine())!=null){
str=in.readLine().toString();
系统输出打印项次(str);
}
in.close();
}捕获(格式错误){
}捕获(IOE异常){
}
URL url2=新URL(“www.csc.liv.ac.uk/~ped/COMP104/COMP104-2016-17/Page_Trace_LRU”);
BufferedReader in=新的BufferedReader(新的InputStreamReader(url2.openStream());
字符串str2;
而((str2=in.readLine())!=null){
str2=in.readLine().toString();
系统输出打印项次(str2);
}
in.close();
URL url3=新URL(“www.csc.liv.ac.uk/~ped/COMP104/COMP104-2016-17/Page_Trace_Random”);
BufferedReader in=新的BufferedReader(新的InputStreamReader(url.openStream());
字符串str3;
而((str3=in.readLine())!=null){
str2=in.readLine().toString();
系统输出打印项次(str3);
}
in.close();
intf,page=0,ch,pgf=0,n=0,chn=0;
布尔标志;
整版[];
做{
System.out.println(“菜单”);
System.out.println(“1.FIFO”);
System.out.println(“2.LRU”);
System.out.println(“3.LFU”);
System.out.println(“4.EXIT”);
System.out.println(“输入您的选择:”);
试一试{
ch=Integer.parseInt(obj.readLine());
}捕获(IOEX异常){
Logger.getLogger(Paging.class.getName()).log(Level.SEVERE,null,ex);
}
开关(ch){
案例1:
int pt=0;
System.out.println(“输入帧数(1-8):”;
f=Integer.parseInt(obj.readLine());
整数帧[]=新整数[f];
对于(int i=0;iURL url2 = new URL("www.csc.liv.ac.uk/~ped/COMP104/COMP104-2016-17/Page_Trace_LRU");
BufferedReader in = new BufferedReader(new InputStreamReader(url2.openStream()));
URL url3 = new URL("www.csc.liv.ac.uk/~ped/COMP104/COMP104-2016-17/Page_Trace_Random");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));