我使用Ruby22-x64
只是为了让您知道,但我在命令提示符下使用gem install RedCloth
成功安装了RedCloth-4.2.9。当我尝试require 'rubygems'
时,我得到=>false
这是正常的,因为它已经加载了,但是当我尝试require 'RedCloth
时,我得到以下错误代码:
irb(main):001:0> require 'RedCloth'
LoadError: cannot load such file -- 2.2/redcloth_scan
Couldn't load 2.2/redcloth_scan
The $LOAD_PATH was:
C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/RedCloth- 4.2.9
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/RedCloth-4.2.9/lib
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/RedCloth- 4.2.9/lib/case_sensitive_require
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/RedCloth-4.2.9/ext
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/x64-msvcrt
C:/Ruby22-x64/lib/ruby/site_ruby
C:/Ruby22-x64/lib/ruby/vendor_ruby/2.2.0
C:/Ruby22-x64/lib/ruby/vendor_ruby/2.2.0/x64-msvcrt
C:/Ruby22-x64/lib/ruby/vendor_ruby
C:/Ruby22-x64/lib/ruby/2.2.0
C:/Ruby22-x64/lib/ruby/2.2.0/x64-mingw32
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54
:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54
:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/RedCloth- 4.2.9/lib/RedCloth.
rb:13:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:12
8:in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:12
8:in `rescue in require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39
:in `require'
from (irb):1
from C:/Ruby22-x64/bin/irb:11:in `<main>'
irb(main):002:0>
我不知道RedCloth的版本是否可以这样做?还是某种路径错误?我真的在寻找一些帮助!请!
答案 0 :(得分:0)
我必须通过创建一个@RequestMapping(value="/hadoop" , method = RequestMethod.GET)
public String hadoop(ModelMap model) throws URISyntaxException, IOException {
String result = null;
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get( new URI("hdfs://myhost:9000"), conf);
Path file = new Path("/user/michael/input/input1.txt");
FSDataInputStream getIt = fs.open(file);
BufferedReader d = new BufferedReader(new InputStreamReader(getIt));
String s = "";
while ((s = d.readLine()) != null) {
result += s;
}
d.close();
fs.close();
model.addAttribute("result", result);
return "hello";
}
文件夹来包含2.2
来改变路径,然后我才能使用它!
感谢@Casper链接