Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 19 08:21
    andy30212 closed #176
  • Nov 17 13:24
    mordechaim commented #176
  • Nov 17 07:14
    andy30212 opened #176
  • Nov 15 17:48
    mordechaim commented #175
  • Nov 15 14:49
    Remzi1993 closed #175
  • Nov 15 14:49
    Remzi1993 commented #175
  • Nov 15 14:43
    Remzi1993 commented #175
  • Nov 13 00:04
    mordechaim commented #175
  • Nov 13 00:03
    mordechaim commented #175
  • Nov 12 00:03
    Remzi1993 opened #175
  • Oct 03 11:25
    stale[bot] closed #71
  • Sep 26 09:42
    stale[bot] labeled #71
  • Sep 26 09:42
    stale[bot] commented #71
  • Aug 26 12:07
    moonshinebot commented #71
  • Aug 25 20:00
    mordechaim commented #71
  • Aug 24 20:59
    moonshinebot commented #71
  • Aug 24 20:58
    moonshinebot commented #71
  • Aug 24 20:57
    moonshinebot commented #71
  • Aug 24 20:55
    moonshinebot commented #71
  • Aug 24 19:02
    mordechaim commented #71
Mordechai Meisels
@mordechaim
While update4j wasnt designed for jdk8 there are a few forks that packported the project. Check out here.
There aren't any special rules regarding runnable jar files, but update4j will not handle it as runnable. Namely, you'll need to supply the main class the update4j (if you use the default bootstrap setup).
Start update4j as a runnable jar to see a quick reference guide
Sébastien Gonzalez
@SebGonzalez
Hi, I started to use update4j for update my application. I get the exemple bootstrap. I created my config.xml and make download functional. But I have a problem with the launch part
I want to start my application inside the current jvm (from bootstrap)
Currently I can start my business app with"java -classpath 'exemple.jar; exemple2.jar ..." com.me.MainClass
But with the bootstrap I don't succeed in launch it
I add classpath="true" in all jar inside config.xml but I have an error when I launch my businness app :
Caused by: java.lang.IllegalAccessError: class com.eukles.resoposte.AgentResoposteV2 (in unnamed module @0x6dc7625e) cannot access class com.sun.javafx.application.LauncherImpl (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.application to unnamed module @0x6dc7625e
Have you an idea to solve my problem please ?
Mordechai Meisels
@mordechaim
Are your example.jar files also liated in the config?
Do you use the default bootstrap or your own?
Mordechai Meisels
@mordechaim
*listed in the config
Sébastien Gonzalez
@SebGonzalez
Yes I have all my jar in the "<files>"
<files>
<file path="antlr-2.7.7.jar" size="445288" checksum="d0d1c0e2" classpath="true"/>
<file path="aspectjweaver-1.9.6.jar" size="2051606" checksum="b7eba520" classpath="true"/>
<file path="byte-buddy-1.10.19.jar" size="3497763" checksum="2de28ed8" classpath="true"/>
......
</files>
I take the demo-boostrap from here : https://github.com/update4j/demo-bootstrap
Astrid Sawatzky
@astridsawatzky_gitlab
@SebGonzalez maybe this will help: https://stackoverflow.com/questions/59625091/javafx-module-does-not-export-to-unnamed-module
I do not know how to achieve this in update4j.
Sébastien Gonzalez
@SebGonzalez
I tried to add export on the file "javafx-graphics-16.jar" in the config but I have the same error
<file path="javafx-graphics-16.jar" size="306" checksum="3d6046ce" classpath="true">
<addExports>
<exports package="javafx.graphics/com.sun.javafx.application" target="ALL-UNNAMED"/>
</addExports>
</file>
Mordechai Meisels
@mordechaim
With not enough context information, can you try to not include your jars in the classpath from the start command? Just include update4j alone and let the launcher do the rest.
Sébastien Gonzalez
@SebGonzalez
If i don't include jars in the classpath when I try to launch with the "config.launch(this);" command i have the next result ;
Caused by: java.lang.ClassNotFoundException: com.eukles.resoposte.AgentResoposteV2
My main jar is not include so he dosn't know the main class
Mordechai Meisels
@mordechaim
As I said I'm missing a lot of context, but my best guess is to try using the DynamicClassLoader as explained here.
Sébastien Gonzalez
@SebGonzalez
I didn't understand how to use it
DynamicClassLoader dynamicClassLoader = new DynamicClassLoader(); ?
Mordechai Meisels
@mordechaim
$ java -Djava.system.class.loader=org.update4j.DynamicClassLoader <your commands here>
Sébastien Gonzalez
@SebGonzalez
I need to launch my bootstrap with this arg ? "-Djava.system.class.loader=org.update4j.DynamicClassLoader"
Sébastien Gonzalez
@SebGonzalez
When I try with this arg and remove all ".classPath()" method in the config.xml I get this error :

Java HotSpot(TM) 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "org.update4j.DynamicClassLoader"). To use archived non-system classes, this property must not be set
juin 02, 2021 9:24:01 AM org.update4j.util.Warning path
WARNING: No files were found that are set with 'classpath' or 'modulepath' to true;
although perfectly valid it's rarely what you want.
Please refer to: https://github.com/update4j/update4j/wiki/Documentation#classpath-and-modulepath

