I want to run a simple hello world java (HelloWorld.java)
program using a batch file. How can i run it and how to
construct a batch file.
Answer Posted / abdul hannan
Make a source file suppose Hello.java at particular location
C:\javasrc
class Hello {
public static void main(String args[]) {
System.out.println("Hello World");
}
}
open a notepad and write the below command
cd C:\javasrc
javac Hello.java
java Hello > ab.log
Save this file with extension .bat (e.g "run.bat")
double click on run.bat file to run the Hello.java file. You
can see the output in ab.log file on the same path.
if you want to run bat file on command prompt, just remove
the log file(> ab.log) from the batch file and type run. You
can see the output on command prompt.
| Is This Answer Correct ? | 19 Yes | 3 No |
Post New Answer View All Answers
Write an algorithm program in java for the following question.. 1) S is a set of integers.X is an integer obtained by sum of two digits in S. Write logic for whether or not the X is from the S. The time of algorithm should not exceed o(n logn).
Explain about core java?
How to compare two strings in java program?
What is the collections api in java programming?
What is the r character?
which pattern is default in scanner package?
a thread is runnable, how does that work? : Java thread
What isan abstract class and when do you use it?
Can a class have multiple constructors?
How to call one constructor from the other constructor ?
How to pass arraylist to stored procedure in java?
What is a bufferedreader?
What is super constructor?
What is difference between == and === in js?
What is thread safe singleton?