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 is the difference between class & structure?
difference between String a; and String a=new String();? y do v need to assign memory to the variable?
Hi Friends, can u give me Real Time example for interface and abstract class.(With Banking Example)
Write java code to print "Hello how are you" Thread1 should have "Hello" Thread2 should have "how are you" both the threads should start at the same time
How can an exception be thrown manually by a programmer?
what is the meaning of java.lang and java.util
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?
what is the volatile modifier for? : Java thread
What is the formula to calculate percentage?
What is a parameter used for?
What is meant by the value of a variable?
What is main string [] args?