We are working on java classes in order to customize it. Before this customization, we just want to check compile/decompile process of existing java jar file (MMC.jar).
We collected all java class file under MMC.jar using jd-gui tool
So when we were compiling the existing MMC.jar (without customization) it is giving attached 6 errors
./com/mmc/model/acknowledgement/package-info.java:7: error: illegal start of
type abstract interface package-info {}
^
./com/mmc/model/acknowledgement/package-info.java:7: error: = expected
abstract interface package-info {}
^
./com/mmc/model/customer/package-info.java:7: error: <identifier> expected
abstract interface package-info {}
^
./com/mmc/model/customer/package-info.java:7: error: illegal start of type
abstract interface package-info {}
^
./com/mmc/model/customer/package-info.java:7: error: = expected
abstract interface package-info {}
^
6 errors
This is the content of package-info java file
package com.mmc.model.customer;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;
@XmlSchema(namespace="http://www.iflex.com/mmc/model/customer",
elementFormDefault=XmlNsForm.QUALIFIED)
abstract interface package-info {}
Regards Ali
The reason you've got compilation error is package-info is not allowed identifier. You cannot name objects like classes, interfaces, variables, etc, with - character. See this answer for more detail Naming rules .
But the problem is that you use package info file in wrong way. The aim of package-info.java file is to add brief description of package in javadoc: what the purpose of this package, responsibilities and contents. You shouldn't declare any classes or interface here. All you need to write in this file is package name in which this file located and package summary javadoc. A @sidgate comment refers to a good answer about package info file responsibility.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.