Skip to content

Commit 29cf88c

Browse files
committed
scala: fixed load path for jruby
1 parent 707a851 commit 29cf88c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

RubyScript/src/org/knime/ext/jruby/RubyScriptNodeModel.scala

+10-8
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,15 @@ end
228228
val fileSep = System.getProperty("file.separator")
229229
val core = Platform.getBundle("org.knime.core")
230230
val coreClassPath = core.getHeaders.get("Bundle-Classpath").toString
231-
val corePluginPath = FileLocator.resolve(FileLocator.find(core, new Path("."), null)).getPath
231+
val corePluginPath = FileLocator.resolve(
232+
FileLocator.find(core, new Path("."), null)).toURI().normalize().getPath
232233
val base = Platform.getBundle("org.knime.base")
233234
val baseClassPath = base.getHeaders.get("Bundle-Classpath").toString
234-
val basePluginPath = FileLocator.resolve(FileLocator.find(base, new Path("."), null)).getPath
235+
val basePluginPath = FileLocator.resolve(
236+
FileLocator.find(base, new Path("."), null)).toURI().normalize().getPath
235237
val ruby = Platform.getBundle("org.knime.ext.jruby")
236-
val rubyPluginPath = FileLocator.resolve(FileLocator.find(ruby, new Path("."), null)).getPath
237-
val ext = new StringBuffer()
238-
ext.append(basePluginPath + fileSep + "lib")
239-
ext.append(corePluginPath + fileSep + "lib")
240-
ext.append(getJavaExtDirsExtensionPath)
238+
val rubyPluginPath = FileLocator.resolve(
239+
FileLocator.find(ruby, new Path("."), null)).toURI().normalize().getPath
241240

242241
val classpath = ArrayBuffer[String]()
243242
classpath ++= coreClassPath.split(",").view
@@ -249,12 +248,15 @@ end
249248
.map(s => FileLocator.find(base, new Path(s), null)).filter(_ != null)
250249
.foreach { u => classpath.add(FileLocator.resolve(u).getFile) }
251250

252-
classpath += basePluginPath + fileSep + "bin"
251+
classpath += basePluginPath + "bin"
253252
classpath += getJavaClasspathExtensionPath
254253
if (RubyScriptNodePlugin.getDefault.getPreferenceStore.getBoolean(PreferenceConstants.JRUBY_USE_EXTERNAL_GEMS)) {
255254
val str = RubyScriptNodePlugin.getDefault.getPreferenceStore.getString(PreferenceConstants.JRUBY_PATH)
256255
System.setProperty("jruby.home", str)
257256
}
257+
// jruby 9000 gems support
258+
classpath += rubyPluginPath + "lib" + fileSep + "ruby" + fileSep + "stdlib"
259+
258260
var container = new ScriptingContainer(LocalContextScope.THREADSAFE)
259261
//container.setCompatVersion(CompatVersion.RUBY2_0)
260262
container.setCompileMode(CompileMode.JIT)

0 commit comments

Comments
 (0)