@@ -121,16 +121,16 @@ end
121
121
122
122
@static is_unix () ? (const sep = " :" ) : nothing
123
123
@static is_windows () ? (const sep = " ;" ) : nothing
124
- cp= Array {String} (0 )
125
- opts= Array {String} (0 )
124
+ cp= Set {String} ()
125
+ opts= Set {String} ()
126
126
127
127
function addClassPath (s:: String )
128
128
if isloaded ()
129
129
warn (" JVM already initialised. This call has no effect" )
130
130
return
131
131
end
132
132
if s== " " ; return ; end
133
- if endswith (s, " /*" )
133
+ if endswith (s, " /*" ) && isdir (s[ 1 : end - 2 ])
134
134
for x in s[1 : end - 1 ] .* readdir (s[1 : end - 2 ])
135
135
if endswith (x, " .jar" )
136
136
push! (cp, x)
@@ -148,7 +148,7 @@ function init()
148
148
if isempty (cp)
149
149
init (opts)
150
150
else
151
- init (vcat (opts, reduce ((x,y)-> string (x,sep,y)," -Djava.class.path=$(cp [1 ]) " ,cp [2 : end ])))
151
+ init (vcat (collect ( opts) , reduce ((x,y)-> string (x,sep,y)," -Djava.class.path=$(collect (cp) [1 ]) " ,collect (cp) [2 : end ])))
152
152
end
153
153
end
154
154
@@ -158,12 +158,9 @@ assertloaded() = isloaded()?nothing:error("JVM not initialised. Please run init(
158
158
assertnotloaded () = isloaded ()?error (" JVM already initialised" ): nothing
159
159
160
160
# Pointer to pointer to pointer to pointer alert! Hurrah for unsafe load
161
- function init {T<:AbstractString} (opts:: Array{T, 1} )
161
+ function init (opts)
162
162
assertnotloaded ()
163
- opt = Array {JavaVMOption} (length (opts))
164
- for i in 1 : length (opts)
165
- opt[i]= JavaVMOption (pointer (opts[i]), C_NULL )
166
- end
163
+ opt = [JavaVMOption (pointer (x), C_NULL ) for x in opts]
167
164
ppjvm= Array {Ptr{JavaVM}} (1 )
168
165
ppenv= Array {Ptr{JNIEnv}} (1 )
169
166
vm_args = JavaVMInitArgs (JNI_VERSION_1_6, convert (Cint, length (opts)), convert (Ptr{JavaVMOption}, pointer (opt)), JNI_TRUE)
0 commit comments