How to run java code from another java program?

Haris

i have this code in file Abc.java and want to run it from another Java program. I tried but it is not taking user input.

public class Abc
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int s;
        System.out.println("Enter a value..");
        s = scan.nextInt();
        System.out.println(" "+s);
    }
}

which approach I can use to accomplish my task?

SMA

You could use something like:

public class Xyz {
    public static void main(String args[]) {
        Abc.main(args);
    }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Is there a way to run a java program from within another java program?

From Dev

CodeCompiler - Compile and Run Java Program from another Java Program

From Dev

How to open/run java program using cmd in another java program

From Dev

How to run a java from another file?

From Dev

How to run a normal Java Program from a Java Applet?

From Dev

How to run sed command from java code

From Dev

How to run Matlab from Java code

From Dev

how to run batch file from java code?

From Dev

How to run sed command from java code

From Dev

Run a Program After Another in One Java File

From Dev

How to run a java program by cmd

From Dev

how to run a java program in grails

From Dev

How to run java code

From Dev

How to run a batch file as administrator from a java program

From Java

How to run Java program from any arbitrary directory inside Terminal

From Dev

How to create and run Apache JMeter Test Scripts from a Java program?

From Dev

How to run infinte loop shell script from a java program

From Dev

how to run a bash program from windows in unix using java

From Dev

How to figure out what drive a Java program is being run from

From Dev

how can i run an other java program/class from an action?

From Dev

how to run java program on compute engine from windows 8

From Dev

How to run a batch file as administrator from a java program

From Dev

How to figure out what drive a Java program is being run from

From Dev

In Eclipse, how to run a java program as if it's the second argument in the command prompt while running another program as the first argument?

From Dev

How to pipe input from a Java program to another using Bourne Shell

From Dev

How Do I Compile/Run a java program from a Java Program (Input failure?)

From Dev

Running a java program located at any location from another java program

From Dev

How to get HTML code from a website in java program?

From Dev

QBasic: how to run a program from within another program?

Related Related

  1. 1

    Is there a way to run a java program from within another java program?

  2. 2

    CodeCompiler - Compile and Run Java Program from another Java Program

  3. 3

    How to open/run java program using cmd in another java program

  4. 4

    How to run a java from another file?

  5. 5

    How to run a normal Java Program from a Java Applet?

  6. 6

    How to run sed command from java code

  7. 7

    How to run Matlab from Java code

  8. 8

    how to run batch file from java code?

  9. 9

    How to run sed command from java code

  10. 10

    Run a Program After Another in One Java File

  11. 11

    How to run a java program by cmd

  12. 12

    how to run a java program in grails

  13. 13

    How to run java code

  14. 14

    How to run a batch file as administrator from a java program

  15. 15

    How to run Java program from any arbitrary directory inside Terminal

  16. 16

    How to create and run Apache JMeter Test Scripts from a Java program?

  17. 17

    How to run infinte loop shell script from a java program

  18. 18

    how to run a bash program from windows in unix using java

  19. 19

    How to figure out what drive a Java program is being run from

  20. 20

    how can i run an other java program/class from an action?

  21. 21

    how to run java program on compute engine from windows 8

  22. 22

    How to run a batch file as administrator from a java program

  23. 23

    How to figure out what drive a Java program is being run from

  24. 24

    In Eclipse, how to run a java program as if it's the second argument in the command prompt while running another program as the first argument?

  25. 25

    How to pipe input from a Java program to another using Bourne Shell

  26. 26

    How Do I Compile/Run a java program from a Java Program (Input failure?)

  27. 27

    Running a java program located at any location from another java program

  28. 28

    How to get HTML code from a website in java program?

  29. 29

    QBasic: how to run a program from within another program?

HotTag

Archive