1

I am doing a Friend Suggester application in Java using Hadoop 2.7.2 (latest atm) and I just finished the code. I want to compile the .java file and create the .class files but when I run the command

javac -d "/home/gramanas/" -cp "/srv/hadoop/share/hadoop/common/hadoop-common-2.7.2.jar:/srv/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.7.2.jar:/usr/lib/jvm/java-1.7.0-openjdk-amd64" FriendSuggest.java 

I get the following error:

FriendSuggest.java:63: error: 
error while writing FriendMapper: /home/gramanas/FriendSuggest$FriendMapper.class
    public static class FriendMapper
                  ^

I don't think it has something to do with the code since it compiles normally in IDEA. I want to compile it from command line but I can't get it to work.

What is the problem? How can I fix it?

Additional Info:

  • Ubuntu 16.04
  • Hadoop 2.7.2 pseudo distributed mode
  • java-1.7.0-openjdk-amd64
7
  • Are you sure you have writing permissions in the path where the code is? Maybe try to move it elsewhere where you are sure. Commented May 3, 2016 at 21:32
  • @LorisSecuro I feel stupid. But I was expecting a warning having to do with permission if that was the case. I used sudo and it compiled successfully. Commented May 3, 2016 at 21:36
  • In the future, please try to write a more informative question title, one that succinctly tells us exactly what your problem is, not a general complaint or plight. Commented May 3, 2016 at 21:37
  • Why exactly do you want to build from the command line? You can use Maven to build a JAR file for Hadoop to run Commented May 3, 2016 at 21:44
  • 1
    Don't use sudo unless you really need to. If you end up with files owned by root, you will see errors exactly like this. Commented May 3, 2016 at 22:45

1 Answer 1

2

That type of error might be caused by not having writing permissions on the path you are executing the compilation.

You should try to compile where/when you are sure to have such permissions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.