Tutorial on the use of automatic document submission information program (Student Version)

Tutorial on the use of automatic document submission information program (Student Version)

Function introduction

Functions realized by this program:

  1. By comparing the student list and the automatically generated file submission list, a list of non submitted personnel is generated
  2. File information not in the student list in the generated file list
  3. Generate duplicate submitted file information

Using tutorials

About using environment

Because this program is developed without too much consideration, it is developed in java language, and the generated file can no longer run without java environment. If there is any demand, you can contact the author, and the email is shown at the end of the text.

Introduction to file directory

  1. The first folder data is used to store the files to be tested; That is, the documents submitted to you by others and the target documents you need to check.
  2. The second file is main Jar is the main program file. When you are ready, double-click this file to generate out Txt and submitlist txt .
  3. The third file is out Txt is the result file, which is automatically generated by the program. This file does not exist before use, and even if it exists, it will not affect the result.
  4. The fourth file is studentllist Txt is a very important file. The data in it is formatted data. Spaces and carriage return are used to segment strings in the source code. Therefore, the format specified in the system is the student number name, such as 20203177xxxx kirk, and then enter the second line. Here, it is suggested to directly copy the table in Excel to this text file. The student number is in front of the name and then after it.
  5. The fifth file is submitlist Txt is the file information detected by the system and the list after extracting the student number, which is automatically generated by the system.

Operation process

It is suggested to import the student list first, that is, in the studentlist Txt file, which can also be created manually. (I need to add the list manually. The side shows that I'm a weak chicken).

Then, put the file to be tested into data.

Finally, double-click main Jar. If no new file information is generated, you can enter the file directory by opening cmd and enter the instruction Java - jar Mian Press enter after jar, and you can see the abnormal operation error message. If you can't solve it, please contact me privately.

Reference code

There are coders to improve this program. Please refer to the source code and customize your own functions.

import java.io.*;
import java.text.*;
import java.util.*;
import java.lang.reflect.Array;
import java.nio.charset.StandardCharsets;

public class Main {
    ArrayList<String> fullList = new ArrayList<>();
    static ArrayList<String> ErrorInfo = new ArrayList<>();
    static ArrayList<String> unknownStu = new ArrayList<>();
    static ArrayList<String> ALlSubmitList = new ArrayList<>();
    static ArrayList<student> stuList;
    static String FilePath = "data";
    static String studentListPath = "studentList.txt";
    static String outPath = "out.txt";
    static String fullListPath = "FullList.txt";
    static String SubmitListPath = "SubmitList.txt";
    static String jarPath;

    public static void main(String[] args) {
        // Initialization file path
//        initPath();

        // Read student list
        stuList = ReadFullList();

        // Read submitted job list
        ArrayList<String> SubmitList = ReadList();
//        System.out.println(ErrorInfo);

        // Get student ID list
        ArrayList<String> IDList = new ArrayList<>();
        for (student student : stuList) {

        // Compare the differences between the two lists
        ArrayList<String> res = CompareList(SubmitList, IDList);

        // Output outstanding list
        printList(res, stuList);


    public static void printAllSubmitList(){
        try {
            BufferedWriter bw = new BufferedWriter(
                    new OutputStreamWriter(new FileOutputStream(
                            SubmitListPath), StandardCharsets.UTF_8)
            for(String string : ALlSubmitList){
                bw.write("*** " + string + "\n");
//                System.out.println(string);
        } catch (IOException e) {
    public static void printList(ArrayList<String> list, ArrayList<student> studentList) {
        try {
            BufferedWriter bw = null;
            bw = new BufferedWriter(new OutputStreamWriter(
                    new FileOutputStream(outPath), StandardCharsets.UTF_8));
//            bw.write(jarPath + "\n");
            bw.write("Job list not submitted:\n");
            for (String string : list) {
//                System.out.println(string);
                int index = studentList.indexOf(new student(string, " "));
                if (index == -1) {
                    System.out.println("not found " + string);
                student stu = studentList.get(index);
//                System.out.println(stu.toString());
                bw.write(string + " - " + stu.getName() + "\n");
            bw.write("\n\n Unknown student information detected:\n");
            for(String string : unknownStu){
                bw.write(string + "\n");

            bw.write("\n\n Abnormal information detected:\n");
            for(String string : ErrorInfo){
                bw.write(string + "\n");
        } catch (IOException e) {

    public static ArrayList<String> CompareList(ArrayList<String> list1,
                                                ArrayList<String> list2) {
        ArrayList<String> UnSubmitList = new ArrayList<>();
        for (String string : list2) {
            if (!list1.contains(string)) {
//                System.out.println(string);
//            System.out.println("ok: " + string);
        return UnSubmitList;

    public static ArrayList<student> ReadFullList() {
        ArrayList<student> StudentList = new ArrayList<>();
        try {
            BufferedReader br = null;
            br = new BufferedReader(new InputStreamReader(
                    new FileInputStream(studentListPath), StandardCharsets.UTF_8));
            while (true) {
                String string = null;
                try {
                    string = br.readLine();
                } catch (IOException e) {
                if (string == null)
                String[] stuInfo = string.split("\t");
                if (stuInfo.length != 2) {
                    System.out.println("studentList error!");
                    unknownStu.add(string + " -- This student information may be incorrect! Read skipped");
                stuInfo[0] = stuInfo[0].trim();
                stuInfo[1] = stuInfo[1].trim();
//                System.out.println(Arrays.toString(stuInfo));
                student stu = new student(stuInfo[0], stuInfo[1]);
            try {
            } catch (IOException e) {
        } catch (FileNotFoundException e) {
        return StudentList;

    public static ArrayList<String> ReadList() {
        File fpFullList = new File(FilePath);
        File[] list = fpFullList.listFiles();
        ArrayList<String> files = new ArrayList<>();
        for (File file : list) {
        files = getStuID(files);
        return files;

    public static ArrayList<String> getStuID(ArrayList<String> files) {
        ArrayList<String> SubmitList = new ArrayList<>();
        for (String string : files) {
            int index = string.indexOf("20");
            if(index == -1){
                ErrorInfo.add("Unknown file information --- Document details:" + string);
            String res = string.substring(index, index + 12);
//            System.out.println(res);
            if (SubmitList.contains(res)) {
                String errorInfo = "";
                errorInfo +="Duplicate file:" + string;
            if(!stuList.contains(new student(res, ""))){
//                System.out.println(res + "xxx");
                unknownStu.add("Unknown student information --- Document details:" + string);
        return SubmitList;

class student {
    private String ID;
    private String name;

    public student(String ID, String name) {
        this.ID = ID;
        this.name = name;

    public String getID() {
        return ID;

    public void setID(String ID) {
        this.ID = ID;

    public String getName() {
        return name;

    public void setName(String name) {
        this.name = name;

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        student student = (student) o;
        return Objects.equals(ID, student.ID);

    public int hashCode() {
        return Objects.hash(ID);

    public String toString() {
        return "student{" +
                "ID='" + ID + '\'' +
                ", name='" + name + '\'' +

class getJarPath{
    public File getCurrentJarDir() {
        try {
            String path = this.getClass().getProtectionDomain().getCodeSource().getLocation().getFile();
            path = java.net.URLDecoder.decode(path, StandardCharsets.UTF_8);
            File file = new File(path);
            if (file.isFile()) {
                return new File(file.getParent());
            } else {
                return file;
        }catch (Exception e){
            throw new RuntimeException(e);

How to say, it's written for your own use. The code is super ugly. It doesn't consider the engineering specifications. I'll have a look. If a big man is willing to change the konjaku for me, of course I will be super happy (send me a copy by the way).


contact information: kirk's mailbox.
About documents: Off the shelf main Jar file Baidu cloud link Extraction code: kirk
You can also chat privately or email me to get the documents

Note one problem (I've encountered): when developing idea software, you should use the absolute path, but you can directly use the relative path to run jar files

ok, you want to give me some praise, don't you? I see.

Tags: Java IDEA

Posted by interface on Fri, 15 Apr 2022 16:45:48 +0930