This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I am trying to call Java code in my library jar file using the instructions: http://www.headius.com/jrubywiki/index.php/Calling_Java_from_JRuby I do not want to copy my jar file into jruby/lib. Ideally I would like to add a project dependency on a Java Library project or a library from Library Manager and let the magic happen. A quick workaround would be to specify the CLASSPATH environment variable for the jruby process manually. But I did not find a way to do even that.
Created attachment 39286 [details] adding cp to env of jruby execution and to webrick
OK, I checked that adding jar file to CLASSPATH env variable does the trick (diff attached). Now, the question for Tor is if you are OK with adding Libraries node similar to the one in Java project into Ruby and RoR project. Perhaps labeled "Java Libraries". And also adding the Libraries section into project customizer. If not, what UI would you propose? Another issue is that if we add Java libraries the user would probably expect these libraries to be compiled before the Ruby/RoR project is executed. Not a P1, perhaps, but IMO nice convenience. But if we want that we would need to add an Ant script to call the dependent project. Are you OK with that?
I was thinking that Ruby and Rails projects should have a "Enable Java" setting. (We may have a separate project entry in the New Project wizard for these, e.g. Ruby Project, and Ruby with Java Libraries project, but they would both use the same underlying project type). When "Enable Java" is set on a Ruby project: - There is a libraries panel where you can import jars and other netbeans libraries, and these will be added to JRuby's CLASSPATH - The source indexer will include some JRuby specific extensions to all Objects, such as the "include_class" method - this will then show up in code completion etc. - Code completion will be modified to include Java classes in its code completion. (I'll have to use the java/source stuff to do queries on Java classes as well and feed the results back into my own Ruby completion dialog. I'm not sure yet if that will be adequate (to get Java javadoc popups etc.) or if I need to do anything more clever to pick up all the code completion smarts in JavaCompletionProvider. - Possibly the Java Platform to be used (for JRuby execution) should be selectable and set on the project.
Tor, just two comments: 1. IMO the setting should not be only in project template, you should be able to add Java support to an existing R/RoR project. This is similar to what we do with web frameworks in web app: you can either select frameworks in the last panel of porject wizard or (in the same panel) in project properties dialog. 2. I did not check if/why we need the dependency on Java APIs and if we could get rid of them. Ideally we should keep the Java support separate from the Ruby and Rails project implementation and make the plain Ruby/Rails projects independent of Java infrastructure. This will make it easier to build a small ruby IDE w/o Java. This requires more investigation.
This is implemented; Ruby and Rails projects now have a separate "Java" panel in their property sheets where you can add in Jars that should be made accessible to the JRuby VM.
Reassigning this issue to newly created 'ruby' component.
Changing target milestone of all resolved Ruby issues from TBD to 6.0 Beta 1 build.