cannot execute binary file in Linux

Posted on

Problem :

if i install spring tool in Ubuntu server it says the following error message.

bash: ./spring-tool-suite-3.6.1.RELEASE-e4.4-linux-gtk.tar.gz: cannot execute binary file

please any one help to me.

Solution :

As pointed out by Paul in a comment, the file name spring-tool-suite-3.6.1.RELEASE-e4.4-linux-gtk.tar.gz indicates a gzip compressed tar archive (that’s where the .tar.gz comes from). A compressed archive is not an executable file and should not be treated as such. In this case, bash is doing exactly the right thing by rejecting it.

On Unix-like systems, including Linux, executable files normally have no special extension. (This is unlike how it’s done in the Microsoft world.) Scripts may or may not have an extension such as for example .sh .pl or any of a number of others, but that extension is just a part of the file name; there is nothing magical about it at all, and removing it from the file name has no effect on the file’s executability (it may however matter if the script is written to invoke itself, or some other script, and assumes a particular name).

You will need to extract the archive, which most likely either came with attached installation instructions, or has installation instructions contained within it. To uncompress a .tar.gz file (assuming that’s what it really is), you create a new temporary directory, cd into that directory and then uncompress and unpack the archive:

$ mkdir spring-tool-suite
$ cd spring-tool-suite
$ tar -xfz ../spring-tool-suite-3.6.1.RELEASE-e4.4-linux-gtk.tar.gz
$ ls
...

The tar parameters are, in order:

  • x for extract archive
  • f for input (or output) is a file (named later)
  • z for input (or output) is (to be) gzip compressed
  • ../spring-tool-suite-3.6.1.RELEASE-e4.4-linux-gtk.tar.gz is simply the archive file name

Once the archive has been extracted, look for a file named something like INSTALL, README, UPGRADE, and whatever else looks like it might be relevant. That’s most likely where you will find installation instructions.

Most archives are made such that they extract into a fresh directory, but I prefer to extract the archive into a clean directory anyway. If the archive does not contain a single root directory with all the files contained within it, that makes it much easier to clean up, and reduces the risk of accidentally overwriting something of your own; also, you’ll likely want to somehow move the files somewhere else anyway, so moving them from one directory or from another directory doesn’t make much difference.

You are also fairly likely to encounter .tar.bz2 files in the wild. Those are the same, except they are bzip2 compressed instead. For those, replace the z parameter to tar with j instead. XZ is becoming a popular choice as well (file extension by convention .tar.xz) and for that you use J instead. Note that all parameters to tar are case sensitive.

Leave a Reply

Your email address will not be published.