The SourceDir attribute specifies the source directory of the Java source file for this class.
Attribute Level | Generated By Directives |
Class | N/A |
SourceDir_attribute { u2 attribute_name_index; u4 attribute_length; u2 sourcedir_index; }
attribute_name_index
This value must be a valid index into the constant_pool table. The constant_pool entry at that index must be the CONSTANT_Utf8_info structure representing the string "SourceDir".
attribute_length
This value indicates the length of this attribute, excluding the initial six bytes, and must be two.
sourcedir_index
This value must be a valid index into the constant_pool table. The constant_pool entry at that index must be the CONSTANT_Utf8_info structure representing the string name of the source directory for the source file from which this class file was compiled.
The name of the source file is provided in the SourceFile attribute defined by The Java Virtual Machine Specification by Addison Wesley. The SourceDir attribute represents the name of the directory containing this source file.