Closed xbmlz closed 1 year ago
generate msi
Work in progress in branch issue-341
.
registry.valueData
and registry.valueName
are no longer mandatory.
I've just released a SNAPSHOT version: 1.7.3-20230626.114901-9
(see how to use snapshot versions)
Please, test it and give some feedback.
Now working on MSI.
Thanks!
Just fixed for MSI generation.
Now you can test 1.7.3-20230627.004407-10
snapshot version, but you should do it this way:
<plugin>
<groupId>io.github.fvarrui</groupId>
<artifactId>javapackager</artifactId>
<version>1.7.3-20230627.004407-10</version>
<configuration>
<generateInstaller>true</generateInstaller>
[some other config options]
</configuration>
<executions>
<execution>
<id>windows-setup</id>
<phase>package</phase>
<goals>
<goal>package</goal>
</goals>
<configuration>
<platform>windows</platform>
<winConfig>
<generateSetup>true</generateSetup>
<generateMsi>false</generateMsi>
<registry>
<entries>
<entry>
<key>HKCR:*\shell\${project.name}</key>
<valueName>Icon</valueName>
<valueType>REG_SZ</valueType>
<valueData>{app}\{#MyAppExeName}</valueData>
</entry>
<entry>
<key>HKCR:*\shell\${project.name}\command</key>
<valueType>REG_SZ</valueType>
<valueData>{app}\{#MyAppExeName} %1</valueData>
</entry>
</entries>
</registry>
</winConfig>
</configuration>
</execution>
<execution>
<id>windows-msi</id>
<phase>package</phase>
<goals>
<goal>package</goal>
</goals>
<configuration>
<platform>windows</platform>
<winConfig>
<generateSetup>false</generateSetup>
<generateMsi>true</generateMsi>
<registry>
<entries>
<entry>
<key>HKCR:*\shell\${project.name}</key>
<valueName>Icon</valueName>
<valueType>REG_SZ</valueType>
<valueData>[#EXEFILE]</valueData>
</entry>
<entry>
<key>HKCR:*\shell\${project.name}\command</key>
<valueType>REG_SZ</valueType>
<valueData>[#EXEFILE] %1</valueData>
</entry>
</entries>
</registry>
</winConfig>
</configuration>
</execution>
</executions>
</plugin>
Note that valueName
is not necessary for the default value and you need separate runs to generate the Setup installer on the one hand and the MSI on the other, since the way to set the registry entries for Inno Setup and for WiX Toolset are different.
Maybe we can define a kind of JP variables for installation path ({INSTALLDIR}
) and installed EXE path ({EXEFILE}
):
<registry>
<entries>
<entry>
<key>HKCR:*\shell\${project.name}</key>
<valueName>Icon</valueName>
<valueType>REG_SZ</valueType>
<valueData>{EXEFILE}</valueData>
</entry>
<entry>
<key>HKCR:*\shell\${project.name}\command</key>
<valueType>REG_SZ</valueType>
<valueData>{EXEFILE} %1</valueData>
</entry>
</entries>
</registry>
Where, in this case, {EXEFILE}
can be internally replaced with {app}\{#MyAppExeName}
for Inno Setup and with [#EXEFILE]
for WiX Toolset. This way you only need one execution.
Thank you very much. I will provide feedback during the test
Please, keep this issue open till you confirm it's fixed and released. Thanks!
I don't seem to be able to use the snapshot version
I'm not sure what's the problem, but javapackager-1.7.3-20230626.114901-9.jar is published. Maybe something is wrong for IntelliJ?
Did you try to build your app from the command line?
I can only write version as 1.7.3-SNAPSHOT, but there were still other errors
Please, can you share all the plugin output?
Sorry, I made a mistake in writing fileVersion and productVersion just now. After testing, this issue has been fixed. Thank you!
This is my complete configuration:
<plugin>
<groupId>io.github.fvarrui</groupId>
<artifactId>javapackager</artifactId>
<version>1.7.3-20230627.004407-10</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>package</goal>
</goals>
<configuration>
<!-- mandatory -->
<mainClass>io.xbmlz.jeditor.Main</mainClass>
<administratorRequired>false</administratorRequired>
<winConfig>
<icoFile>${project.basedir}/src/main/resources/build/logo.ico</icoFile>
<generateSetup>true</generateSetup>
<generateMsi>false</generateMsi>
<generateMsm>false</generateMsm>
<fileVersion>1.0.0.0</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<fileDescription>${project.description}</fileDescription>
<productName>${project.name}</productName>
<disableDirPage>false</disableDirPage>
<internalName>${project.name}</internalName>
<originalFilename>${project.name}.exe</originalFilename>
<registry>
<entries>
<entry>
<key>HKCR:*\shell\${project.name}</key>
<valueName>Icon</valueName>
<valueType>REG_SZ</valueType>
<valueData>{app}\{#MyAppExeName}</valueData>
</entry>
<entry>
<key>HKCR:*\shell\${project.name}\command</key>
<valueType>REG_SZ</valueType>
<valueData>{app}\{#MyAppExeName} %1</valueData>
</entry>
</entries>
</registry>
</winConfig>
</configuration>
</execution>
</executions>
</plugin>
Additionally, I have noticed that there may be some issues with why, as my swing program using FlatLaf may not run properly, After debugging, I found that there are a large number of warnings when running the jar package
java.lang.Error: no ComponentUI class for: javax.swing.JRadioButtonMenuItem[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=null,paintBorder=false,paintFocus=false,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Assembler 6502]
at java.desktop/javax.swing.UIDefaults.getUIError(UIDefaults.java:763)
at java.desktop/javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:144)
at java.desktop/javax.swing.UIDefaults.getUI(UIDefaults.java:793)
at java.desktop/javax.swing.UIManager.getUI(UIManager.java:1073)
at java.desktop/javax.swing.JMenuItem.updateUI(JMenuItem.java:255)
at java.desktop/javax.swing.JMenuItem.init(JMenuItem.java:220)
at java.desktop/javax.swing.JMenuItem.<init>(JMenuItem.java:159)
at java.desktop/javax.swing.JRadioButtonMenuItem.<init>(JRadioButtonMenuItem.java:189)
at java.desktop/javax.swing.JRadioButtonMenuItem.<init>(JRadioButtonMenuItem.java:126)
at io.xbmlz.jeditor.MainFrame.buildLanguagePopupMenu(MainFrame.java:511)
at io.xbmlz.jeditor.MainFrame.initComponents(MainFrame.java:415)
at io.xbmlz.jeditor.MainFrame.<init>(MainFrame.java:136)
at io.xbmlz.jeditor.MainFrame.lambda$launch$1(MainFrame.java:201)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
error: process didn't exit successfully: `target\debug\jarun.exe` (exit code: 130)
After testing, it was found that both Trust and Golang encountered different exceptions when using JNI to start the jar, which caused it to not function properly
Additionally, I have noticed that there may be some issues with why, as my swing program using FlatLaf may not run properly, After debugging, I found that there are a large number of warnings when running the jar package
java.lang.Error: no ComponentUI class for: javax.swing.JRadioButtonMenuItem[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=null,paintBorder=false,paintFocus=false,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Assembler 6502] at java.desktop/javax.swing.UIDefaults.getUIError(UIDefaults.java:763) at java.desktop/javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:144) at java.desktop/javax.swing.UIDefaults.getUI(UIDefaults.java:793) at java.desktop/javax.swing.UIManager.getUI(UIManager.java:1073) at java.desktop/javax.swing.JMenuItem.updateUI(JMenuItem.java:255) at java.desktop/javax.swing.JMenuItem.init(JMenuItem.java:220) at java.desktop/javax.swing.JMenuItem.<init>(JMenuItem.java:159) at java.desktop/javax.swing.JRadioButtonMenuItem.<init>(JRadioButtonMenuItem.java:189) at java.desktop/javax.swing.JRadioButtonMenuItem.<init>(JRadioButtonMenuItem.java:126) at io.xbmlz.jeditor.MainFrame.buildLanguagePopupMenu(MainFrame.java:511) at io.xbmlz.jeditor.MainFrame.initComponents(MainFrame.java:415) at io.xbmlz.jeditor.MainFrame.<init>(MainFrame.java:136) at io.xbmlz.jeditor.MainFrame.lambda$launch$1(MainFrame.java:201) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) error: process didn't exit successfully: `target\debug\jarun.exe` (exit code: 130)
After testing, it was found that both Trust and Golang encountered different exceptions when using JNI to start the jar, which caused it to not function properly
Here you can open an issue about this.
winConfig.fileVersion
and winConfig.productVersion
only accept x.x.x.x
format.
Branch issue-341
merged into devel
, ready to be released in 1.7.3 ASAP.
1.7.3 released to Maven Central
I'm submitting a…
Short description of the issue/suggestion:
Windows Registry Name is default
Steps to reproduce the issue/enhancement:
maven content
What is the expected behavior?
source code is https://github.com/fvarrui/JavaPackager/blob/master/src/main/java/io/github/fvarrui/javapackager/packagers/GenerateSetup.java#L50
What is the current behavior?
Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?
What is the motivation / use case for changing the behavior?
windows registry default name
Please tell us about your environment:
Other information (e.g. related issues, suggestions how to fix, links for us to have context)