3

I wrap my Java project's JAR file to an .exe file using launch4j, which works fine on my dev machines and several other computers. However, one user reported he cannot run the .exe file on his machine, as a popup message tells him

Could not find the main class.

Interestingly, the user is able to run the JAR file directly on the same computer, either by calling it via java -jar from command line, or directly by double-clicking the JAR file in the Windows explorer (or via shortcut). That user has installed latest JRE.

I have seen on other threads here that this problem could occur because of invalid Manifest files, e.g. if the main class is missing there. However, I think this is not the case, because it's working fine if the JAR is called directly as said.

So I assume the problem is somewhere with my launch4j configuration. There I have not specified a custom Manifest file, only the input JAR file and the output .exe file.

I thought my launch4j config would be fine, because the .exe is running on several machines using different Windows versions. This is the first time I encounter that problem, but as said with the .exe file only.

Any ideas?

Simley Jo
  • 33
  • 8
Matthias
  • 9,817
  • 14
  • 66
  • 125
  • 1
    Is there any pattern on the machines it doesn't work on? Certain versions of Windows, or 32 / 64 bit for instance? – Michael Berry May 04 '13 at 15:50
  • @berry120: I had the same thought, but it's hard to tell. The exe file is working on serveral hundrets of Windows machines fine, this is the first user that reports htis error. So no, I could not find any pattern yet. – Matthias May 04 '13 at 15:56

2 Answers2

3

We just found the problem with that one client machine. It had the 64 bit version of the JRE installed, that was causing the problem. After replacing it with the 32 bit JRE version the .exe file can be correctly started again.

Matthias
  • 9,817
  • 14
  • 66
  • 125
  • 1
    @Marco in my experience a Launch4J exe can cope fine with 64 bit JREs. It may just be that the OP needs to rebuild his exe with a more up to date version of L4J. – Ian Roberts May 04 '13 at 21:01
  • 2
    I am using the latest (release, i.e. non-beta) version of L4J. Is there a better alternative? – Matthias May 05 '13 at 00:32
0

Yes,even I faced this problem. I used jar2Exe instead of launch4j. It's working fine.You better use it.

Hema Chandra
  • 363
  • 2
  • 4
  • 16