[request] Launch4J support: sikulixapi.jar should work, when wrapped into an exe

Bug #1411165 reported by RaiMan
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SikuliX
In Progress
Medium
RaiMan

Bug Description

based on the related question: https://answers.launchpad.net/sikuli/+question/260735

from comment #1:

the current implementations of SikuliX will not work, if you pack everything into the exe,
only the version launch-only work out of the box
<launch4jConfig>
  <dontWrapJar>true</dontWrapJar>

... but I guess, this is not what you want ;-)

If you wait a few days: there will be sikulixapi.jar, that can be wrapped in the exe.

The problem with Launch4J:
If anything goes wrong inside, as in this case, the exe simply dies without any comment.

The problem with SikuliX:
SikuliX exports the native libraries at runtime to the libs folder.
this currently is based on the existence of a real jar, which is not available in this case of wrapped exe.

The solution:
I have already added a feature, to just access the resources from class path.
This is not yet available in sikulixapi.jar, but will be in a few days.
The libs will then be exported to temp.
In any case (as now): existing libs are checked and an export is only done, if needed based on timestamp and the libs folder is added to system path at runtime dynamically.

RaiMan (raimund-hocke)
Changed in sikuli:
status: New → Fix Committed
importance: Undecided → High
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.0
RaiMan (raimund-hocke)
Changed in sikuli:
milestone: 1.1.0 → 2.0.0
Revision history for this message
angelo (angelo-j) wrote :

Hi Raimund,

Is a nightly build via maven available that contains the fix? May you post the coordinates here?

Best regards,

Angelo

Revision history for this message
RaiMan (raimund-hocke) wrote :

@angelo
As far as I understand: Maven is not suitable for launch4J, because the latter has its own mechanism, to build an exe.

Have you already tried to use a ready-built-for-Windows sikulixapi.jar (setup option 2)?

Revision history for this message
angelo (angelo-j) wrote :

@Raimund
Building an .exe with launch4j is possible. I use "com.akathist.maven.plugins.launch4j" for that purpose (Hope I understood that correct).

I tried your suggestion the following way:

Done on a fresh Windows installation:
- Downloaded SikuliX from https://launchpad.net/sikuli/sikulix/1.1.0
- Ran sikulixsetup-1.1.0.jar
- Chose option 2
- Copied sikulixapi.jar to my development machine
- Reset the Windows VM to the initial Snapshot

Done in my Windows development machine:
- Imported the generated sikulxapi.jar to the local maven repository with
mvn install:install-file -Dfile=sikulixapi.jar -DgroupId=com.sikulix -DartifactId=sikulixapi -Dversion=1.1.0 -Dpackaging=jar -DgeneratePom=true
- Build the myprogram .exe

Done on a fresh windows installation:
- Run the build myprogram.exe

So using the specially built sikulixapi.jar in a launch4j build does not seem to work either.

Result:
- A folder %APPDATA%\Roaming\Sikulix was created with empty subfolders: Extension, SikulixDownloads, SikulixLibs_201510051707, SikulixStore
- myprogram.exe shutdown immediatly

angelo (angelo-j)
description: updated
RaiMan (raimund-hocke)
Changed in sikuli:
status: Fix Committed → In Progress
importance: High → Medium
Revision history for this message
RaiMan (raimund-hocke) wrote :

@ angelo
Thanks for your information and evaluation.

I will check that during the next time (weeks) and decide, wether I will do something with version 1.1.x in that direction.

For your current situation:
If you add a valid content into the folder SikulixLibs_201510051707, then you might have a chance.
After having run setup, you should have this content on that machine to make a copy.

BTW: what is the advantage of having an .exe?

Revision history for this message
angelo (angelo-j) wrote :

@ Raimund

Just adding valid content does not work. But I found the initial question to this bug and realized that it works if the jar is besides the .exe. This is fine for my case.

The advantage of the wrapped .exe is to distribute just one standalone application.

Revision history for this message
RaiMan (raimund-hocke) wrote :

@ angelo
Thanks for the feedback - now I understand your actions on the bug description ;-)

--- The advantage of the wrapped .exe is to distribute just one standalone application.
I never really understood that argument, because you could get the same, if you pack everything together in a standalone jar.
... but nevertheless, I will try to solve this latest with version 2

Revision history for this message
angelo (angelo-j) wrote :

@ Raimund

But I cannot distribute a JRE in a jar file. With launch4j I can wrap everything together and distribute a suitable and tested JRE version on the users computer without interfering any previous Java installations. Anyway Java has a bad reputation (which I totally agree when it comes to Java Browser plugins). So I do not want to bother my users with downloading and installing a JRE which needs admin rights and annoys with update notices every few weeks. This is far away from a neat standalone solution.

Thank you very much for your effort on this. I am sure this will help some more people.

By the way, will there be maven coordinates for the nightly build of 2.0.0? I remember you had something similar for the 1.1.0-SNAPSHOT.

Cheers,

Angelo

P.S.: Thank you very much for maintaining this great framework. The world needs more passionate people like you...

Revision history for this message
RaiMan (raimund-hocke) wrote :

@ angelo
--- But I cannot distribute a JRE in a jar file
uuups, thanks for THAT pointer - did not remember this fact. Of course a big advantage.

--- will there be maven coordinates for the nightly build of 2.0.0
yes. Planned to be started towards end of April.

... and finally thanks for the kind feedback.

RaiMan (raimund-hocke)
Changed in sikuli:
milestone: 2.0.0 → 2.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.