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

enter image description here


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -