java - Diamond shorthand syntax not working javac -


when compile this:

linkedblockingdeque<integer> q = new linkedblockingdeque<>(); 

in eclipse java ee kepler version, works fine, once try compile same program in in terminal

javac myprogram.java

in command line, receive "illegal start of type" error, on <>

i know diamond shorthand came java 7, why terminal use javac of java 6 , not 7? , how correct permanently? i'm on linux, mint 15.

running javac -version revealed this

~ $ javac -version     javac 1.6.0_27 

apparently have 2 separate versions of java installed. in eclipse, can specify location of jdk - set 1.7. in terminal, path variable contains (first) location of jdk 1.6. looks you're running linux/unix, try printing path variable:

$ echo $path 

you'll see in there path jdk 1.6; path jdk 1.7 may there after jdk 1.6 path. edit ~/.profile file , edit path accordingly - remove jdk 1.6 , add jdk 1.7.

if, on other hand, path jdk 1.6 set on system level (e.g. in /etc/profile), easiest thing add line ~/.profile file:

export path="/path/to/jdk1.7/bin:$path" 

after editing file, log out , log in.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -