Running java from the cmd
NickName:JonCode Ask DateTime:2015-11-25T05:46:14

Running java from the cmd

Trying to run a simple file called Test.java from the cmd. by javac Test.java it appears to run, but nothing is printed to the terminal?

public class Test {
    public static void main(String[] args) {    
            Integer a = 1000, b = 1000;  
            System.out.println(a == b);
            Integer c = 100, d = 100;  
            System.out.println(c == d); 
    }
}

Copyright Notice:Content Author:「JonCode」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/33904461/running-java-from-the-cmd

Answers
Abdelhak 2015-11-24T21:48:26

To compile and run your class Test.java you should do this.\n\njavac Test.java --to compile\n\n\nand\n\njava Test -- to run\n\n\nyou can take a look at this link",


byteherder 2015-11-24T21:51:16

The javac command in Java compiles a program from a command prompt.\n\njavac Test.java\n\n\nSince nothing is printed to the terminal, we will assume it did not have any errors.\n\nThe java command from a command prompt runs the program.\n\njava Test\n",


More about “Running java from the cmd” related questions

Running java from the cmd

Trying to run a simple file called Test.java from the cmd. by javac Test.java it appears to run, but nothing is printed to the terminal? public class Test { public static void main(String[] ar...

Show Detail

Running a batch from Java where the cmd prompt goes away

I was able to use an amalgamation of SO questions to get a line of code that would: Run a batch file from within a Java application Include an argument located in the same directory as the batch f...

Show Detail

Run multiple cmd commands from java

I want to run multiple cmd commands succesively from java code one after the other. I want to use this one command line application which creates ssh connection and I want to run multiple commands

Show Detail

Observe running time of a Java code in cmd prompt

I have a java class file in my hand and can simply able to run it from windows cmd to view the output. Only thing I need to observe the running time of this java program depending on different input

Show Detail

Java file Setting Debug points from CMD and running it using CMD

I have googled and searched on Stack Overflow on how to set Debug points for a JAVA file using cmd and running the same using cmd but haven't got much on this topic. Can someone share some

Show Detail

Running java application from cmd

I cannot open my Java App through CMD (Win 7) This is where the Class is : D:\Workspace\MessageQueingChat\src\model\Chat.java I tried : java -classpath D:\PBA Workspace\MessageQueingChat\src mo...

Show Detail

SQLite executing .import cmd from Java

I want to use the sqlite3 shell command .import to load a tab separated file into my database. Executing the command from shell is no problem! Writing a shell script including the command and r...

Show Detail

running application from cmd as administrator through java code

I executed the netsh command from the CMD that was manually opened by me by right clicking the CMD icon from the start and then selecting run as administrator from the options.It worked fine.Now I ...

Show Detail

Find out if Java program is running from CMD or not

I want to write a Java program that receives input through text (a console program). When this program starts up, straight away in the main method, I want to be able to check if the program was sta...

Show Detail

Java: Executing cmd commands when running java file in Eclipse?

Im doing some ssl socket programming in java, usually while running my program, I have to do it in cmd by executing the following commamd to tell it where the keystore is located: :java -Djavax....

Show Detail