I am trying to generate the documentation of a project written in java 7.
I have used things of java 7 like the try with resource statement, and when I try to generate the documentation of my project:
javadoc -d mydocks truckingCompany
(truckingCompany is the directory containing all java files)
I get a lot of syntax errors.If I try to compile the project using javac 1.7 I don’t get all these errors.So I’m pretty sure that these errors are dued to the fact that javadoc is still using the version 1.6 of javac.How to change the version?
PS: An example of error is this:
home/ramy/Desktop/./truckingCompany/TCUtil.java:175: not a statement
catch( IOException | ClassNotFoundException | ClassCastException e)
^
All thing that are correct in Java 7.
Javadoc is not a standalone program, but a part of the java development kit (JDK) (it’s included in tools.jar.) This being said, you’ll need to update your runtime environment to be Java 7 instead of Java 6.
Since you’re running Linux, this should be as simple as pointing
/usr/bin/javato your JDK 7.java -versionshould return Java 7 (or similar) to indicate this is correct.