How can I execute a java function from php? -


i have been given .jar below structure use in php

public class encryption {     public static cryptio encrypt(string user, string password)     {         system.out.println(output);     }      public static cryptio decrypt(string data)     {         system.out.println(output);     } } 

i able use following code in php access jar

<?php echo exec("java -jar encryption.jar 2>&1", $output); ?> 

however outputs 'no main manifest attribute, in encryption.jar' how able specify use encrypt , decrypt functions php?

you can't call non-main method jar file. when receive message you're seeing, means jar hasn't been constructed properly main class must declared. suggest creating wrapper jar per this answer.


Comments