Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
How to solve missing JAR files error from Ant
I keep getting this error:
Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.SSHExec was not found.
This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
-/usr/share/ant/lib
-/root/.ant/lib
-a directory added on the command line with the -lib argument
Do not panic, this is a common problem.
The commonest cause is a missing JAR.
This is not a bug; it is a configuration problem
I'm trying to run the following ant build step:
ant -lib /home/xyzsuite/root/.ant/lib/ -file ./tools/build.xml build
I did ant -diagnostics
and it gave following results:
ANT_HOME/lib jar listing
14:27:32 -------------------------------------------
14:27:32 ant.home: /usr/share/ant
14:27:32 ant-launcher.jar (18889 bytes)
14:27:32 ant-apache-regexp.jar (9991 bytes)
14:27:32 ant-swing.jar (13834 bytes)
14:27:32 ant.jar (2216707 bytes)
14:27:32 ant-apache-resolver-1.8.4.jar (9886 bytes)
14:27:32 ant-jdepend.jar (14885 bytes)
14:27:32 ant-imageio.jar (31349 bytes)
14:27:32 ant-junitlauncher.jar (88144 bytes)
14:27:32 ant-apache-regexp-1.9.2.jar (9569 bytes)
14:27:32 ant-javamail.jar (14495 bytes)
14:27:32 ant-jsch.jar (54431 bytes)
14:27:32 sshexec-maven-plugin-0.2.4.jar (15855 bytes)
14:27:32 ant-commons-net.jar (89660 bytes)
14:27:32 ant-antlr.jar (12157 bytes)
14:27:32 ant-apache-log4j.jar (8740 bytes)
14:27:32 ant-optional-1.5.1.jar (654735 bytes)
14:27:32 ant-commons-logging.jar (10132 bytes)
14:27:32 ant-xz.jar (11326 bytes)
14:27:32 ant-jai.jar (29388 bytes)
14:27:32 ant-apache-bsf.jar (10118 bytes)
14:27:32 ant-jmf.jar (12850 bytes)
14:27:32 ant-apache-oro.jar (10030 bytes)
14:27:32 ant-apache-resolver.jar (9903 bytes)
14:27:32 ant-testutil.jar (28546 bytes)
14:27:32 ant-jsch-1.8.1.jar (40200 bytes)
14:27:32 ant-nodeps-1.8.1.jar (409133 bytes)
14:27:32 ant-junit4.jar (13620 bytes)
14:27:32 ant-junit.jar (139915 bytes)
14:27:32 ant-apache-xalan2.jar (8397 bytes)
14:27:32 ant-apache-bcel.jar (15507 bytes)
14:27:32 ant-netrexx.jar (17192 bytes)
14:27:32 ant-bootstrap.jar (22778 bytes)
14:27:32
14:27:32 -------------------------------------------
14:27:32 USER_HOME/.ant/lib jar listing
14:27:32 -------------------------------------------
14:27:32 user.home: /root
14:27:32 ant-launcher.jar (18705 bytes)
14:27:32 ant-apache-regexp.jar (9991 bytes)
14:27:32 ant-swing.jar (13834 bytes)
14:27:32 ant.jar (2254148 bytes)
14:27:32 ant-apache-resolver-1.8.4.jar (9886 bytes)
14:27:32 ant-jdepend.jar (14885 bytes)
14:27:32 ant-imageio.jar (31349 bytes)
14:27:32 ant-junitlauncher.jar (88144 bytes)
14:27:32 ant-apache-regexp-1.9.2.jar (9569 bytes)
14:27:32 ant-javamail.jar (14495 bytes)
14:27:32 ant-jsch.jar (54431 bytes)
14:27:32 sshexec-maven-plugin-0.2.4.jar (15855 bytes)
14:27:32 ant-commons-net.jar (89660 bytes)
14:27:32 ant-antlr.jar (12157 bytes)
14:27:32 ant-apache-log4j.jar (8740 bytes)
14:27:32 ant-optional-1.5.1.jar (654735 bytes)
14:27:32 ant-commons-logging.jar (10132 bytes)
14:27:32 ant-xz.jar (11326 bytes)
14:27:32 ant-jai.jar (29388 bytes)
14:27:32 ant-apache-bsf.jar (10118 bytes)
14:27:32 ant-jmf.jar (12850 bytes)
14:27:32 ant-apache-oro.jar (10030 bytes)
14:27:32 ant-apache-resolver.jar (9903 bytes)
14:27:32 ant-testutil.jar (28546 bytes)
14:27:32 ant-jsch-1.8.1.jar (40200 bytes)
14:27:32 ant-nodeps-1.8.1.jar (409133 bytes)
14:27:32 ant-junit4.jar (13620 bytes)
14:27:32 ant-junit.jar (139915 bytes)
14:27:32 ant-apache-xalan2.jar (8397 bytes)
14:27:32 ant-apache-bcel.jar (15507 bytes)
14:27:32 ant-netrexx.jar (17192 bytes)
14:27:32
14:27:32 -------------------------------------------
14:27:32 Tasks availability
14:27:32 -------------------------------------------
14:27:32 image : Not Available (the implementation class is not present)
14:27:32 sshexec : Not Available (the implementation class is not present)
14:27:32 scp : Not Available (the implementation class is not present)
14:27:32 rexec : Not Available (the implementation class is not present)
14:27:32 unxz : Not Available (the implementation class is not present)
14:27:32 sshsession : Not Available (the implementation class is not present)
14:27:32 telnet : Not Available (the implementation class is not present)
14:27:32 antlr : Not Available (the implementation class is not present)
14:27:32 netrexxc : Not Available (the implementation class is not present)
14:27:32 ftp : Not Available (the implementation class is not present)
14:27:32 splash : Not Available (the implementation class is not present)
14:27:32 jdepend : Not Available (the implementation class is not present)
14:27:32 junit : Not Available (the implementation class is not present)
14:27:32 junitreport : Not Available (the implementation class is not present)
14:27:32 junitlauncher : Not Available (the implementation class is not present)
14:27:32 sound : Not Available (the implementation class is not present)
14:27:32 xz : Not Available (the implementation class is not present)
14:27:32 A task being missing/unavailable should only matter if you are trying to use it
I think I have all the required jar files.
Note: I'm running this on a Linux 8 arm64v8 server.
1 answer
So In case anyone else is stuck on similar Missing JAR error, Here is the solution-
download and try to install ant-optional package (I said "try" because its not available for some platforms)
If it is not available for yours, then download "ant-optional" package from 'sourceforge' and paste it into the path that error is reading out,
If this still doesnt work, download "jsch.jar" from 'sourceforge' and paste it into the path that error is reading out
That should do the trick. I hope it helps someone
0 comment threads