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.

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


Please Help Members By Posting Answers For Below Questions

What all access modifiers are allowed for top class ?

1138


Why is the singleton pattern considered to be an anti pattern?

837


What is the difference between yielding and sleeping?

1027


How do you override a method in java?

950


What is the difference between a method and a function in alice?

1090


What about main() method in java ?

970


What will happen if a thrown exception is not handled?

952


Explain reverse a linked list iterative solution in java?

879


What is anti pattern in java?

898


What are the approaches that you will follow for making a program very efficient?

1007


What is a modifier?

1427


What type of variable is error flag?

1017


What is scope & storage allocation of global and extern variables? Explain with an example

988


What is instance example?

899


What is a locale?

1093