In response to the problem of low recognition accuracy in identifying vulnerabilities in Java programming language(Java)code injection attacks using existing recognition methods,this article introduces machine learning to conduct research on the design of Java code injection attack vulnerability recognition methods.Gather a wide and diverse sample of Java injection statements,collect data,and generate feature quantities.Through machine learning,achieve the judgment of Java code injection statements.Complete Java code injection vulnerability identifi-cation and prediction through F1 value and accuracy.The experimental results show that the re-search recognition method has higher recognition accuracy,can accurately detect Java code injec-tion attack vulnerabilities,and improve network security.