Install4j is not keeping link in prebuild JREs for MacOS - install4j

in our install4j script we are using a prebuild jre. The tar.gz file contains a link for MacOS and Linux. When installing on linux, the link is kept. When installing on MacOS (in Version 8.0.8, it did work in 8.0.4), the link is replaced by a real file.
Contents/MacOS/libjli.dylib -> ../Home/jre/lib/jli/libjli.dylib
After installing, the file Contents/MacOS/libjli.dylib is not a link any more, but a real file. It seems that the Eclipse-launcher has a problem with this, it does not start with this error:
Error: could not find libjava.dylib
Failed to GetJREPath()
If the file Contents/MacOS/libjli.dylib is changed back to a link, the Eclipse-Launcher will start again.
I have a temporary solution in my setup.install4j script to remove that file and create a link (action for both exists), but it would be nice to to modify the links in the tar.gz of a prebuild jre.

To be able to fully sign and notarize a JDK bundle on macOS, the file Contents/MacOS/libjli.dylib cannot be a symlink.
See
https://bugs.openjdk.java.net/browse/JDK-8235687
These are new requirements from Apple that have been introduced by notarization.
However, recent JDK versions fix the problems introduced by that change:
https://bugs.openjdk.java.net/browse/JDK-8238225

Related

install4j launcher issue on Mac OSX app store application

We’re using install4j to create installers for our Java application, PDF Studio.
We’re currently trying to submit our application to the Apple store and for this, need a pkg file. We’ve created a pkg file from the Application folder that is created after running the dmg installer created by install4j and are working on removing one by one all the warnings and errors reported by the Apple store.
One issue we are having is that symlinks are not allowed by the Apple store and the JRE contains a symlink for a file called libjli.dylib.
When we try to remove the symlink or replace it with the actual file, the i4j launcher for our application is broken.
When we remove the file from the install folder:
rm /Applications/PDF\ Studio\ 2018.app/Contents/PlugIns/jre.bundle/Contents/MacOS/libjli.dylib
We get an error message on launch saying "Java SE 8" couldn't be loaded because it's executable couldn't be located."
If we try to copy the file to the symlink location:
cp /Applications/PDF\ Studio\ 2018.app/Contents/PlugIns/jre.bundle/Contents/Home/jre/lib/jli/libjli.dylib /Applications/PDF\ Studio\ 2018.app/Contents/PlugIns/jre.bundle/Contents/MacOS
Then the launcher fails with no error message dialog.
If we run with install4j log enabled:
INSTALL4J_LOG=yes /Applications/PDF\ Studio\ 2018.app/Contents/MacOS/JavaApplicationStub
Then it will print "Error: could not find libjava.dylib."
Has anyone tried to do this and made it work?
It seems like the launcher is looking under /MacOS/libjli.dylib. We think it is the JavaApplicationStub executable file that decides where to look which is created by install4j.
Is there is a way to set where the launcher looks for the jre.bundle executable libjli.dylib?
You can extract the DMG and edit the Info.plist file so that it contains
<key>CFBundleExecutable</key>
<string>../Home/jre/lib/jli/libjli.dylib</string>
We will check if we can do this in general.

Visual Studio Code (VSCode) - how to update the standalone (.zip) version?

There is no "check for updates" when using the standalone/no install version.
What is best way to update a standalone version without losing settings etc.?
According to my experience (VSCode in a standalone .zip file uncompressed in D:\ using Win7 OS) you just need to download and uncompress the archive containing the new version (v 1.41.1).
When you run Code.exe in the new folder, your settings file is used and everithing is OK. (then, when you are really really sure that it is everithing OK, you could delete the old version).
If you changed the default settings file location, take a look at https://code.visualstudio.com/docs/getstarted/settings#_settings-file-locations
From the official doc it says when downloaded through zip file, one has download the release manually for each update and place the unzip version inside the Program files (Windows).
According to the special portable page all the settings, plugins, etc. of the standalone version
are stored in the data-folder. So assuming you called your vscode-folder vscode:
download the new version
unpack to vscode2 folder adjacent to current vscode
move data folder from vscode to vscode2
delete old vscode-folder
rename vscode2 to vscode
done
P.S.: Current portable versions notify about new version, but clicking on it leads to download, so above list still applies.
Edit 2020/08/04: To make a "normal" install portable one just needs to create the data folder inside the installation/unpack directory of VSC.
To download the old archive, replace user|system with archive in the URL.
Before:
https://update.code.visualstudio.com/1.69.2/win32-x64-user/stable
After:
https://update.code.visualstudio.com/1.69.2/win32-x64-archive/stable

