Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows registry name write default ? #341

Closed
2 of 5 tasks
xbmlz opened this issue Jun 16, 2023 · 17 comments
Closed
2 of 5 tasks

Windows registry name write default ? #341

xbmlz opened this issue Jun 16, 2023 · 17 comments
Labels
bug Something isn't working fixed Issue fixed and release pending merged Changes merged into devel branch

Comments

@xbmlz
Copy link

xbmlz commented Jun 16, 2023

I'm submitting a…

  • bug report
  • feature request
  • other

Short description of the issue/suggestion:

Windows Registry Name is default

Steps to reproduce the issue/enhancement:

maven content

<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>
            <valueName>""</valueName>
            <valueType>REG_SZ</valueType>
            <valueData>{app}\{#MyAppExeName} %1</valueData>
        </entry>
    </entries>
</registry>

What is the expected behavior?

[Registry]
Root: HKCR; Subkey: "*\shell\JEditor"; ValueType: string; ValueName: "Icon"; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "*\shell\JEditor\command"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName} %1"; Flags: uninsdeletevalue

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?

[Registry]
Root: HKCR; Subkey: "*\shell\JEditor"; ValueType: string; ValueName: "Icon"; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "*\shell\JEditor\command"; ValueType: string; ValueName: """"; ValueData: "{app}\{#MyAppExeName} %1"; Flags: uninsdeletevalue

image

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:

  • JavaPackager version:
  • OS version: windows 10
  • JDK version: oracle-jdk-17
  • Build tool:
    • Maven
    • Gradle

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

@xbmlz
Copy link
Author

xbmlz commented Jun 16, 2023

generate msi

image

image

@fvarrui fvarrui added the bug Something isn't working label Jun 20, 2023
@fvarrui
Copy link
Owner

fvarrui commented Jun 26, 2023

Work in progress in branch issue-341.

@fvarrui fvarrui added the working on Work in progress on this issue label Jun 26, 2023
@fvarrui
Copy link
Owner

fvarrui commented Jun 26, 2023

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!

@fvarrui
Copy link
Owner

fvarrui commented Jun 27, 2023

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.

@fvarrui
Copy link
Owner

fvarrui commented Jun 27, 2023

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.

@fvarrui fvarrui added feedback Waiting for feedback and removed working on Work in progress on this issue labels Jun 27, 2023
@xbmlz
Copy link
Author

xbmlz commented Jul 4, 2023

Thank you very much. I will provide feedback during the test

@xbmlz xbmlz closed this as completed Jul 4, 2023
@fvarrui
Copy link
Owner

fvarrui commented Jul 4, 2023

Please, keep this issue open till you confirm it's fixed and released. Thanks!

@fvarrui fvarrui reopened this Jul 4, 2023
@xbmlz
Copy link
Author

xbmlz commented Jul 14, 2023

I don't seem to be able to use the snapshot version

image

image

@fvarrui
Copy link
Owner

fvarrui commented Jul 14, 2023

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?

@xbmlz
Copy link
Author

xbmlz commented Jul 15, 2023

image
I can only write version as 1.7.3-SNAPSHOT, but there were still other errors

@fvarrui
Copy link
Owner

fvarrui commented Jul 15, 2023

Please, can you share all the plugin output?

@xbmlz
Copy link
Author

xbmlz commented Jul 15, 2023

Sorry, I made a mistake in writing fileVersion and productVersion just now. After testing, this issue has been fixed. Thank you!
image
image

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>

@xbmlz
Copy link
Author

xbmlz commented Jul 15, 2023

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

@fvarrui
Copy link
Owner

fvarrui commented Jul 15, 2023

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.

@fvarrui
Copy link
Owner

fvarrui commented Jul 15, 2023

winConfig.fileVersion and winConfig.productVersion only accept x.x.x.x format.

@fvarrui fvarrui added fixed Issue fixed and release pending and removed feedback Waiting for feedback labels Jul 15, 2023
@fvarrui
Copy link
Owner

fvarrui commented Jul 15, 2023

Branch issue-341 merged into devel, ready to be released in 1.7.3 ASAP.

@fvarrui fvarrui added the merged Changes merged into devel branch label Aug 11, 2023
@fvarrui
Copy link
Owner

fvarrui commented Aug 11, 2023

1.7.3 released to Maven Central

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Issue fixed and release pending merged Changes merged into devel branch
Projects
None yet
Development

No branches or pull requests

2 participants