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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.