invoking auto updater from launcher - Install4J - install4j

I'm trying to integrate an automatic update before the launch of my Java application without adding code to my application. If I read the documentation here (Section "Quick Start") correctly, this should be possible with the application template update downloader with silent version check. Yet, after following the docs, the updater itself is working just fine, but it is for some reason not invoked at application startup.
launcher integration configuration
Is there a way to do this?
EDIT 1:
Maybe this is relevant: the launcher is a .exe file that is generated by the application itself, and not a generated launcher by install4j

The automatic launcher integration only works for generated launcher executables. For external launcher executables you have to start the update downloader with the API. On the "Launcher integration" tab for the update downloader, click in the "Start integration wizard" button to get a corresponding code snippet. This requires that you add the install4j runtime to the compilation classpath (but not to the distribution), for more information see
https://www.ej-technologies.com/resources/install4j/help/api/

Related

com.install4j.api.update.UpdateChecker is not shipped after the build if no launchers

I see that If I remove all launchers in install4j which are redundant to me as our project is webapp as a service, After doing build and executing the installer, The i4jruntime.jar present in C:\Program Files (x86)\Astra\.install4j does not contain com.install4j.api.update.UpdateChecker class. Is it mandatory to have
atleast one launcher? I am using install4j 7.0.2. Because of this the working Auto update functionality (Auto update for web app as a service with no launcher) has broken. Kindly help.
This is the "runtime shrinking" feature in install4j. If you start your webapp with a generated service launcher, the compiler will retain all referenced classes in the runtime, including the UpdateChecker.
You can disable runtime shrinking on the "General Settings->Media File Options" step by deselecting the "Shrink runtime library and remove all unused classes" check box.

In Install4j - How can I read the version from an external file?

I run install4j from the gradle plugin but use the user interface to edit the install4j file. But I find it annoying to always have to manually update my General Settings -> Application Info -> Version every time I make a new version. This is stored in a file in our source code already so I want to just read that file to avoid the extra input.
How can I read this file, get the version info, then use that in General Settings -> Appplication Info -> Version?
Thanks in advance.
I would suggest invoking install4j from your build process, install4j supports ant, gradle and maven and can also be invoked with a command line executable.
In that case, you can set the version
with the release attribute of the ant task
with the release attribute of the gradle task
by overriding the release property of the maven plugin, the maven plugin automatically uses the version in the POM.
by passing the --release argument to the command line compiler
For other things that you want to customize from the build process, you can use compiler variables.

How to add build steps to Eclipse "run configuration"?

Is there a way to add build steps to a "run configuration" in Eclipse?
My project uses an applet that should be built before starting the web application. So I'd like to configure Eclipse to do this single step before actually running the application.
I know I can do it with Ant/Maven, but I wonder if there's a way to do it in Eclipse.
Thanks
For a classic launching (Java or Java Applet) configuration, no. Not directly.
For an External Tols launcher, not directly either.
The idea would be:
to not build your applet every time you modify your main project
make sure it is built when you want to launch your webapp.
For that, you could define two projects:
one for the compilation of your main project.
the second (depending on the first) for the compilation of your applet.
Your launching configuration would then run with the second project (which includes the first)
If the option "Build automatically" is selected, the second project shouldn't run without being compiled first.

How to run Eclipse launch configurations programmatically?

I'm finding it difficult to phrase this question well, as there are quite a few generic terms (run, configuration, launch, etc.). Here goes:
You can save run configurations in a .launch file. (in the Run Configuration Dialog, under the Common tab, Save as a shared file.
We check these in to SVN. The developers can pass them around, and it helps getting new devs running a working application quicker.
I'd like to check these out as part of our build and use them to programatically run the application, the tests, etc, without spinning up the whole IDE.
What would be the best way to run a .launch file outside of the UI?
Edit: I am trying to unify the tests run on the build server and the IDE. I do not
particularly want to give up integrated debugging, which would be the case with an ant script to run the tests .
This is probably more a problem for integration testing with multiple bundles, or unit testing a whole bundle, where you'd like to mock up extensions.
there is an eclipse plugin built over JUnit, called TPTP. It provides an automation client which can be used to launch the test from eclipse with no gui. maybe it helps
Ant4Eclipse may provide a good starting point on how to do this.
Unfortunately, this is limited to Java Applications and JUnit configurations; I am more interested in PDE applications and Plugin JUnit tests.
I have recently had alot of success building an Eclipse RCP app inside a Hudson CI server using Eclipse Buckminster. It took a bit of doing, but once I setup both features, made my RCP product be based on features, and added the Buckminster query files and the like, it worked. There is a Hudson/Jenkins Buckminster plugin that allowed me to have hudson build the application.
After saving the launch configurations for each test fragment, I created hudson commands to invoke them (yes one line per test fragment unfortunately), but after that I got the automated CI build that I wanted.
You could also use the shell command Eclipse uses. To get it:
Run your program in Eclipse
Go to the "Debug" view
Right-click on the process (probably the second item in the tree) and select "Properties"
Copy shell command and delete the agentlib flag to run in bash
I think you don't need to use the .launch configurations to run the tests. If you build an application using the Eclipse Build System, then you can use the AntRunner application from Eclipse to run your units tests. This doesn't start the whole IDE.
This article describes how to run the tests during your build process. With this process, you use a special "Test" Eclipse and load the plugins you want to test.
Perhaps running the configurations the way you would run your own custom run configurations would help here. It is described in this article.

Using customBuildCallbacks.xml in an Eclipse RCP headless build

I am trying to add some custom build steps to my headless build process for an Eclipse RCP application.
I understand that the recommended way is to provide a customBuildCallbacks.xml file on the plug-in directory, and adding a link to it in the build.properties file.
# This property sets the location of the customb Build callback
customBuildCallbacks = customBuildCallbacks.xml
However, during the build process, this step is ignored.
Is there some set-up step I might be missing?
Actually, I found out that this is the only thing required.... if we are using eclipse 3.3. This will not work using Eclipse 3.1