java - 如何在 JavaFX 本机库上添加外部 .dll
问题描述
我想帮助我了解如何使用com.zenjava
. 问题是我需要win32com.dll
作为我的依赖项之一来运行我的项目。
我已经尝试过这个StackOverflow 答案,但它对我不起作用。
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;
解决方案
推荐阅读
- reactjs - 从 electron desktopCapturer 生成直播 url
- blockchain - satoshi是如何编程的?
- pdf - How to change font color and fontsize of FreeTextAnnotations (itext 7)?
- python - How to sort rows in pandas in place for given group?
- javascript - 如何通过JS检查表中的值
- php - Wordpress - 比较日期 - 十月大于十一月(Ymd)
- python - 无法使用 Scrapy 连接“str”和“NoneType”对象
- java - JavaFX——按键事件被按钮中断
- webpack - 如何获取不同 webpack 条目的 URL?
- d3.js - D3 共享缩放/过渡