ballerina-platform/ballerina-library

bal tool is not working when java is not installed

Closed this issue · 4 comments

Description:

Getting the following error when trying to execute the bal edi command.

Note : Java is not installed in this machine.

bal edi codegen -i resources/schema.json -o modules/orders/records.bal
Generating code for resources/schema.json...
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java

Observed the error in both 8.5 and 9.0 RC as well.

More details if needed.

image

We are able to reproduce this issue.

To give more context, edi-tool is designed such that the logic can be kept in a ballerina package. The tool runs the compiled jar when invoked. This is the reason for java dependency. To keep the design and remove the dependency, I am looking into if we can pack the bala and run that using Project APIs when the tool is invoked.

If the above solution does not work out, we are left with only following options,

  1. Report the java dependency in docs so the user does not come into the issue
  2. Migrate the logic from ballerina to java. This will be a huge effort.

For now I am proposing a workaround by having the user install ballerina instead of java.

ballerina-platform/edi-tools#45

This still needs to be evaluated at architecture level to see if there are different efficient solutions.

We have decided to go with using bal run instead of java -jar to execute the jar. This is a temporary measure till the CLI tool interface is revamped as mentioned in ballerina-platform/ballerina-lang#42729 (comment)

The PR will remove the java dependency. However, the fix requires that ballerina is installed in the machine. This will be fixed in U10 and will be tracked in #6575