AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Batch file params

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
iblamemicrosoft@gmail.com
Guest





PostPosted: Sat Aug 27, 2005 11:40 am    Post subject: Batch file params Reply with quote



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? Any help would be
appreciated.

Back to top
Andrew Thompson
Guest





PostPosted: Sat Aug 27, 2005 12:01 pm    Post subject: Re: Batch file params Reply with quote



On 27 Aug 2005 04:40:52 -0700, [email]iblamemicrosoft (AT) gmail (DOT) com[/email] wrote:

Quote:
I know how in html files you can simply go:

param name="number" value="1"

For an applet? Yes.

Quote:
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

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Come on boys, let's push it hard.."
P.J. Harvey 'Victory'

Back to top
Andrew Thompson
Guest





PostPosted: Sat Aug 27, 2005 1:12 pm    Post subject: Re: Batch file params Reply with quote



On Sat, 27 Aug 2005 13:51:40 +0100, Thomas Hawtin wrote:

Quote:
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).

--
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'

Back to top
Roedy Green
Guest





PostPosted: Mon Aug 29, 2005 9:49 pm    Post subject: Re: Batch file params Reply with quote

On 27 Aug 2005 04:40:52 -0700, [email]iblamemicrosoft (AT) gmail (DOT) com[/email] wrote or
quoted :

Quote:
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
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.