Q: Issue dynamically executing a .jar file from a PHP exec() statement in a Heroku app I have a project which is written in PHP. The project accepts a string from the user with a form and and then gives the string as input to a .jar file using exec(). The .jar file calculates the distance between different nodes on the tree and return the shortest path between two. All of the code works no problem when I run it on my MAMP server. I deployed it on Heroku and I the exec() command is not working. I have tried installing java dependancies and made a pom.xml file which doesn't work (I know for a fact that the problem is the exec() statement via process of elimination). What do I need to add to the pom.xml/PHP/project in general to make this work on heroku? Thanks, code is below.
pom.xml (i've been trying to use maven but don't understand it enough also ik its html its just to visualize it):


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>groupId</groupId>
    <artifactId>untitled</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>18</maven.compiler.source>
        <maven.compiler.target>18</maven.compiler.target>
    </properties>
    
  <build>
    <plugins>
      <plugin>
        <groupId>com.heroku.sdk</groupId>
        <artifactId>heroku-maven-plugin</artifactId>
        <version>3.0.3</version>
      </plugin>
    </plugins>
  </build>
</project>


my php:
    <ul class="tree" id="tree">
        <?php
        function createTree($input) {
            $dom_changes = "";
            $notBinary = 0;
            for ($i = 0; $i < count($input); $i++) {
                if ($input[$i] == "(") {
                    $dom_changes .= "<ul>";
                    $notBinary = 0;
                } else if ($input[$i] == ")") {
                    $dom_changes .= "</ul></li>";
                    $notBinary = 0;
                } else {
                    $notBinary++;
                    if ($notBinary > 2) {
                        echo "<p id='not_binary'>CAUTION, this is not a binary tree and the answer is most likely wrong, click to ignore</p>";
                    }
                    $dom_changes .= "<li><span>" . $input[$i] . " " . $input[++$i] . "</span>";
                }
            }
            echo "$dom_changes\n";
        }
        if (isset($_GET['input']) && $_GET['input'] != null) {
            $input = explode(" ", $_GET['input']);
            $_input_ = $input;
            for ($i = 0; $i < count($input); $i++) {
                $input[$i] = " \"" . $input[$i] . "\" ";
            }
            exec("java -jar pathfinder.jar " . implode($input), $result);
            if ($result != null) {
                createTree($_input_);
                ?>
    </ul>
    <p id="result">
        <?php
            echo "<br>" . $result[0] . "<br><br><br>";
            } else {
                echo "<br>invalid input, try making sure you have spaces between each number and character, <br> this allows the program to accommodate multi digit numbers";
            }
        } else {
            echo "Please enter an expression";
        }
        ?>
    </p>

any help would be appreciated let me know if you need any more info.
