问题描述
我正在使用Hadoop 2.7.2(最新的atm)在Java中做一个Friend Recommendationer应用程序,而我刚刚完成了代码.我想编译.java
文件并创建.class
文件,但是当我运行命令
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
我收到以下错误:
FriendSuggest.java:63: error:
error while writing FriendMapper: /home/gramanas/FriendSuggest$FriendMapper.class
public static class FriendMapper
^
我认为它与代码无关,因为它可以在IDEA中正常编译.我想从命令行进行编译,但无法正常工作.
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?
其他信息:
- Ubuntu 16.04
- Hadoop 2.7.2伪分布式模式
- java-1.7.0-openjdk-amd64
推荐答案
这种类型的错误可能是由于您在执行编译的路径上没有写权限而引起的.
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.
这篇关于从命令行编译Java时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!