Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

cmd java compile

javac MyFisrtProgam.java // enter to compile 
  java MyfirstProgram // run program 
Comment

java run cmd


import java.io.*;

public class CmdTest {
    public static void main(String[] args) throws Exception {
        ProcessBuilder builder = new ProcessBuilder(
            "cmd.exe", "/c", "cd "C:Program FilesMicrosoft SQL Server" && dir");
        builder.redirectErrorStream(true);
        Process p = builder.start();
        BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String line;
        while (true) {
            line = r.readLine();
            if (line == null) { break; }
            System.out.println(line);
        }
    }
}

Comment

run java application in commande line

java -jar target/spring-cloud-gateway-keycloak-oauth2-0.0.1-SNAPSHOT.jar

java -jar target/product-service-0.0.1-SNAPSHOT.jar
Comment

java run cmd command

fun excCommand(cmd: String) {
  val rt = Runtime.getRuntime()
  try {
	 rt.exec(arrayOf("cmd.exe", "/c", cmd))
  } catch (e: IOException) {
	 // TODO Auto-generated catch block
	 e.printStackTrace()
  }
}
Comment

run java in cmd


C:UsersYour Name>javac MyClass.java
Comment

PREVIOUS NEXT
Code Example
Java :: gradle could not determine java versionAdd Answer 
Java :: java wait(timeout) 
Java :: initialiser une arraylist 
Java :: how to find the prime numbers in java 
Java :: java formatted output 
Java :: dot operator java 
Java :: camera permission in android 
Java :: programmatically click button javafx 
Java :: longest common subsequence of two strings 
Java :: generic list java 
Java :: java get attributes from class 
Java :: inheritance in oop 
Java :: one line if statement java 
Java :: java inheritance 
Java :: java hashcode 
Java :: java find if element of list in present in another list 
Java :: display two dimension array java 
Java :: use regex in if statement java 
Java :: set layout params in dp value 
Java :: read stream java 
Java :: hash table implementation java 
Java :: how to check if user is logged in firebase android and then load another activity 
Java :: get list data in java 
Java :: How to check if a string is in alphabetical order in java 
Java :: what is var in java 
Java :: Looping Through Array Elements Java 
Java :: count the number of occurrences of a character in a string java 
Java :: sound file java 
Java :: set jcombobox index java 
Java :: static class java 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =