evdubs / Harmonia

Margin funding bot for Bitfinex
20 stars 8 forks source link

Compile error: for-each loops are not supported in -source 1.3 #1

Closed Mikadily closed 10 years ago

Mikadily commented 10 years ago

Tried compiling on two different VPSs, and keep getting:

[ERROR] /root/Harmonia/src/main/java/name/evdubs/harmonia/Harmonia.java:[87,39] error: for-each loops are not supported in -source 1.3

Ubuntu 12.04 and 14.04, before I installed java7-sdk and maven packages. Anything I'm missing? Or do I need Oracle Java?

evdubs commented 10 years ago

The error makes it seem as if you're running a really old JVM. When you do the following at a terminal prompt, what do you get?

$ javac -version $ java -version

You may not need Oracle Java, but it sounds like you may need to update whatever version of Java it is you're using. I am using Oracle Java 7 installed from the default-jdk Ubuntu package, so you may want to give that a shot.

Mikadily commented 10 years ago

I've started a new DO Ubuntu 14.04 x64 instance, specifically to test Harmonia:

$ apt-get install default-jdk maven git -y $ git clone https://github.com/evdubs/Harmonia $ cd Harmonia/ $ mvn compile ... [ERROR] /root/Harmonia/src/main/java/name/evdubs/harmonia/Harmonia.java:[87,39] error: for-each loops are not supported in -source 1.3

java version "1.7.0_65" OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-3~14.04) OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

javac 1.7.0_65

evdubs commented 10 years ago

I just committed a patch to attempt to force Java 6 compilation. I suspect your version of Maven is old. Can you do the following?

$ mvn -version

After that, please git pull and try building again.

Mikadily commented 10 years ago

Great, now it worked.

$ mvn -version Apache Maven 3.0.4 Maven home: /usr/share/maven Java version: 1.7.0_65, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre Default locale: en_GB, platform encoding: UTF-8 OS name: "linux", version: "2.6.32-042stab092.3", arch: "amd64", family: "unix"

Thanks for your help!

evdubs commented 10 years ago

Oh, not old at all. Weird.

Anyway, glad it works for you now.