Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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.



I want to run a simple hello world java (HelloWorld.java) program using a batch file. How can i ru..

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

Post New Answer

More Core Java Interview Questions

What are access modifiers in Java ?

6 Answers  


What does += mean in java?

0 Answers  


can any one tell me when do u go for inheritance and polymorphism

3 Answers  


Is main an identifier?

0 Answers  


Is java programming easy?

0 Answers  


What variables are stored in stack?

0 Answers  


What is the Scope of Static Variable?

0 Answers   Verifone,


What is percentage in java?

0 Answers  


What’s the difference between unit, integration and functional testing?

0 Answers  


Can we extend a class with private constructor?

0 Answers  


Is it necessary for the port addresses to be unique? Explain with reason.

0 Answers   Aricent,


why the wait,notify,notifyall methods are placed in object class?these are the thread concepts why these methods are placed in Object class?

2 Answers   Global Logic, Satyam,


Categories