简体   繁体   中英

Java FX Applications Installing in Same Directory

I have two separate JavaFX Applications that I am deploying as native Windows exe using the method described here but with the install option set to true so that it installs in the C: drive, not app data. For some reason both applications install into the same directory and both use the same uninstall file which poses a serious problem for me. The directory it installs into is whatever program is installed first. For example, if I install Program1 first they both install into C:/Program Files/Program1. If Program2 is installed first they both install into C:/Program Files/Program2. They both have their default directories set in the Inno Setup file and they are different. Anyone ever run into this problem before? Thanks!

Here is the Inno Setup file that is generated from the ant build on Program 1

;This file will be executed next to the application bundle image
;I.e. current directory will contain folder Program1 with application files
[Setup]
AppId={{fxApplication}}
AppName=Program1
AppVersion=1.4.0
AppVerName=Program1 1.4.0
AppPublisher=My Company
AppComments=Program1FX
AppCopyright=Copyright (C) 2015
;AppPublisherURL=http://java.com/
;AppSupportURL=http://java.com/
;AppUpdatesURL=http://java.com/
DefaultDirName={pf}\Program1
DisableStartupPrompt=Yes
DisableDirPage=Yes
DisableProgramGroupPage=Yes
DisableReadyPage=Yes
DisableFinishedPage=Yes
DisableWelcomePage=Yes
DefaultGroupName=My Company
;Optional License
LicenseFile=
;WinXP or above
MinVersion=0,5.1 
OutputBaseFilename=Program1-1.4.0
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin
SetupIconFile=Program1\Program1.ico
UninstallDisplayIcon={app}\Program1.ico
UninstallDisplayName=Program1
WizardImageStretch=No
WizardSmallImageFile=Program1-setup-icon.bmp   
ArchitecturesInstallIn64BitMode=x64


[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "Program1\Program1.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Program1\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\Program1"; Filename: "{app}\Program1.exe"; IconFilename: "{app}\Program1.ico"; Check: returnTrue()
Name: "{commondesktop}\Program1"; Filename: "{app}\Program1.exe";  IconFilename: "{app}\Program1.ico"; Check: returnTrue()


[Run]
Filename: "{app}\Program1.exe"; Parameters: "-Xappcds:generatecache"; Check: returnFalse()
Filename: "{app}\Program1.exe"; Description: "{cm:LaunchProgram,Program1}"; Flags: nowait postinstall skipifsilent; Check: returnTrue()
Filename: "{app}\Program1.exe"; Parameters: "-install -svcName ""Program1"" -svcDesc ""Program1"" -mainExe ""Program1.exe""  "; Check: returnFalse()

[UninstallRun]
Filename: "{app}\Program1.exe "; Parameters: "-uninstall -svcName Program1 -stopOnUninstall"; Check: returnFalse()

[Code]
function returnTrue(): Boolean;
begin
  Result := True;
end;

function returnFalse(): Boolean;
begin
  Result := False;
end;

function InitializeSetup(): Boolean;
begin
// Possible future improvements:
//   if version less or same => just launch app
//   if upgrade => check if same app is running and wait for it to exit
//   Add pack200/unpack200 support? 
  Result := True;
end; 

and for Program 2

;This file will be executed next to the application bundle image
;I.e. current directory will contain folder Program2 with application files
[Setup]
AppId={{fxApplication}}
AppName=Program2
AppVersion=1.3.1
AppVerName=Program2 1.3.1
AppPublisher=My Company
AppComments=Program2
AppCopyright=Copyright (C) 2015
;AppPublisherURL=http://java.com/
;AppSupportURL=http://java.com/
;AppUpdatesURL=http://java.com/
DefaultDirName={pf}\Program2
DisableStartupPrompt=Yes
DisableDirPage=Yes
DisableProgramGroupPage=Yes
DisableReadyPage=Yes
DisableFinishedPage=Yes
DisableWelcomePage=Yes
DefaultGroupName=My Company
;Optional License
LicenseFile=
;WinXP or above
MinVersion=0,5.1 
OutputBaseFilename=Program2-1.3.1
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin
SetupIconFile=Program2\Program2.ico
UninstallDisplayIcon={app}\Program2.ico
UninstallDisplayName=Program2
WizardImageStretch=No
WizardSmallImageFile=Program2-setup-icon.bmp   
ArchitecturesInstallIn64BitMode=x64


[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "Program2\Program2.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Program2\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\Program2"; Filename: "{app}\Program2.exe"; IconFilename: "{app}\Program2.ico"; Check: returnTrue()
Name: "{commondesktop}\Program2"; Filename: "{app}\Program2.exe";  IconFilename: "{app}\Program2.ico"; Check: returnTrue()


[Run]
Filename: "{app}\Program2.exe"; Parameters: "-Xappcds:generatecache"; Check: returnFalse()
Filename: "{app}\Program2.exe"; Description: "{cm:LaunchProgram,Program2}"; Flags: nowait postinstall skipifsilent; Check: returnTrue()
Filename: "{app}\Program2.exe"; Parameters: "-install -svcName ""Program2"" -svcDesc ""Program2"" -mainExe ""Program2.exe""  "; Check: returnFalse()

[UninstallRun]
Filename: "{app}\Program2.exe "; Parameters: "-uninstall -svcName Program2 -stopOnUninstall"; Check: returnFalse()

[Code]
function returnTrue(): Boolean;
begin
  Result := True;
end;

function returnFalse(): Boolean;
begin
  Result := False;
end;

function InitializeSetup(): Boolean;
begin
// Possible future improvements:
//   if version less or same => just launch app
//   if upgrade => check if same app is running and wait for it to exit
//   Add pack200/unpack200 support? 
  Result := True;
end;  

Okay, I cannot believe I didn't see it before but the issue is the AppId

The build.fxbuild sets the id to fxApplication by default, manually edit the build.fxbuild to have a unique app id . There are a few other places in the build.fxbuild that reference fxApplication so make sure to change those as well

<fx:application id="UNIQUE_NAME_HERE"
... />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM