File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Sources/JavaKit/JavaKitVM Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1212//
1313//===----------------------------------------------------------------------===//
1414
15+ #if canImport(FoundationEssentials)
16+ import FoundationEssentials
17+ #else
18+ import Foundation
19+ #endif
20+
1521typealias JavaVMPointer = UnsafeMutablePointer < JavaVM ? >
1622
1723public final class JavaVirtualMachine : @unchecked Sendable {
@@ -54,6 +60,12 @@ public final class JavaVirtualMachine: @unchecked Sendable {
5460 // Construct the complete list of VM options.
5561 var allVMOptions : [ String ] = [ ]
5662 if !classPath. isEmpty {
63+ let fileManager = FileManager . default
64+ for path in classPath {
65+ if !fileManager. fileExists ( atPath: path) {
66+ throw JavaKitError . classPathEntryNotFound ( entry: path, classPath: classPath)
67+ }
68+ }
5769 let colonSeparatedClassPath = classPath. joined ( separator: " : " )
5870 allVMOptions. append ( " -Djava.class.path= \( colonSeparatedClassPath) " )
5971 }
@@ -268,4 +280,8 @@ extension JavaVirtualMachine {
268280 }
269281 }
270282 }
283+
284+ enum JavaKitError : Error {
285+ case classPathEntryNotFound( entry: String , classPath: String )
286+ }
271287}
You can’t perform that action at this time.
0 commit comments