Ответ 1
Поскольку учебное пособие инструктирует его вручную, вместо использования ant или maven или других инструментов сборки, просто создайте папку с именем META-INF на корневом уровне с подпапкой с именем служб и файл под названием MANIFEST.MF.
Я не уверен, как вы планируете выполнять свой файл jar, теперь вы можете просто поместить эту строку в свой MANIFEST.MF
:
Manifest-Version: 1.0
Для вашей папки служб вам необходимо создать файл с именем com.example.dictionary.spi.Dictionary
со следующим содержимым строки, как указано в учебнике: -
com.example.dictionary.GeneralDictionary
FYI - META-INF - это внутренний метакаталог Java. Как правило, вы хотите полагаться на свой упаковочный инструмент, такой как ant или maven, чтобы создавать содержимое папки META-INF, а не делать это самостоятельно.
Вы можете увидеть подробности о содержании папки META-INF здесь: -
The following files/directories in the META-INF directory are recognized and interpreted by the Java 2 Platform to configure applications, extensions, class loaders and services:
MANIFEST.MF
The manifest file that is used to define extension and package related data.
INDEX.LIST
This file is generated by the new "-i" option of the jar tool, which contains location information for packages defined in an application or extension. It is part of the JarIndex implementation and used by class loaders to speed up their class loading process.
x.SF
The signature file for the JAR file. 'x' stands for the base file name.
x.DSA
The signature block file associated with the signature file with the same base file name. This file stores the digital signature of the corresponding signature file.
services/