相关疑难解决方法(0)

如何从Windows上的命令行运行Java程序?

我正在尝试从Windows中的命令行执行Java程序.这是我的代码:

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class CopyFile
{
    public static void main(String[] args)
    {

        InputStream inStream = null;
        OutputStream outStream = null;

        try
        {

            File afile = new File("input.txt");
            File bfile = new File("inputCopy.txt");

            inStream = new FileInputStream(afile);
            outStream = new FileOutputStream(bfile);

            byte[] buffer = new byte[1024];

            int length;
            // copy the file content in bytes
            while ((length = inStream.read(buffer)) > 0)
            {

                outStream.write(buffer, 0, length);

            }

            inStream.close();
            outStream.close();

            System.out.println("File is …
Run Code Online (Sandbox Code Playgroud)

java

211
推荐指数
8
解决办法
124万
查看次数

Java命令行参数

我试图检测'a'是否作为第一个字符串参数输入.

java command-line arguments

23
推荐指数
4
解决办法
13万
查看次数

标签 统计

java ×2

arguments ×1

command-line ×1