-1

I am trying to build a jar file using ant like this:

CLASSPATH=/files/hadoop-core-1.0.4.jar CFLAGS=-m64 CXXFLAGS=-m64 ant compile-native tar

I keep getting this error:

Error: Could not find or load main class org.apache.tools.ant.launch.Launcher

ant --execdebug 

show this:

exec "/usr/java/jdk1.8.0_25/bin/java" -classpath "/usr/bin/build-classpath: error: JAVAVER_LIBDIR /usr/share/java-1.8.0 does not exist or is not a directory:/usr/java/jdk1.8.0_25/lib/tools.jar" -Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib" org.apache.tools.ant.launch.Launcher -cp ""
Error: Could not find or load main class org.apache.tools.ant.launch.Launcher

in my /etc/profile.d/java.sh

I have this entries:

export JAVA_HOME=/usr/java/jdk1.8.0_25
export ANT_HOME=/usr/local/ant

Any ideas why I am getting that error and remedy?

user1471980
  • 10,127
  • 48
  • 136
  • 235
  • Hi, those two folders are exist right? (I mean the `JAVA_HOME` and `ANT_HOME`) and also, does the user that ran the file has a valid permission? – kucing_terbang Jun 12 '15 at 16:38
  • @kucing_terbang yes, JAVA_HOME AND ANT_HOME exist. I am running this as root. – user1471980 Jun 12 '15 at 16:41
  • hmm. then could you try the suggestion in this [link](http://stackoverflow.com/questions/2336299/what-is-wrong-with-my-ant-configuration)? – kucing_terbang Jun 12 '15 at 16:44

1 Answers1

1

Make sure that your main class is in the location you have mentioned..its not able to find your main class

sudipta06
  • 658
  • 7
  • 12
  • yes, hadoop-core-1.0.4.jar this file exist and I list the full path to it, your answer is not it. – user1471980 Jun 12 '15 at 16:42
  • when I run ant itself in the command line, I still get that error: "Error: Could not find or load main class org.apache.tools.ant.launch.Launcher" – user1471980 Jun 12 '15 at 16:43
  • Its not able to find your Launcher class which is i guess your main class, which you have mentioned in your build file.. – sudipta06 Jun 13 '15 at 03:28