install4j: Changing pref_jre.cfg on MacOS doesn't work

We use install4j for our software and we have our own autoupdate procedure (which perform update of JRE too). We try to change the location of JRE using pref_jre.cfg. On Windows it is working as expected - running our application with /create-i4j-log tells that JRE folder is the same as in pref_jre.cfg. But on MacOS it doesn't work. E.g. if I rename jre.bundle in .install4j folder to v2.jre.bundle, than change pref_jre.cfg appropriately, than run with INSTALL4J_LOG=yes - the log says that JRE is /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home that is not that I expect.
Can installj4 on MacOS use path to JRE defined in pref_jre.cfg?
Indeed, this is currently not implemented on macOS. A workaround is to create a symbolic link from .install4j/jre.bundle to the JRE that should be used.
In the case of a single bundle, the link should be created in Contents/Resources/jre.bundle.

Unity3d OSX "Application can't be opened"

I'm using a PC and I've created a build for Mac standalone.
I shared the file with my test user by zipping and emailing the build, but when he tries to run the application he sees this error:
The application "SomeApp.app" can't be opened.
After some searching, I learned that I need to do chmod to open the file. Can anyone tell me how to do that on a Mac?
The zip format doesn't have easy support for Unix-like file permissions, so your transfer process is stripping any permission flags that OSX uses to recognize files within that zip that are supposed to be executable. This can also happen with other file transfer solutions, so it's something to watch out for.
The best solution would be to create an archive which does keep those permissions, such as a tar archive.
Failing that, you can have a Mac user open a terminal and set the permission flag manually:
chmod a+x SomeApp.app/Contents/MacOS/*
(Replace SomeApp.app with whatever your .app folder is named)
I had the same issue, I left an answer here, at the bottom: https://forum.unity.com/threads/mac-build-breaking-when-uploaded-to-storage.1093330/
The problem was not with the .zip, but rather with the build itself. Ran fine on my Mac, did NOT run fine once I uploaded it and downloaded it again (or if anyone else downloaded it).
Edited 12/8/2021, as per EmiOB's suggestion, to add the text of my answer (same as in the link):
This worked for me on 2020.3.16f1:
In the Unity Editor: Build Settings, check the box that lets you make an XCode project (requires having XCode installed, I believe I have Xcode 11)
Open the XCode project
Build
That solved my problem :)

Change installed language in quite-mode

I'm trying to change the installed language with install4j, according to the documentation the parameter I should use is:
-Dinstall4j.language=[ISO code]
I'd like it to install in English but it keeps installing it in Swedish, the iso-codes I've tried is: en and En_us.
This is how I add the parameter, is this correct or am I doing something wrong?
> .\Setup_64bit.exe -Dinstall4j.language=en
Environment: Windows 7, Powershell, Install4j 5.1.6
The simplest way I found to solve this was installing it locally on a OS with the correct language selection. Then I went to the .install4j folder(which can be found in the same folder where your application is installed) and inside this folder there is a response.varfile. The .varfile can be put next to the installation .exe, and if given the same name as the .exe file but with .varfile the installer will automatically use this response-file to select language! :)
Using -Dinstall4j.language=en is correct, but if you have already installed it before, a "Load a response file" action in your project will load the response file from previous installation and override the selection on the command line.