create batch file to run the java program in DOS prompt

Hi,I have one Java Program i want to run this program by creating the batch file on DOS prompt.Means if i run the batch file then the java program has to be run automatically..Can u please let me know how can i proceed
[246 byte] By [kagitalaa] at [2007-11-27 7:38:38]
# 1

create a new file called "go.bat" or something like that

edit this with notepad

put the statement below in the file:

java yourMainClassName (don't forget to put the package before the mainclassname if there is one)

save the file, put it at the root of your java project , and run it

calvino_inda at 2007-7-12 19:19:13 > top of Java-index,Java Essentials,Java Programming...
# 2
And make sure you don't forget the classpath flag.
CeciNEstPasUnProgrammeura at 2007-7-12 19:19:13 > top of Java-index,Java Essentials,Java Programming...
# 3

Thank u for ur quick reply

i created the batch as said and i place into the root of the project

i want to run this batch file in different system is it work.

with out have java file java class or exe file how can it works.

can ples give me brief idea

Is there anything to set path in batch file to run another system

kagitalaa at 2007-7-12 19:19:13 > top of Java-index,Java Essentials,Java Programming...
# 4
There is no such thing as a cross-system batch file.I think you don't quite understand what a batch file is. And may I interest you in a Google search about "executable jar files"?
CeciNEstPasUnProgrammeura at 2007-7-12 19:19:13 > top of Java-index,Java Essentials,Java Programming...
# 5
> I think you don't quite understand what a batch file> is. And may I interest you in a Google search about> "executable jar files"?<a href=" http://www.google.com/search?hl=en&q=Executable+Jar+Files&meta=">Yes, yes you may</a>
cotton.ma at 2007-7-12 19:19:13 > top of Java-index,Java Essentials,Java Programming...
# 6

on windows this is not possible yet. The bin directory of a JRE or JDK has to be added to the PATH manually because the Java installer refuses to do this. So your best bet is to keep your application as an executable jar.

> with out have java file java class or exe file how can it works

Huh? How can you run a java application without the class? You have no application!

gimbal2a at 2007-7-12 19:19:13 > top of Java-index,Java Essentials,Java Programming...
# 7

> on windows this is not possible yet. The bin

> directory of a JRE or JDK has to be added to the PATH

> manually because the Java installer refuses to do

> this. So your best bet is to keep your application as

and a good thing that is... Way too much problems are caused by installers "helpfully" adding things to the system path or worse, overwriting environment settings with their own, without asking.

Installers from Oracle come to mind...

jwentinga at 2007-7-12 19:19:13 > top of Java-index,Java Essentials,Java Programming...
# 8
i need help forwhen run the batch file i need to pass date parameter to batch file Meansi have batch file abc.batwhen i run the file : C:\abc 2006-08-01can any body please help me
kagitalaa at 2007-7-12 19:19:13 > top of Java-index,Java Essentials,Java Programming...
# 9
Grab a manual for your favorite operating system and read it!
CeciNEstPasUnProgrammeura at 2007-7-12 19:19:13 > top of Java-index,Java Essentials,Java Programming...
# 10
http://www.robvanderwoude.com/parameters.html
calvino_inda at 2007-7-12 19:19:13 > top of Java-index,Java Essentials,Java Programming...
# 11
Thank u very much it's working nowi got it
kagitalaa at 2007-7-12 19:19:13 > top of Java-index,Java Essentials,Java Programming...