gpt4 book ai didi

java - Java中的奇怪错误

转载 作者:行者123 更新时间:2023-11-30 11:43:04 25 4
gpt4 key购买 nike

<分区>

谁能说出为什么会出现此错误,因为如果您将工作放在终端中?这是代码。

我使用这段代码来编译一个文件夹中的所有文件。

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Compiles {
public static void main(String[] args) {
List<String> compileFileCommand = new ArrayList<String>();
List<String> files = new FileList().getListFile();
List<String> libs = new ListLib().getListFile();
compileFileCommand.add("/opt/java/bin/javac");

for(int i = 0; i < files.size(); i++)
{

if(files.get(i).equals("Compiles.java"))
continue;

if(files.get(i).equals("Compile.java"))
continue;

String fileJar = new CreateFolder().currentData() + "/" + files.get(i) + " -cp lib/";

// for (int y = 0; y < libs.size(); y++)
// {
// fileJar += libs.get(y) + ":";
// if(libs.size() -1 == y)
// fileJar += libs.get(y);
// }

fileJar += libs.get(0);



compileFileCommand.add(fileJar);

Process compile_process;
try {
compile_process = new ProcessBuilder(compileFileCommand)
.redirectErrorStream(true).start();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
try {
compile_process.waitFor();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

BufferedReader reader = new BufferedReader(new InputStreamReader(
compile_process.getInputStream()));
String line = null;
try {
line = reader.readLine();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
while (line != null) {
System.out.println(line);
try {
line = reader.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}

错误如下

javac: invalid flag: temp_11.07.2012/CreateFolder.java -cp lib/gdata-media-1.0.jar
Usage: javac <options> <source files>
use -help for a list of possible options

这些是数据的例子,这就是给出的

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com