0

I've created a simple GUI application using swing. I wanted to make a .exe file for the same so that I could use it on windows. I have used launch4j for this purpose earlier. But, this time, I was unable to wrap the generated jar file into a .exe file. Following is the complete log message that I'm getting:

Compiling resources
Generated resource file...

LANGUAGE 0, 1
2 RCDATA BEGIN "1.8.0_131\0" END
18 RCDATA BEGIN "1\0" END
30 RCDATA BEGIN "2\0" END
1 ICON DISCARDABLE "/home/bilesh/Pictures/icons/Webalys-Kameleon.pics-Apartment.ico"
10 RCDATA BEGIN "You need Java to run this application.\0" END
21 RCDATA BEGIN "http://java.com/download\0" END
8 RCDATA BEGIN ".\0" END
20 RCDATA BEGIN "32\0" END
101 RCDATA BEGIN "An error occurred while starting the application.\0" END
102 RCDATA BEGIN "This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.\0" END
103 RCDATA BEGIN "This application requires a Java Runtime Environment\0" END
104 RCDATA BEGIN "The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted.\0" END
105 RCDATA BEGIN "An application instance is already running.\0" END
23 RCDATA BEGIN "SocietyManagementSystem\0" END
24 RCDATA BEGIN "SocietyManagementSystem\0" END
17 RCDATA BEGIN "true\0" END

net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "/home/bilesh/Launch4j/launch4j/bin/windres": error=2, No such file or directory

As the error suggests, I thought that the concerned file is missing in the given folder but that is not the case. Following is a screenshot indicating the same:

screenshot

I'm using Ubuntu 16.04 64-bit and the version of launch4j that I'm using is 3.9.


I took a look at this answer and tried installing the 32-bit libraries using the following command:

sudo apt install ia32-libs

But I got the following error:

Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  lib32ncurses5 lib32z1

E: Package 'ia32-libs' has no installation candidate

So, I went ahead and installed the replacement packages:

sudo apt install lib32ncurses5 lib32z1

But I still keep getting the above error when running launch4j. Can this be resolved?

Bilesh Ganguly
  • 3,792
  • 3
  • 36
  • 58
  • Executables an Linux typically don't have a `.exe` extension. I don't know launch4j, but it seems you installed a windows version of it. – Henry Jun 27 '17 at 05:37
  • @Henry launch4j is supposed to be platform independent. Its basically an executable jar file. You have to run it like `java -jar launch4j.jar`. – Bilesh Ganguly Jun 27 '17 at 05:48
  • @Henry And as I said I've used it before (albeit 1-2 yrs ago). It used to work fine on linux. – Bilesh Ganguly Jun 27 '17 at 05:48
  • Just checked the launch4j web site: there is a windows, linux, and macosx version to download. Are you really absolutely sure you installed the linux one and not the windows one? – Henry Jun 27 '17 at 05:57
  • @Henry I'm not sure if that is the case. The download option on their website directs me to this page - https://sourceforge.net/projects/launch4j/files/launch4j-3/3.10/ – Bilesh Ganguly Jun 27 '17 at 06:23
  • @Henry Can you please share the link to the download page if that is the case. It will be really helpful :) – Bilesh Ganguly Jun 27 '17 at 06:24
  • 1
    Yes, but this page also says that the download was removed, try the 3.9 version. https://sourceforge.net/projects/launch4j/files/launch4j-3/3.9/ – Henry Jun 27 '17 at 06:24
  • @Henry I'm still unable to find any linux specific version for launch4j. And I've already mentioned in my question that 3.9 is the version I've been using. – Bilesh Ganguly Jun 27 '17 at 06:29
  • @Henry No issues. Got it. https://sourceforge.net/projects/launch4j/files/launch4j-3/3.9/ – Bilesh Ganguly Jun 27 '17 at 06:31
  • @Henry Sorry, I didn't notice the link you had provided. Really appreciate your help :) – Bilesh Ganguly Jun 27 '17 at 06:41

1 Answers1

1

I solved the same issue on Ubuntu 20.04 by installing the packages libc6-i386 and gcc.

I worked this out by running file to discover the link to /lib/ld-linux.so.2:

jbaxter@vmssaf66e00000G:~/launch4j-plugin-1.5.0.0-workdir-linux/bin$ file windres
windres: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.2.5, stripped

Which did not exist on the relevant system.

Then running apt-file on my local system which was working:

jbaxter@dev-jbaxter:~$ apt-file search /lib/ld-linux.so.2
libc6-i386: /lib/ld-linux.so.2

After installing libc6-i386 there was an error message indicating gcc could not be found - this was straightforward to resolve by installing the corresponding package.

This happened on an Azure VM Image supplied by Canonical.

James Baxter
  • 1,237
  • 9
  • 17