Replies: 4 comments 10 replies
-
Interesting idea. Can you give me a concrete example of something you would want to perform in each of these hooks? |
Beta Was this translation helpful? Give feedback.
-
@shannah Is there any possibility to introduce this in near future? |
Beta Was this translation helpful? Give feedback.
-
There are some sharp corners in a feature like this, and I'm curious if this could be achieve in the app itself. Like in your app, on launch detect if the current version is "new". In which case perform your bootstrapping, which would include everything that you are requesting in the "postUpdate" script. Is that a possibility? |
Beta Was this translation helpful? Give feedback.
-
I've added support adding a jar named "jdeploy-prelaunch.jar" to the same directory as your app jar file. jDeploy will check for this jar's existence and run it before launching your main jar. That should enable you to do everything that you need. This change is not deployed yet, but will be available with the next release (4.0) upcoming within the next couple of weeks. |
Beta Was this translation helpful? Give feedback.
-
This is a generic solution to address #65. I would like to propose an idea to integrate pre/post scripts. We can introduce the following JSON fields for this purpose:
preUpdateScript
- Script to be executedbefore
application updatepostUpdateScript
- Script to be executedafter
application updatepreInstallScript
- Script to be executedbefore
application installationpostInstallScript
- Script to be executedafter
application installationNow, to make the script work cross-platform, I believe, we can use
Java shebang
which has been introduced inJava 11
.For example, the following script can be executed directly on the command line:
Note that,
version
must be replaced with the actual runtime version the application requires (must be>=11
since shebang was introduced inJava 11
).Since the user doesn't know about the location of the VM to be installed by jdeploy, the user can ignore writing this first line in the script. This can be added automatically before executing the script on the command line. If the application requires 17, this line can be automatically added to the script before executing it.
#!/path/to/java/installed/by/jdeploy --source 17
To execute the aforementioned script, we then need to simply call it using the same Java runtime required by the application:
$ java my_script.sh
Note that, the requirement is that the script file should not have
.java
extension. It can be anything like.sh
or.jsh
or.abc
or.jdeploy
etc.According to Java shebang specification, if we provide arguments while executing it on the command line, the arguments will be passed to the
String[]
arguments in the main method similar to executing main method from Java class.We can think of providing important informations to it, such as
jDeploy version
,application version to be installed
orapplication version to be updated
etc. so that consumers can make use of them if required in their scripts.In the case of
Java 8
, we don't have to use the aforementioned JSON fields asJava 8
is not equipped with shebang.Beta Was this translation helpful? Give feedback.
All reactions