0

I have been given a .jar with the below structure to 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 am then able to use the following code in php to access the jar

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

However this currently outputs 'no main manifest attribute, in encryption.jar' how am I able to specify to use the encrypt and decrypt functions from php?

Chimeara
  • 695
  • 7
  • 27

1 Answers1

1

You can't call a non-main method from a JAR file. When you receive the message you're seeing, it means that the JAR hasn't been constructed properly as a main class must be declared. I would suggest creating a wrapper JAR as per this answer.

Community
  • 1
  • 1
Catchwa
  • 5,845
  • 4
  • 31
  • 57