我下有機/ MYORG我的Java文件類名丟失
package org.myorg;
import java.io.*;
import java.util.*;
import java.net.*;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapred.*;
import org.apache.hadoop.util.*;
public class Write{
public static void main (String [] args) throws Exception{
try{
Path pt=new Path("hdfs:localhost:8020/user/jfor/out/abc");
FileSystem fs = FileSystem.get(new Configuration());
BufferedWriter br=new BufferedWriter(new OutputStreamWriter(fs.create(pt,true)));
// TO append data to a file, use fs.append(Path f)
String line;
line="Disha Dishu Daasha";
System.out.println(line);
br.write(line);
br.close();
}catch(Exception e){
System.out.println("File not found");
}
}
}
我使用
javac -classpath hadoop-0.20.1-dev-core.jar org/myorg/Write.java
從org
父目錄編譯它。下org/myorg
創建
Write.class我運行它使用
從Java的org
父目錄org.myorg.Write
它說
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FSDataOutputStream
at java.lang.Class.getDeclaredMethods0(Native Method)
但我下載的jar從this link。此鏈接表示FSDataOutputStream類存在。
可能是什麼原因?
我從'父目錄運行org'它說:「找不到文件「Unix系統 – 2015-02-11 05:58:58