0

I am building aprofplot on Ubuntu using Apache Ant. When I enter the command ant in the folder containing build.xml, I get this error:

BUILD FAILED
/home/ashwin/aprof/aprofplot/nbproject/build-impl.xml:923: The following error occurred while executing this line:
/home/ashwin/aprof/aprofplot/nbproject/build-impl.xml:263: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-7-openjdk-amd64/jre"

Total time: 2 seconds
ashwin@ashwin-VirtualBox:~/aprof/aprofplot$ javac --version
The program 'javac' can be found in the following packages:
 * default-jdk
 * ecj
 * gcj-4.8-jdk
 * openjdk-7-jdk
 * gcj-4.6-jdk
 * openjdk-6-jdk

I have openjdk installed too. What am I doing wrong? Do I have to install further packages?

Chad Nouis
  • 6,861
  • 1
  • 27
  • 28
chrisrhyno2003
  • 3,906
  • 8
  • 53
  • 102
  • See [How to install JDK on Ubuntu?](http://stackoverflow.com/questions/14788345/how-to-install-jdk-on-ubuntu-linux/14788468#14788468). In particular, the instructions about `export JAVA_HOME` are important. – Chad Nouis Oct 22 '15 at 14:04
  • the libraries are incorrectly linked I suppose. I used netbeans to run the application. It ran without any errors/build failures. – chrisrhyno2003 Oct 22 '15 at 15:00

1 Answers1

0

It seems, you have wrong JAVA_HOME variable. It points to JRE, from your output:

It is currently set to "/usr/lib/jvm/java-7-openjdk-amd64/jre"

Not JDK. That is why, Ant can't locate the javac and fails. You have to modify it. Try to delete jre at the end, seems, javac should be under /usr/lib/jvm/java-7-openjdk-amd64/bin. So you have to set it to/usr/lib/jvm/java-7-openjdk-amd64

Stanislav
  • 27,441
  • 9
  • 87
  • 82