Want to uninstall apache ant, can't find the install
1
0
Entering edit mode
5 weeks ago
Matthew • 0

Hi,

Synopsis: have downloaded 2 different apache ant versions, one is installed, the other is just downloaded and unzipped. The old version I cannot find in my file system so I can install the other one without issue.

I recently downloaded apache ant (https://ant.apache.org/) through my ubuntu system on my windows machine using github: https://github.com/apache/ant Desired version 1.10.14

Unlike many individuals using apache ant, I am using it through a command-line ubuntu interface exclusively. I do have visual studio code if that is necessary, though.

I used git clone and tar -xvzf to unpack without realizing that I had previously installed ant at some point, but version 1.10.12

If I currently run

$ant -version

I get returned:

Apache Ant(TM) version 1.10.12 compiled on January 17 1970

Ignoring the date which I think is a bug, I want to uninstall this old version so I can get 1.10.14 properly installed and configured.

I ran:

$whereis ant

which returned:

ant: /usr/bin/ant /usr/share/ant /mnt/d/everything/ant /usr/share/man/man1/ant.1.gz

/mnt/d/everything/ant is the directory where I just unpacked 1.10.14

$cd /usr/bin/ant

returns:

-bash: cd: /usr/bin/ant: Not a directory --> checking /usr/bin, confirms this is not, in fact, a directory

$cd /usr/share/ant

worked, has subdirectory lib which contains tons of jar files, but no filenames inform me of version

Tried to "summon" (sorry, unsure of java terminology) one of the jar files:

$java -jar ant-antlr.jar

returns:

no main manifest attribute, in ant-antlr.jar --> I am having this exact issue occur when I try to use Trimmomatic, another jar script, tried many many fixes and never was able to get it

I get other errors when I go into

/usr/share/ant/etc and try to "summon" a jar file in there too return:

Error: Could not find or load main class org.apache.tools.ant.Main Caused by: java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/AntMain

Rest of directory is full of .xsl files

I was hoping summoning the jar(s) might allow me to use a help command which might have had version info.

From here, what should I do to figure out where the version 1.10.12 install is truly located?

In case it mattered for any reason, the ultimate end goal of reinstalling ant is so I can rebuild Trimmomatic and pray that fixes the issue I am having with using the trimmomatic java script.

Thanks for your time!

ubuntu apache ant • 365 views
ADD COMMENT
0
Entering edit mode
5 weeks ago
LauferVA 4.2k

Hello and welcome to Biostars!

First a mild disclaimer: some of the below is speculation based on interpretation of error messages. Having said that, here are my thoughts:

Step 1: Uninstalling Old Version of Apache Ant

Locate the Installation: Output from the whereis command shows multiple locations related to Apache Ant reflecting the various versions. But, the executable should be located in /usr/bin/ant, and shared files are in /usr/share/ant. One possible source of confusion could be if /usr/bin/ant is not a directory but a symbolic link or an executable ... in particular in considering your confusion about the installation location, it seems possible the actual installation might be spread across these directories ...

Manual Uninstallation: Given the uncertainty of how Ant was installed (e.g., through a package manager or manually), the safest approach is manual removal...

  • Start by removing the Ant executable:

sudo rm /usr/bin/ant

  • Next, remove the directory containing the shared files and libraries:

sudo rm -r /usr/share/ant

  • I do confess the rather unexpected directory /mnt/d/everything/ant is a bit concerning. My guess is it resulted from the manual unpacking of the new version. For that reason, I'd leave it as is for now..it's possible it could be necessary to revisit this though.

  • At any rate, after that, verify correct removal:

ant -version # Here the desired output is of course an error stating ant is not found

Step 2: Pre-Installation: Check Java installation and version

As you've pointed out, Ant requires that Java be installed and configured correctly on your system. So, before installation, check to see if is installed and if so what version of Java installation you're running with:

java -version

Depending on the result of this command, you'll either learn that Java is not installed, or that it is installed but not the right version, or that it is correctly installed and the right version (this is my guess), but if that ends up being a sticking point, let us know. While we're discussing Java, will go ahead and mention my best guess is that the issues with Trimmomatic don't directly relate to Ant. I'll discuss Trimmomatic at the end of this post for that reason, but it's always possible I am wrong...

Step 3: Install the new version of Apache Ant

  • You have apparently already downloaded and unpacked Ant 1.10.14 in /mnt/d/everything/ant.

  • The next thing is to configure it to be used globally. One way of doing this is to set environment variables by adding them to your .bashrc or .bash_profile, but there are other ways too that might be more appropriate... anyway, can replace /path/to/apache-ant-1.10.14 with the actual path, which seems to be /mnt/d/everything/ant (I think).

export ANT_HOME=/mnt/d/everything/ant export PATH=$ANT_HOME/bin:$PATH

After adding these lines, apply the changes by running source ~/.bashrc.

Once these variables are set, you should be able to verify the correct version of Ant is installed via:

ant -version # ideally will return version 1.10.14 - if so we are good


Addressing Java Application Issues (Trimmomatic)

I think the issue with running Trimmomatic and other Java applications is unrelated to Ant, save for conceptually in certain ways... Instead, my guess is that these issues similarly relate to issues setting up the Java Execution Environment. Why?

Well because the error messages provided (e.g. "no main manifest attribute") strike me as indicating issues with its execution more so than how it was built, so to speak ... my guess is something like a manifest file specifying the main class to execute is absent or misplaced. This would lead JVM to fail to identify the necessary classes to run the program (see the end of 2. for likely reasons why that, in turn, might occur).

Speculation aside, the following would be my first stab at troubleshooting:

  1. Ensure Java Compatibility: Verify that the Java version installed is compatible with the Trimmomatic version you're trying to run. Some Java applications require specific versions of Java.

  2. Correct Way to Run Java Applications: Java applications packaged as JAR files should be executed with the java -jar command. If you receive an error about the main manifest attribute or class not found, it might indicate a missing or incorrect classpath. I suppose it could also indicate that the JAR file is not meant to be executed directly (it might be a library) - not sure on that last.

  3. For Trimmomatic: If you have specific issues with Trimmomatic, ensure you're following the correct command syntax and have all necessary files. java -jar /path/to/your/trimmomatic.jar

Trimmomatic's documentation or help command can provide guidance on usage if it becomes needed.

Let us know what happens, and good luck.

ADD COMMENT
0
Entering edit mode

Hi LauferVA,

Thank you very much for your time and help on this issue, unfortunately, I have run into a problem while trying your solution:

I did the following: $sudo rm /usr/bin/ant

$sudo rm -r /usr/share/ant

$ant -version Command 'ant' not found, but can be installed with: sudo apt install ant --> Good, that means my old ant is now gone as I wanted it originally.

$java -version java version "21.0.2" 2024-01-16 LTS

Now try to get new ant configured:

$cd /mnt/d/everything/ant

$export ANT_HOME=/mnt/d/everything/ant

$export PATH=$ANT_HOME/bin:$PATH

$source ~/.bashrc

$ant -version

Returned: Command 'ant' not found, but can be installed with: sudo apt install ant

My guess is that I did something incorrectly during these steps:

" $export ANT_HOME=/mnt/d/everything/ant

$export PATH=$ANT_HOME/bin:$PATH

$source ~/.bashrc "

Do you know where I went wrong? was "$PATH" supposed to be replaced with a real path?

Any help is appreciated, thank you! Best, Matt

ADD REPLY

Login before adding your answer.

Traffic: 2564 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6