Try running with 
java -cp <path>pig.jar idlocal.Idlocal

David

On Apr 3, 2014, at 7:54 AM, Junior Tsire <jajao2...@yahoo.fr> wrote:

> Hi everybody,
> 
> I have been following a tutorial on how to embed pig in java because I am 
> currently learning it. I used the sample code that I found on 
> http://pig.apache.org/docs/r0.11.0/cont.html to teach myself and here is the 
> code that I took and paste it on netbeans
> 
> package idlocal;
> 
> import java.io.IOException;
> 
> import org.apache.pig.PigServer;
> 
> public class Idlocal{ 
> public static void main(String[] args) {
> 
> try {
>     PigServer pigServer = new PigServer("local");
>     runIdQuery(pigServer, "passwd");
>     }
>     catch(Exception e) {
>     }
>  }
> 
> public static void runIdQuery(PigServer pigServer, String inputFile) throws 
> IOException {
>     pigServer.registerQuery("A = load '" + inputFile + "' using 
> PigStorage(':');");
>     pigServer.registerQuery("B = foreach A generate $0 as id;");
>     pigServer.store("B", "id.out");
>  }
> }
> 
> I managed to compile it on cygwin by doing javac -cp <path>pig.jar 
> idlocal.java. It successfully created the class file. Now when I tried to run 
> it (on cygwin) by doing  java -cp <path>pig.jar idlocal, it gave me the this 
> Error: Could not find or load main class Idlocal.
> I really need some help because I don't know what is going on :(

Reply via email to