问题
I've installed the Dynamic Languages Toolkit (DLTK) in Eclipse 3.6. But I can't figure out how to create a Ruby file in an existing Java project.
Doing the obvious thing (New -> Empty Ruby Script) just gives the error message "Source folder is not a correct project". Do I have to modify the project in some way to tell DLTK that it's OK to add Ruby files to it?
(Adding the file outside of Eclipse does work.)
回答1:
Do the following steps (has worked for me):
- Create a java project, or visit an existing one.
- Select in the directory you want the ruby file to live in the menu entry
New file
and enter in the dialog the filenamemy_file.rb
. The essential part is the extension, because this will ensure that the ruby mechanisms are in place. - Enter in the new ruby file
def
and pressCTRL-SPACE
, you should see as a result the list withdef - method definition
(the template),def
anddefined?
. This is all part of the ruby text editor.
So it is possible to mix java and ruby files in the same project, that has as nature java. The only thing I has noticed is that the run menu entry only allows you to start the dialog Run As > Run Configurations...
and enter there the necessary parameters to start your ruby script.
来源:https://stackoverflow.com/questions/7404716/how-do-you-add-a-ruby-file-to-an-existing-project-in-eclipse-3-6-using-the-dynam