Exception in thread "Thread-6" java.lang.RuntimeException: java.lang.ClassNotFoundException: com.eukles.resoposte.AgentResoposteV2
at org.update4j.service.DefaultLauncher.run(DefaultLauncher.java:123)
at org.update4j.ConfigImpl.lambda$doLaunch$13(ConfigImpl.java:693)
at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: java.lang.ClassNotFoundException: com.eukles.resoposte.AgentResoposteV2
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:433)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:586)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
at org.update4j.service.DefaultLauncher.run(DefaultLauncher.java:102)
... 2 more

If I try to put back the "classPath()" method and let the vm arg I retake the same error as beginning
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.update4j.service.DefaultLauncher.run(DefaultLauncher.java:123)
at org.update4j.ConfigImpl.lambda$doLaunch$13(ConfigImpl.java:693)
at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.update4j.service.DefaultLauncher.run(DefaultLauncher.java:118)
... 2 more
Caused by: java.lang.IllegalAccessError: class com.eukles.resoposte.AgentResoposteV2 (in unnamed module @0x2670e61) cannot access class com.sun.javafx.application.LauncherImpl (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.application to unnamed module @0x2670e61
Astrid Sawatzky
@astridsawatzky_gitlab
can you add the export declaration from above to the call on commandline ?
Sébastien Gonzalez
@SebGonzalez
Yes it works thanks you @astridsawatzky_gitlab and @mordechaim !
Just a question if I want to inject the stage with @InjectSource I need that my main app implements Launcher ?
Mordechai Meisels
@mordechaim
Yes
Astrid Sawatzky
@astridsawatzky_gitlab
very welcome
Sébastien Gonzalez
@SebGonzalez
Sorry to bore you but when I didn't succeed in generate an executable
I try to launch this command from jars
java -Djava.system.class.loader=org.update4j.DynamicClassLoader -classpath "hellofx.jar; javafx-base-13.jar; javafx-base-13-win.jar; javafx-controls-13.jar; javafx-controls-13-win.jar; javafx-fxml-13-win.jar; javafx-graphics-13.jar;javafx-graphics-13-win.jar; update4j-1.5.7.jar" com.eukles.resoposte.bootstrap.JavaFxDelegate --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
Sébastien Gonzalez
@SebGonzalez
But my bootstrap never start. Maybe have you got an idea ?
Mordechai Meisels
@mordechaim
What do you mean it never starts? Do you have any exception output?
Sébastien Gonzalez
@SebGonzalez
Ok the problem was cause to me (don't use main class which extends Application). Thanks you again for your help !
guiamatera
@guiamatera

Hello everybody,

In the "update" method of the org.update4j.Configuration class

 -> public boolean update(PublicKey key, UpdateHandler handler) {

it receives a PublicKey to check the signature of the jars.

I would like to know How I can get this PublicKey to be able to pass it as a parameter to the "udpate" method. Could someone help me?

Another question is: I already have a signed jar, how do I get the signature of a jar to pass in the "signature" parameter in the config.xml file

Mordechai Meisels
@mordechaim
If you use the default (CLI-based) launcher you dont need to worry about thi, you can juat pass the certificate generated by the keytool to the --cert param.
Otherwise, the config signature doesnt care about aigned jars, ut uses its own signatures and can sign any type of file.
When you generate the config you should pass the private key to the signer() method.
PublicKey and PrivateKey are standard Java classes that encapsulate any keypair algorithm. For your specific algorithm or implementation you need to read the related docs how to obtain the keys which you can later pass in those methods.
guiamatera
@guiamatera

I was able to pass the certificate with PublicKey.

But now I need to get, for each jar, the "signature" attribute string to put in the config.xml file.

The update4j code will check this string in the following code:
-> !sig.verify(Base64.getDecoder().decode(file.getSignature()))

Does anyone know how I can get this signature from a jar file?

Mordechai Meisels
@mordechaim
When you generate the config you should pass the private key to the signer() method.