The invention relates to a method for generating instruction codes in a 
java software watermark virtualizing method. On the basis of a BCEL ((
byte code 
engineering library) class 
library, the method comprises the following steps of (1) loading a 
Java class file which is required to be embedded with instructions through the BCEL class 
library, analyzing the class file and transforming the class file into a 
Java class file object which meets BCEL 
processing requirements; (2) acquiring parameter information, which comprises a classifying method, of the class file from the 
Java class file object, and finding out and taking a virtualizing method from the acquired method; (3) creating a new virtualizing method according to the acquired virtualizing method and the parameter information and replacing the original virtualizing method by using the new virtualizing method; (4) generating instruction codes which are used for embedding 
watermark information and adding the instruction codes in an 
instruction set of the new virtualizing method; and (5) analyzing the 
Java class file by using the new virtualizing method. The method has the advantages that by the method, the instruction codes for embedding the 
watermark information are automatically generated in the virtualizing method through a 
computer program, and the problems that in the prior art, professionals require to manually write the instruction codes, and the manual 
instruction code writing mode is low in universality and does not facilitate actual application.