1
votes

I am new to Codename One. As per the instructions, I have installed

  • Eclipse Oxygen (which is later version to Neon)
  • Installed Codename One Plug-in
  • Created first project "Hi There" and built. It runs ok with Simulator

However, when I try to create a build for Android, I get the below error:

Buildfile: C:/ews-launch-1/HiThere\build.xml

copy-android-override:

copy-libs:

jar: [echo] Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller [echo] code size and wider device support [copy] Copying 1 file to C:\ews-launch-1\HiThere\build\tmp [javac] C:\ews-launch-1\HiThere\build.xml:105: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

BUILD FAILED C:\ews-launch-1\HiThere\build.xml:105: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK. It is currently set to "C:\Program Files\Java\jre1.8.0_151"

Total time: 0 seconds

I have already set environment variable JAVA_HOME = C:\Program Files\Java\jdk1.8.0_151

Not sure, what else I need to do to fix my environment.

1

1 Answers

1
votes
Perhaps JAVA_HOME does not point to the JDK. 
It is currently set to "C:\Program Files\Java\jre1.8.0_151"

That's your problem. You have installed a JRE. You need to install a JDK.

I have already set environment variable JAVA_HOME = C:\Program Files\Java\jdk1.8.0_151

Well, that's not what the error message says you have done. Perhaps you need to read up on how environment variables work in Windows. Perhaps you are setting it in the wrong place? Perhaps you set it after starting Eclipse?


For what it is worth, plain Eclipse doesn't need a JDK because it uses its own Java compiler. But it looks like the Codename One plugin / Android require a JDK.