我主要通过intelliJ创建AFN,简单的类和项目结构,但是出现错误:
Java HotSpot(TM)64位服务器VM警告:仅支持共享 对于引导程序类,因为已经附加了引导程序类路径
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>saenyravalyris</groupId>
<artifactId>saenyravalyris</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
Main.java
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
Long linesNumber;
int lineNumber = 0;
ArrayList<String> states = new ArrayList<>();
ArrayList<String> entries = new ArrayList<>();
String initialState = "";
String finalState = "";
try {
FileReader leitor = new FileReader("config.txt");
BufferedReader buffer = new BufferedReader(leitor, 2 * 1024 * 1024);
linesNumber = buffer.lines().count();
String line = buffer.readLine();
while (line != null) {
System.out.print(line + "\n");
ArrayList<String> splitResults = new ArrayList<>();
splitResults.addAll(Arrays.asList(line.split(" ")));
if(lineNumber == 1) {
states.addAll(splitResults);
} else if(lineNumber == 2) {
entries.addAll(splitResults);
} else if(lineNumber == linesNumber - 1) {
initialState = line;
} else if(lineNumber == linesNumber) {
finalState = line;
} else {
String matrix[][] = new String[states.size()][entries.size()];
int matrixLine = 0;
int matrixColumn = 0;
for (matrixLine = 0; matrixLine <= entries.size(); matrixLine++) {
for (matrixColumn = 0; matrixColumn <= states.size(); matrixColumn++) {
matrix[matrixLine][matrixColumn] = line;
}
}
System.out.print(matrix);
}
line = buffer.readLine();
lineNumber = lineNumber + 1;
Thread.sleep(1000);
System.out.print(states);
System.out.print(entries);
System.out.print(initialState);
System.out.print(finalState);
}
} catch (FileNotFoundException ex) {
System.out.print(ex);
}
}
}
我进行了一些研究,但没有找到可以解决该问题的解决方案。会是Intellij还是我的Java版本?