I am trying to Build a JAR File of Interface Classes
I am using Linux and working throughout the terminal
I keep getting this error

Syntax error , type parameters are only available if source level is 1.5

I searched many sites and most solutions were about java on windows
to change properties

but how can I do that on linux ?
how can I solve this issue please ?

Edited by Alicito: n/a

5 Years
Discussion Span
Last Post by Alicito
Featured Replies
  • 1
    ~s.o.s~ 2,560   5 Years Ago

    My bad, I meant javac. What does [icode]javac -version[/icode] print? Also, does it work when you use [icode]javac -source 1.6 -target 1.6 compute/Compute.java compute/Task.java[/icode] ? Read More


We need more details. What is the command invoked to "build" the JAR file? Which version of Java do you have on the Linux box? This error normally comes up when you try to compile code containing generics using pre 1.5 source level.

Edited by ~s.o.s~: n/a


to build the jar file I'm invoking those commands :
javac compute/Compute.java compute/Task.java ( after invoking this the error appears because I used in the code the template <T> )
jar cvf compute.jar compute/*.class

the version .. when I run sudo update-alternatives --config java
it says : java-6-openjdk


My bad, I meant javac. What does javac -version print? Also, does it work when you use javac -source 1.6 -target 1.6 compute/Compute.java compute/Task.java ?

Edited by ~s.o.s~: n/a


thank you S.O.S
actually I invoked the following : javac compute/Compute.java compute/Task.java -source 1.5
and it worked

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.