Ant command - BUILD FAILED - again

_JAVA_OPTIONS is a flag specific to Windows. I'd recommend unsetting it personally because if it's not set to something sensible it seems to override other flags. I've often seen it set to specify a maximum of 1 GB of RAM for the Java process, which is not enough to build App Inventor.

Regarding your screenshots, it looks as if your path is set up to not include the path to the actual java and javac processes installed as part of OpenJDK. Instead, it points somewhere else (probably a built-in Windows program) that instead tries to launch an installer for the JRE. In git bash, you should be able to run which java to find out the full path to the Java executable that will be run. If it doesn't point to the java in OpenJDK, update your PATH configuration in System Environment Variables, restart git bash, and try again.

3 Likes

@ewpatton

now after doing some changes I got the javac version

Harish@SRIKAR MINGW64 /e/srikar/Funmora_Builder/appinventor (master)
$ Javac -version
javac 1.8.0_41

can you please explain what the difference between javac & java?
I installed OpenJDK .zip and connected it in my Environment Variables

under path variable

when I run java -version

Harish@SRIKAR MINGW64 /e/srikar/Funmora_Builder/appinventor (master)
$ java -version
bash: /e/srikar/MIT App Inventor 2/Apache Ant/apache-ant-1.10.11/bin/java: Permission denied

When I run ant

Harish@SRIKAR MINGW64 /e/srikar/Funmora_Builder/appinventor (master)
$ ant
We cannot run Java, please ensure you have Java installed.
  We have tried to execute /e/srikar/OpenJDK-8u41/java-se-8u41-ri/bin/bin/java but failed.
If you have installed Java in a unusual place you can set JAVA_HOME
to the directory containing the Java installation.

Defintion: The javac (as I've already stated somewhere before in this jumbled mess) is a subset of the JRE. It's an abbreviation for "java compiler."

Function(s): It takes your .java files, and turn them into bytecode, which the JVM (Java Virtual Machine/ "Java Executor") can execute.

The reason why the process is this complicated is that Java was made all the way back in 1995...

1 Like

JAVA_HOME should be set to the root of the java environment, not to the bin directory. Adjust your JAVA_HOME variable accordingly since the lookups are relative to the root, not bin.

3 Likes

it didn't work @ewpatton :sob:

My Environment Variables:

P.S: I removed the _JAVA_OPTIONS variable as it caused error with javac -version

Image of the error(javac -version)
Harish@SRIKAR MINGW64 ~
$ javac -version
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
Picked up _JAVA_OPTIONS: -Xmx2048M

The path section


The Error :warning: :radioactive: :x:

When tried with command prompt

When tried with Git Bash




Hope anyone fixes this soon, @MohamedTamer & @ewpatton :pleading_face:




I suggest running the following command:

As @ewpatton stated, to find out the path of the program which the java command is currently executing.

2 Likes

See mine

2 Likes

@MohamedTamer & @dora_paz
Actually I was first using the Java 8 update 301 but then as @vknow360 stated here :point_down:

and even my friend @Sashibhusan_Sahoo said I installed this .zip :point_down:
https://download.java.net/openjdk/jdk8u41/ri/openjdk-8u41-b04-windows-i586-14_jan_2020.zip

So I installed it and deleted my old one with the .exe file.

So that is why I don't have a path linked to Program Files, I used to do in that method when I installed with the .exe file @dora_paz.

Thanks for your help @dora_paz
but the result is the same,

Result Image

a silly doubt

I think I should try restarting my pc :rofl:

Downloading the java binaries and adding their path to the environment variables instead of using an installer to install it should work if configured correctly.
What about the result of this command?

2 Likes

Do you mean that I should install with the .exe?

I will try it

Not actually, you should achieve the same result from both ways.

2 Likes

@MohamedTamer

The result was :point_down:

P.S: Should I install the Java SE Development Kit and even the Java JDK 8 update 301?

Before meshing more your system did you run which java as suggested ?

3 Likes

no
Now I did :point_down:

Harish@SRIKAR MINGW64 ~
$ which java
/e/srikar/MIT App Inventor 2/Apache Ant/apache-ant-1.10.11/bin/java

I think I should:

  • Uninstall Apache Ant
  • Uninstall Java files
  • install Apache Ant and set the environment variables again(if needed)
  • install Java JDK 8 Update 301 add new the environment variables

Hope this is correct? :+1: :slight_smile:

Your system is picking an incorrect java path. You might want to check you have specified an existing and valid paths to the JAVA_HOME and PATH variables for java.

3 Likes

My JAVA_HOME path


So, is it the correct path?

If this is your java installation directory then yes

2 Likes

Yes, this is the exact dir in which I downloaded my OpenJDK