JuliaInterop / JavaCall.jl

Call Java from Julia
http://juliainterop.github.io/JavaCall.jl
Other
118 stars 53 forks source link

addClassPath_MultiModuleCapable #86

Closed RainerHeintzmann closed 5 years ago

RainerHeintzmann commented 5 years ago

Slightly changed the mechanism of the addClasspath function such that multiple modules can safely use JavaCall. Each of such modules can add the classes via calls to addClassPath and addOpts, which are registered in the Julia ENV system and then processed once init() is called. Added also a bit to the documentation of init() stating an example how this mechanism should be used.

aviks commented 5 years ago

Hi Rainer,

Thanks for your contribution.

However, I am not entirely sure what you are attempting to do here. I believe it is already possible for multiple modules to call addClasspath and addOpts so long as they are called before init. This is the main reason init is not called on module load in JavaCall or the downstream packages. The state is stored in globals.

Does this not work for you?

RainerHeintzmann commented 5 years ago

Hi Avik, you are entirely right. I am sorry: my mistake. I did the mistake to initially write the addClasspath in the main module body instead of the init() function of my modules. This caused the problem of only one module working. Maybe the addition I made to the documentation is still usefull? Also: I changed the following line in addclasspath:

if (endswith(s, "$(Base.Filesystem.path_separator)*") && isdir(s[1:end-2]))

, since the current code is not compatible with the Windows way of selecting a path. A test confirmed this.

Should I make a new fork to only put in these changes (one-line change) and the documentation?