java - How to convert this code into runnable jar file -
i want make jar file code in eclipse. have googled made exporting not running. helps?
import java.util.scanner; public class s { public static void main(string[] args) { scanner scan = new scanner(system.in); system.out.println("enter a: "); int = scan.nextint(); system.out.println("enter b: "); int b = scan.nextint(); int result = (a + b) / 2; system.out.println("(a+b)/2 is: " + result); } }
you should click file
, click export
, click java
, save runnable jar file
.
to run .jar
file, open cmd or terminal, make sure in right path ,
type java -jar <jar-file-name>.jar
note if cant run it, file path not correct
Comments
Post a Comment