.java
files are present in this folder exposeservices
.
I am trying to convert these .java
files to .class
files using the below command.
These .java
files have import statements so I have downloaded the jars as external dependency and supplying the path to java via the classpath
command.These external dependent jars are present in the /Users/Desktop/jarscheck/
folder.
What am I actually trying to do ?
I had some WSDL files which I am trying to package it into a jar file using wsimport
, since this is deprecated above Java 9 I guess, I have parsed the WSDL file and now want to convert those to .class file so that I can create a JAR file
Enviornment: JDK 17
Which path am I executing the below command ?
cd "/Users/Desktop/workspace/GitHub/jar generation/api-config-elements/exposeservices"
command
javac -classpath ".:/Users/Desktop/jarscheck/jakarta.annotation-api-1.3.5.jar" -sourcepath "/Users/Desktop/workspace/GitHub/jar generation/api-config-elements/exposeservices" *.java
Error that I am getting is,
ApiConfig.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiConfig.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ApiConfig.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlSeeAlso;
^
ApiConfig.java:8: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiElements.java:4: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiElements.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiElements.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ApiElements.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlSeeAlso;
^
ApiElements.java:8: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiElements.java:30: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
External dependent jars
Steps I have tried before,
I have referred to this,
Compiling Java files with the dependent jars using windows Cmd
Result: I got the same errors above.
2.I also referred to this, Compile and run java program with mutiple external jar files
I still got the same errors.
Edited: After trying out the suggestion from the comments these are the errors,
ApiPaymentGateway.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiPaymentGateway.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiPaymentGateway.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElementRef;
^
ApiPaymentGateway.java:8: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlRootElement;
^
ApiPaymentGateway.java:9: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiPaymentGateway.java:31: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ApiPaymentGateway.java:32: error: cannot find symbol
@XmlType(name = "", propOrder = {
^
symbol: class XmlType
ApiPaymentGateway.java:35: error: cannot find symbol
@XmlRootElement(name = "ApiPaymentGateway", namespace = "http://tempuri.org/")
^
symbol: class XmlRootElement
ApiPaymentGateway.java:39: error: cannot find symbol
protected JAXBElement<ApiOrders> aApiOrders;
^
symbol: class JAXBElement
location: class ApiPaymentGateway
ApiOrders.java:4: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiOrders.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiOrders.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ApiOrders.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiOrders.java:32: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ApiOrders.java:33: error: cannot find symbol
@XmlType(name = "ApiOrders", propOrder = {
^
symbol: class XmlType
ApiPaymentGateway.java:49: error: cannot find symbol
public JAXBElement<ApiOrders> getAApiOrders() {
^
symbol: class JAXBElement
location: class ApiPaymentGateway
ApiPaymentGateway.java:61: error: cannot find symbol
public void setAApiOrders(JAXBElement<ApiOrders> value) {
^
symbol: class JAXBElement
location: class ApiPaymentGateway
ApiShipping.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiShipping.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiShipping.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ApiShipping.java:8: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlSchemaType;
^
ApiShipping.java:9: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiShipping.java:35: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ApiShipping.java:36: error: cannot find symbol
@XmlType(name = "ApiShipping", propOrder = {
^
symbol: class XmlType
ApiPaymentGatewayResponse.java:4: error: package jakarta.xml.bind does not exist
import jakarta.xml.bind.JAXBElement;
^
ApiPaymentGatewayResponse.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiPaymentGatewayResponse.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiPaymentGatewayResponse.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElementRef;
^
ApiPaymentGatewayResponse.java:8: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlRootElement;
^
ApiPaymentGatewayResponse.java:9: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiPaymentGatewayResponse.java:31: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ApiPaymentGatewayResponse.java:32: error: cannot find symbol
@XmlType(name = "", propOrder = {
^
symbol: class XmlType
ApiPaymentGatewayResponse.java:35: error: cannot find symbol
@XmlRootElement(name = "ApiPaymentGatewayResponse", namespace = "http://tempuri.org/")
^
symbol: class XmlRootElement
ApiPaymentGatewayResponse.java:39: error: cannot find symbol
protected JAXBElement<ApiTracking> ApiPaymentGatewayResult;
^
symbol: class JAXBElement
location: class ApiPaymentGatewayResponse
ApiTracking.java:4: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiTracking.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiTracking.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ApiTracking.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlSeeAlso;
^
ApiTracking.java:8: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiTypeInfo.java:4: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiTypeInfo.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiTypeInfo.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ApiTypeInfo.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlSeeAlso;
^
ApiTypeInfo.java:8: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiTypeInfo.java:30: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ApiTypeInfo.java:31: error: cannot find symbol
@XmlType(name = "ApiTypeInfo", propOrder = {
^
symbol: class XmlType
ApiTypeInfo.java:34: error: cannot find symbol
@XmlSeeAlso({
^
symbol: class XmlSeeAlso
ApiTracking.java:30: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ApiTracking.java:31: error: cannot find symbol
@XmlType(name = "ApiTracking", propOrder = {
^
symbol: class XmlType
ApiTracking.java:34: error: cannot find symbol
@XmlSeeAlso({
^
symbol: class XmlSeeAlso
ApiPaymentGatewayResponse.java:49: error: cannot find symbol
public JAXBElement<ApiTracking> getApiPaymentGatewayResult() {
^
symbol: class JAXBElement
location: class ApiPaymentGatewayResponse
ApiPaymentGatewayResponse.java:61: error: cannot find symbol
public void setApiPaymentGatewayResult(JAXBElement<ApiTracking> value) {
^
symbol: class JAXBElement
location: class ApiPaymentGatewayResponse
ApiStockHouse.java:4: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiStockHouse.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiStockHouse.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiStockHouse.java:30: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ApiStockHouse.java:31: error: cannot find symbol
@XmlType(name = "ApiStockHouse", propOrder = {
^
symbol: class XmlType
ArrayOfErrorMessage.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ArrayOfErrorMessage.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ArrayOfErrorMessage.java:8: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ArrayOfErrorMessage.java:9: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ArrayOfErrorMessage.java:31: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ArrayOfErrorMessage.java:32: error: cannot find symbol
@XmlType(name = "ArrayOfErrorMessage", propOrder = {
^
symbol: class XmlType
ErrorMessage.java:4: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ErrorMessage.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ErrorMessage.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ErrorMessage.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ErrorMessage.java:30: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ErrorMessage.java:31: error: cannot find symbol
@XmlType(name = "ErrorMessage", propOrder = {
^
symbol: class XmlType
ApiWarehouse.java:8: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlSeeAlso;
^
ApiWarehouse.java:20: error: cannot find symbol
@XmlSeeAlso({
^
symbol: class XmlSeeAlso
ApiLandingPage.java:4: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiLandingPage.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiLandingPage.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiLandingPage.java:30: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ApiLandingPage.java:31: error: cannot find symbol
@XmlType(name = "ApiLandingPage", propOrder = {
^
symbol: class XmlType
ApiBatchJobs.java:4: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiBatchJobs.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiBatchJobs.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ApiBatchJobs.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiBatchJobs.java:29: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ApiBatchJobs.java:30: error: cannot find symbol
@XmlType(name = "ApiBatchJobs", propOrder = {
^
symbol: class XmlType
ApiInventory.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiInventory.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiInventory.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ApiInventory.java:8: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlSchemaType;
^
ApiInventory.java:9: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiInventory.java:48: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ApiInventory.java:49: error: cannot find symbol
@XmlType(name = "ApiInventory", propOrder = {
^
symbol: class XmlType
ApiCacheInfo.java:4: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiCacheInfo.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiCacheInfo.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ApiCacheInfo.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
ApiCacheInfo.java:29: error: cannot find symbol
@XmlAccessorType(XmlAccessType.FIELD)
^
symbol: class XmlAccessorType
ApiCacheInfo.java:30: error: cannot find symbol
@XmlType(name = "ApiCacheInfo", propOrder = {
^
symbol: class XmlType
ApiCurrency.java:5: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessType;
^
ApiCurrency.java:6: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlAccessorType;
^
ApiCurrency.java:7: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlElement;
^
ApiCurrency.java:8: error: package jakarta.xml.bind.annotation does not exist
import jakarta.xml.bind.annotation.XmlType;
^
100 errors
only showing the first 100 errors, of 1921 total; use -Xmaxerrs if you would like to see more
EDIT 2
All those missing classes are present in jakarta.xml.bind-api-4.0.1.jar. The -classpath
argument in your original javac
command line did not include this JAR file, and you must have missed it in subsequent updates as well.
To fix, change the -classpath
argument to use a wildcard and include all the JARs in the jarscheck
directory in your classpath:
javac -classpath ".:/Users/Desktop/jarscheck/*" -sourcepath "/Users/Desktop/workspace/GitHub/jar generation/api-config-elements/exposeservices" *.java