Help with java development (Geany)

Questions about applications and software
Forum rules
Before you post please read this

Help with java development (Geany)

Postby godsotherhand on Sat Mar 24, 2012 10:07 am

So i am using Geany to learn Java, but when i
Code: Select all
for(int value:a)
         System.out.println(value);

(a is the vector that i want to see on my screen)
i get an error:
Code: Select all
Systax error, 'for each' statements are only available if source level is 1.5


What do i need to do? (using LMDE )
godsotherhand
Level 4
Level 4
 
Posts: 264
Joined: Tue Mar 22, 2011 12:43 pm

Linux Mint is funded by ads and donations.
 

Re: Help with java development (Geany)

Postby xenopeek on Sat Mar 24, 2012 1:47 pm

Not sure, but this message means the Java compiler, not Geany, wants you to configure you are programming in Java 5 or above (a.k.a. 1.5). With Java 5 having reached end-of-life back in 2009 IIRC, this seems a bit silly.

Which Java version are you using, and how have you configured Geany to run Java?

Java version:
Code: Select all
java -version

Are there alternative Java versions installed?
Code: Select all
update-alternatives --list java
Image
Linux Mint 14 Nadia / 64-bit / Cinnamon
User avatar
xenopeek
Level 20
Level 20
 
Posts: 10567
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Help with java development (Geany)

Postby DrHu on Sat Mar 24, 2012 1:55 pm

This might help if you are code checking
http://ideone.com/clone/SZtPa
--also it could be better to use an ide, which will offer more help code or examples; such as netbeans
http://netbeans.org/
    I understand that an ide is supposed to speed up development/coding, but by working only in the code language may utimately be more effective as you learn more directly about the language features
User avatar
DrHu
Level 15
Level 15
 
Posts: 5911
Joined: Wed Jun 17, 2009 8:20 pm

Re: Help with java development (Geany)

Postby godsotherhand on Sun Mar 25, 2012 2:51 am

Code: Select all

$ java -version
java version "1.5.0"
gij (GNU libgcj) version 4.6.1


Code: Select all

$ update-alternatives --list java
/usr/bin/gij-4.6
/usr/lib/jvm/java-6-sun/jre/bin/java


I only installed what I could find related to java from the software manager (all the tutorials I found online were made for Java on Windows, so i didnt really knew what to install here).

DrHu, what do u mean working only in the code language?
godsotherhand
Level 4
Level 4
 
Posts: 264
Joined: Tue Mar 22, 2011 12:43 pm

Re: Help with java development (Geany)

Postby xenopeek on Sun Mar 25, 2012 5:11 am

You may want to change the default Java to /usr/lib/jvm/java-6-sun/jre/bin/java. To do so, run:
Code: Select all
sudo update-alternatives --config java
Image
Linux Mint 14 Nadia / 64-bit / Cinnamon
User avatar
xenopeek
Level 20
Level 20
 
Posts: 10567
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands


Return to Software & Applications

Who is online

Users browsing this forum: Dis93 and 28 guests