Hi,
I have written a simple
java class which has a main method.
package org.rohit.useUtilities;
import com.rohit.utilities;
public class TestJars
{
public static void main(
String[] args)
{
float d = Divide.divide(9/2);
float m = Multiply.multiply(2*24);
float a = Add.add(5+2);
float s = Subtract.subtract(9-2);
System.out.println(d+" "+m+" "+a+" "+s);
}
}
I have written 4 classes in com.rohit.utilities package namely Divide,Multiply,Add and Subtract.
Below is the code for the Add class
package com.rohit.utilities;
public class Add
{
public static float add(float a, float b){
float ans = a+b;
return ans;
}
}
I am able to run the TestJars class.
Then i made a jar file of the 4 classes(utilities.jar) and provided -cp option in the java and javac commands to run TestJars class. I was able to do it.
Now i want to make a jar file for the whole application.
So, i made a jar file as -> jar -cvf myJavaApplication.jar org com
But when i run the jar file as --> java -jar myJavaApplication.jar
I get the following error,
no main manifest attribute in myJavaApplication.jar
Any help would be gladly appreciated.