Java compile error

Discussion in 'Big Data and Analytics' started by Aditya (1867), Dec 9, 2016.

  1. Aditya (1867)

    Aditya (1867) Active Member

    Joined:
    Nov 21, 2013
    Messages:
    44
    Likes Received:
    0
    Hello All,

    I am trying to compile my first java UDF for a pig.
    But when I am trying to compile it in webconsole in cloudlab I am getting below error

    [XXXX_gmail@ec2-52-86-42-143 /]$ javac -classpath /usr/hadoop/hadoop-core-1.0.4.jar /home/XXXX_gmail/Sample_Eval.java
    /home/XXXX_gmail/Sample_Eval.java:2: error: package org.apache.pig does not exist
    import org.apache.pig.EvalFunc;
    ^
    /home/XXXX_gmail/Sample_Eval.java:3: error: package org.apache.pig.data does not exist
    import org.apache.pig.data.Tuple;
    ^
    /home/XXXX_gmail/Sample_Eval.java:6: error: package org.apache.pig does not exist
    import org.apache.pig.EvalFunc;
    ^
    /home/XXXX_gmail/Sample_Eval.java:7: error: package org.apache.pig.data does not exist
    import org.apache.pig.data.Tuple;
    ^
    /home/XXXX_gmail/Sample_Eval.java:9: error: cannot find symbol
    public class Sample_Eval extends EvalFunc<String>{
    ^
    symbol: class EvalFunc
    /home/XXXX_gmail/Sample_Eval.java:11: error: cannot find symbol
    public String exec(Tuple input) throws IOException {
    ^
    symbol: class Tuple
    location: class Sample_Eval
    6 errors

    Can anybody help me.

    Regards,

    Aditya
     
    #1
  2. Karthik Shivana

    Karthik Shivana Moderator
    Simplilearn Support Alumni

    Joined:
    Apr 1, 2016
    Messages:
    674
    Likes Received:
    28
    Hi Aditya,

    Please don't compile the codes and execute with pig script and share the error screen shot with us.

    Regards
    Karthik
     
    #2
  3. Aditya (1867)

    Aditya (1867) Active Member

    Joined:
    Nov 21, 2013
    Messages:
    44
    Likes Received:
    0
    Sorry Karthik did not follow you. Do you have a solution for my problem ?
     
    #3
  4. Karthik Shivana

    Karthik Shivana Moderator
    Simplilearn Support Alumni

    Joined:
    Apr 1, 2016
    Messages:
    674
    Likes Received:
    28
    Hi Aditya,

    Please share the code with us, so that we will check and we will help you out.
     
    #4
  5. Aditya (1867)

    Aditya (1867) Active Member

    Joined:
    Nov 21, 2013
    Messages:
    44
    Likes Received:
    0
    Hi,

    Below is my code

    import java.io.IOException;
    import org.apache.pig.EvalFunc;
    import org.apache.pig.data.Tuple;

    import java.io.IOException;
    import org.apache.pig.EvalFunc;
    import org.apache.pig.data.Tuple;

    public class Sample_Eval extends EvalFunc<String>{

    public String exec(Tuple input) throws IOException {
    if (input == null || input.size() == 0)
    return null;
    String str = (String)input.get(0);
    return str.toUpperCase();
    }
    }
    i dont think the problem is with my code. The problem is I dont know how to compile it. I am trying to compile it in the webconsole of the cloudslab and i am getting this error when i trying to use the javac command as shown earlier.

    Regards,

    Aditya
     
    #5
  6. Aditya (1867)

    Aditya (1867) Active Member

    Joined:
    Nov 21, 2013
    Messages:
    44
    Likes Received:
    0
     
    #6
  7. Aditya (1867)

    Aditya (1867) Active Member

    Joined:
    Nov 21, 2013
    Messages:
    44
    Likes Received:
    0
    Can somebody help me with this, i have tried to raise the issue with my lecturer but he is no good.
     
    #7

Share This Page