Skip to content

Commit 5b3dcec

Browse files
jlepaviks
authored andcommitted
Fix init() when classpath has not been set (#48)
Fix init() when no classpath has been set
1 parent e6e08b5 commit 5b3dcec

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/jvm.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,13 @@ opts=Array(String, 0)
126126
addClassPath(s::String) = isloaded()?warn("JVM already initialised. This call has no effect"): push!(cp, s)
127127
addOpts(s::String) = isloaded()?warn("JVM already initialised. This call has no effect"): push!(opts, s)
128128

129-
init() = init(vcat(opts, reduce((x,y)->string(x,sep,y),"-Djava.class.path=$(cp[1])",cp[2:end]) ))
129+
function init()
130+
if isempty(cp)
131+
init(opts)
132+
else
133+
init(vcat(opts, reduce((x,y)->string(x,sep,y),"-Djava.class.path=$(cp[1])",cp[2:end])))
134+
end
135+
end
130136

131137
isloaded() = isdefined(JavaCall, :jnifunc) && isdefined(JavaCall, :penv) && penv != C_NULL
132138

0 commit comments

Comments
 (0)