从命令行编译Java时出错 [英] Error compiling Java from command line

查看:70
本文介绍了从命令行编译Java时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