Executing jar inside php step by step explained

Executing jar inside php step by step explained

Java Program:

package in.javadomain;

public class Hello {

	public static void main(String[] args) {
		Hello h = new Hello();

	private static String helloName(String name){
		return "Hello "+name;



Hello Javadomain.in


Now Create the Jar like below using Eclipse,
Rightclick on the project in eclipse -> Export -> Runnable JAR file -> Choose the Project and Export location.
runnable jar - hello

Note: Do not forgot to choose the package required libraries into generated JAR under library handling.

Now Run the Above Created Jar in PHP:

<!--?php echo exec("java -jar hello.jar "); ?-->


[plain]Hello Javadomain.in[/plain]


Recommended Java Books:

Recommended PHP Books:

543 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.