Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

arguments to jar

Hi,

i have a class like below

public class JarClass {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String arg1 = args[0];
		String arg2 = args[1];
		String result= arg1+arg2;
		System.out.println("result is"+result);
		
	}

}

Open in new window


i want to make a jar and pass arguments to it. How to pass arguments to jari may have other classes coming there
please advise
Avatar of gudii9
gudii9
Flag of United States of America image

ASKER

C:\Users\Work>java -jar TestJar.jar hi all
no main manifest attribute, in TestJar.jar

when i exported as jar in eclipise and gave above command getting above error. please advise
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

how to set in both places. please advise
I don't know  - i don't use that IDE
Avatar of gudii9

ASKER

while exporting need to select main class then worked