如何在JavaFX本机库上添加外部.dll

我希望帮助您了解如何使用com.zenjava将外部DLL添加到本机.exe编译中。问题是我需要win32com.dll作为我的依赖项之一来运行我的项目。

我已经尝试过这个StackOverflow answer,但对我来说不起作用。

mvn install:install-file -Dfile=../../artefatos/Java Communication API/win32com.dll -DgroupId=win32com.dll -DartifactId=dll -Dversion=2.0.3 -Dpackaging=dll -DgeneratePom=true

发生的错误如下:

  

安装工件'win32com:dll:dll'时发生错误:安装失败   工件win32com:dll:dll:2:   D:\ Projects \ sentusdesk-project \ desktop \ sentusdesk(Acesso negado)

有什么办法可以将此DLL添加到我的应用的本机版本中?

我的pom.xml:

    <build>
        <finalName>SentusDesk</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArguments>
                        <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxswt.jar</bootclasspath>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>${mainClass}</mainClass>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.zenjava</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>8.8.3</version>
                <configuration>
                    <vendor>Datachamp</vendor>
                    <mainClass>${mainClass}</mainClass>
                    <verbose>true</verbose>
                    <bundler>EXE</bundler>
                    <nativeReleaseVersion>${project.version}</nativeReleaseVersion>
                    <permissions>
                        <permission>all-permissions</permission>
                    </permissions>
                </configuration>
                <executions>
                    <execution>
                        <id>create-jfxjar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build-jar</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>create-native</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build-native</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

我的.iss文件:

;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 => just launch app
//   if upgrade => check if same app is running and wait for it to exit
//   Add pack200/unpack200 support? 
  Result := True;
end;
ludyhhm 回答:如何在JavaFX本机库上添加外部.dll

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3167045.html

大家都在问