> I know how in html files you can simply go:
>
> <param name="number" value="1">
For an applet? Yes.
> but how can you replicate this in a batch file?
For an applet? You can't (at least not easily).
For an application, you can provide arguments on the
command line when you invoke Java, like..
java TheMainClass arg1 arg2 arg3
For more information on the 'java' command, check the JavaDocs
<http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html#synopsis>
Once you can start your Java application from the command
line. You can put that command in a .bat file and it should
work just fine to launch your application with the arguments
at the end of the 'java' command.
HTH

Signature
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Come on boys, let's push it hard.."
P.J. Harvey 'Victory'
Thomas Hawtin - 27 Aug 2005 13:51 GMT
>>I know how in html files you can simply go:
>>
>><param name="number" value="1">
>>but how can you replicate this in a batch file?
> For an application, you can provide arguments on the
> command line when you invoke Java, like..
>
> java TheMainClass arg1 arg2 arg3
From a programmer point of view it tends to be easier to pass arguments
as properties. It's also a handy technique if you have lots of classes
with main methods and your IDE can set properties for all of them.
java -Dnumber=1 -jar MyApp
String number = System.getProperty("number");
In 1.0 and from 1.5 you can also read environment variables through
System.getenv.
#!/bin/bash
export MYAPP_NUMBER=1
java -jar MyApp
String number = System.getenv("MYAPP_NUMBER");
http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/java.html#options
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#getProperty(java.l
ang.String)
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#getenv(java.lang.String)
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
Andrew Thompson - 27 Aug 2005 14:12 GMT
> java -Dnumber=1 -jar MyApp
>
> String number = System.getProperty("number");
Good point Thomas. There are better ways to do what
the OP requires. And properties (for one) more closely
fits the requirements in being able to tie values to names.
I always consider it rather fragile to depend on a
certain parameter order using the 'args' (as I
demonstrated initially).

Signature
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"..When after all, it was you and me."
The Rolling Stones 'Sympathy For The Devil'
>but how can you replicate this in a batch file? Any help would be
>appreciated.
You can set parms in the environment or set system parms on the
command line.
See http://mindprod.com/jgloss/set.html
http://mindprod.com/jgloss/properties.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.