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

Explain about main thread in java?

1090


What is the purpose of interface?

1007


What is entry set in java?

1148


What is final, finally, finalize?

1113


How do you sort an array in java?

999


What is difference between call by value and call by reference?

999


What is a Presistent Object?

1240


Can classes declared using the abstract keyword cab be instantiated?

1050


What is object of class in java?

1127


Why string is called as immutable?

955


What is floating data type?

987


Explain java coding standards for constants?

1023


When should the method invokelater() be used?

1022


What is the difference between array and array list in java?

1235


What is the advantage of preparedstatement over statement?

1112