title: How to add an external .dll on JavaFX native library
body: <p>I would like help in understanding how I can add an external DLL to my native .exe compilation using <code>com.zenjava</code>. The problem is that I need <code>win32com.dll</code> as one of my dependencies to run my project.</p>
  
  <p>I've tried this <a href="https://stackoverflow.com/questions/1001774/managing-dll-dependencies-with-maven">StackOverflow answer</a> but it didn't work for me.</p>
  
  <pre><code>mvn install:install-file -Dfile=../../artefatos/Java Communication API/win32com.dll -DgroupId=win32com.dll -DartifactId=dll -Dversion=2.0.3 -Dpackaging=dll -DgeneratePom=true
  </code></pre>
  
  <p>The error that occurs is as follows:</p>
  
  <blockquote>
    <p>Error installing artifact 'win32com:dll:dll': Failed to install
    artifact win32com:dll:dll:2:
    D:\Projects\sentusdesk-project\desktop\sentusdesk (Acesso negado)</p>
  </blockquote>
  
  <p>Is there any way to add this DLL to my app's native release?</p>
  
  <p>My pom.xml:</p>
  
  <pre><code>    &lt;build&gt;
          &lt;finalName&gt;SentusDesk&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.8.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                      &lt;compilerArguments&gt;
                          &lt;bootclasspath&gt;${sun.boot.class.path}${path.separator}${java.home}/lib/jfxswt.jar&lt;/bootclasspath&gt;
                      &lt;/compilerArguments&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.6.0&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;java&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
                  &lt;configuration&gt;
                      &lt;mainClass&gt;${mainClass}&lt;/mainClass&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;com.zenjava&lt;/groupId&gt;
                  &lt;artifactId&gt;javafx-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;8.8.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;vendor&gt;Datachamp&lt;/vendor&gt;
                      &lt;mainClass&gt;${mainClass}&lt;/mainClass&gt;
                      &lt;verbose&gt;true&lt;/verbose&gt;
                      &lt;bundler&gt;EXE&lt;/bundler&gt;
                      &lt;nativeReleaseVersion&gt;${project.version}&lt;/nativeReleaseVersion&gt;
                      &lt;permissions&gt;
                          &lt;permission&gt;all-permissions&lt;/permission&gt;
                      &lt;/permissions&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;create-jfxjar&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;build-jar&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                      &lt;execution&gt;
                          &lt;id&gt;create-native&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;build-native&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  </code></pre>
  
  <p>My .iss file:</p>
  
  <pre><code>;This file will be executed next to the application bundle image
  ;I.e. current directory will contain folder SentusDesk with application files
  [Setup]
  AppId={{br.com.sentus.desk}}
  AppName=SentusDesk
  AppVersion=1.2.18
  AppVerName=SentusDesk 1.2.18
  AppPublisher=Datachamp
  AppComments=SentusDesk
  DefaultDirName={pf32}\SentusDesk
  DisableStartupPrompt=Yes
  DisableDirPage=No
  DisableProgramGroupPage=Yes
  DisableReadyPage=Yes
  DisableFinishedPage=No
  DisableWelcomePage=No
  DefaultGroupName=Datachamp
  OutputBaseFilename=SentusDesk
  Compression=lzma
  SolidCompression=yes
  PrivilegesRequired=poweruser
  SetupIconFile=SentusDesk\SentusDesk.ico
  UninstallDisplayIcon={app}\SentusDesk.ico
  UninstallDisplayName=UninstallSentusDesk
  WizardImageStretch=No
  
  [Languages]
  Name: brazilianportuguese; MessagesFile: compiler:Languages\BrazilianPortuguese.isl
  
  [Dirs]
  Name: "{app}";
  Name: "{app}\app";
  Name: "{app}\app\config"; Permissions: everyone-full
  
  [Files]
  Source: "SentusDesk\SentusDesk.exe"; DestDir: "{app}"; Flags: ignoreversion
  Source: "SentusDesk\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
  Source: "SentusDesk\app\*"; DestDir: "{app}\app\"; Flags: ignoreversion recursesubdirs createallsubdirs;
  Source: "SentusDesk\app\config\*"; DestDir: "{app}\app\config\"; Flags: skipifsourcedoesntexist ignoreversion recursesubdirs createallsubdirs; Permissions: everyone-full
  
  [Icons]
  Name: "{group}\SentusDesk"; Filename: "{app}\SentusDesk.exe"; IconFilename: "{app}\SentusDesk.ico"; Check: returnTrue()
  Name: "{commondesktop}\SentusDesk"; Filename: "{app}\SentusDesk.exe";  IconFilename: "{app}\SentusDesk.ico"; Check: returnFalse()
  Name: "{userdesktop}\SentusDesk"; Filename: "{app}\SentusDesk.exe";  IconFilename: "{app}\SentusDesk.ico"; Parameters: "SentusDesk.exe"; Comment: "Sentus Desk";
  
  
  [Run]
  Filename: "{app}\SentusDesk.exe"; Parameters: "-Xappcds:generatecache"; Check: returnFalse()
  Filename: "{app}\SentusDesk.exe"; Description: "{cm:LaunchProgram,SentusDesk}"; Flags: nowait postinstall skipifsilent; Check: returnTrue()
  Filename: "{app}\SentusDesk.exe"; Parameters: "-install -svcName ""SentusDesk"" -svcDesc ""SentusDesk"" -mainExe ""SentusDesk.exe""  "; Check: returnFalse()
  
  [UninstallRun]
  Filename: "{app}\UninstallSentusDesk.exe "; Parameters: "-uninstall -svcName UninstallSentusDesk -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 =&gt; just launch app
  //   if upgrade =&gt; check if same app is running and wait for it to exit
  //   Add pack200/unpack200 support? 
    Result := True;
  end;
  </code></pre>