Abstract:In order to meet the requirements of Java static distributed detection system for decoupling and subcontracting Java program source code package, Java source code file dependency analysis method was proposed. This method is part of single-task multi-node parallel-running distributed detection system which could solve the problem that it takes long time for single-task single-node single-process code detection. The method extracted the Java source code file text information by generating its abstract syntax tree. Then, the method traverses and parses the abstract syntax tree to obtain the file's dependent classes which were not declared in the file. Finally, the dependency relationship between two files was obtained by locating the files where the dependent classes were declared in. The directed cyclic graph with no incident edge vertices was proposed to represent the dependency graph among files. The Java program source code package was decoupled by analyzing the dependency graph. At last, the feasibility of the proposed Java source code file dependency analysis method is verified by two experiments. The first experiment is the step-by-step result analysis of a sample program package. The second experiment is verifying the correctness of decoupling result of several open source tools' source code packages.