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 / 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 |
What will happen if a thrown exception is not handled?
0 Answers ABB, Akamai Technologies, Infogain,
What is a null point?
What is the method overriding?
what is the difference between HashMap And HashTable?
What is the output of the below java program?
What are structs in java?
Can we declare a class as static?
Is ++ operator is thread safe in java?
Package1 and Package2 both have a method name lets say "methodA" with different implementation. When I import both the packages in a java class how can I use both the methods?
How we get some middle records in one table?
justify c is portable
What is re-factoring in software?