8211744: Cannot run AWT application generated with jpackager JDK-8200758-branch
authorherrick
Wed, 17 Oct 2018 14:14:54 -0400
branchJDK-8200758-branch
changeset 56983 01decb67d4f0
parent 56982 e094d5483bd6
child 56984 51600bf3a6e7
8211744: Cannot run AWT application generated with jpackager Submitten-by: almatvee Reviewed-by: herrick, kcr
src/jdk.packager/share/native/library/common/GenericPlatform.cpp
src/jdk.packager/share/native/library/common/GenericPlatform.h
src/jdk.packager/share/native/library/common/JavaVirtualMachine.cpp
src/jdk.packager/share/native/library/common/Platform.h
--- a/src/jdk.packager/share/native/library/common/GenericPlatform.cpp	Wed Oct 17 13:50:11 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/GenericPlatform.cpp	Wed Oct 17 14:14:54 2018 -0400
@@ -83,6 +83,18 @@
 #endif
 }
 
+TString GenericPlatform::GetPackageRuntimeBinDirectory() {
+#ifdef WINDOWS
+    return FilePath::IncludeTrailingSeparator(GetPackageRootDirectory()) + _T("runtime\\bin");
+#endif // WINDOWS
+#ifdef LINUX
+    return FilePath::IncludeTrailingSeparator(GetPackageRootDirectory()) + _T("runtime/bin");
+#endif // LINUX
+#ifdef MAC
+    return FilePath::IncludeTrailingSeparator(GetPackageRootDirectory()) + _T("Plugins/Java.runtime/Contents/Home/bin");
+#endif
+}
+
 std::list<TString> GenericPlatform::LoadFromFile(TString FileName) {
     std::list<TString> result;
 
--- a/src/jdk.packager/share/native/library/common/GenericPlatform.h	Wed Oct 17 13:50:11 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/GenericPlatform.h	Wed Oct 17 14:14:54 2018 -0400
@@ -42,6 +42,7 @@
 
     virtual TString GetPackageAppDirectory();
     virtual TString GetPackageLauncherDirectory();
+    virtual TString GetPackageRuntimeBinDirectory();
 
     virtual TString GetConfigFileName();
 
--- a/src/jdk.packager/share/native/library/common/JavaVirtualMachine.cpp	Wed Oct 17 13:50:11 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/JavaVirtualMachine.cpp	Wed Oct 17 14:14:54 2018 -0400
@@ -347,6 +347,9 @@
     if (FilePath::FileExists(_T("msvcr100.dll")) == true) {
         javaLibrary.AddDependency(_T("msvcr100.dll"));
     }
+
+    TString runtimeBin = platform.GetPackageRuntimeBinDirectory();
+    SetDllDirectory(runtimeBin.c_str());
 #else
     javaLibrary.AddDependencies(
             platform.FilterOutRuntimeDependenciesForPlatform(
--- a/src/jdk.packager/share/native/library/common/Platform.h	Wed Oct 17 13:50:11 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/Platform.h	Wed Oct 17 14:14:54 2018 -0400
@@ -433,6 +433,7 @@
 
     virtual TString GetPackageAppDirectory() = 0;
     virtual TString GetPackageLauncherDirectory() = 0;
+    virtual TString GetPackageRuntimeBinDirectory() = 0;
     virtual TString GetAppName() = 0;
 
     virtual TString GetConfigFileName() = 0;