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 ?

Recommended Answers

All 4 Replies

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.

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 ?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.