Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #3240

Re: How to create a batch file for Java Console Application?

Date 2011-04-24 08:55 -0700
From Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com>
Newsgroups comp.lang.java.programmer
Subject Re: How to create a batch file for Java Console Application?
References <4e647693-974d-424a-b2c0-f12c6d519b93@22g2000prx.googlegroups.com> <8969fa6f-d569-4eae-adec-473edb8713a4@a9g2000prl.googlegroups.com> <dJadnd01CZeyVC7QnZ2dnUVZ_oudnZ2d@earthlink.com>
Message-ID <ob6dnZF-Ebd82inQnZ2dnUVZ_r6dnZ2d@posted.palinacquisition> (permalink)

Show all headers | View raw


On 4/23/11 11:54 PM, Patricia Shanahan wrote:
> On 4/23/2011 8:37 PM, buddy s wrote:
>> [...]
>> you need to first set your classpath in .bat file and then your need
>> to invoke your application using "java" command you can get more
>> information about classpath here
>> http://javarevisited.blogspot.com/2011/01/how-classpath-work-in-java.html
>
> Why do you consider setting the classpath variable preferable to using
> the java -cp parameter?

Can't answer for "buddy s", but I think -cp is clearly superior.

But if someone really wanted to set the CLASSPATH environment variable 
in a Windows .bat batch file, they can easily do so without affecting 
other Java programs as long as the batch file itself runs only the one 
Java program and either a) the batch file itself is run in a non-shared 
environment (e.g. by double-clicking a link to the batch file itself, 
which will create a new console window just for that batch file), or b) 
including the "setlocal" statement at the beginning of the batch file, 
so that any changes to the environment are not preserved once the batch 
file ends.

Pete

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

How to create a batch file for Java Console Application? Mozart <publicrelationschief@gmail.com> - 2011-04-23 12:34 -0700
  Re: How to create a batch file for Java Console Application? rossum <rossum48@coldmail.com> - 2011-04-23 23:37 +0100
  Re: How to create a batch file for Java Console Application? Lew <noone@lewscanon.com> - 2011-04-23 18:37 -0400
  Re: How to create a batch file for Java Console Application? Roedy Green <see_website@mindprod.com.invalid> - 2011-04-23 18:37 -0700
  Re: How to create a batch file for Java Console Application? buddy s <savingfunda@gmail.com> - 2011-04-23 20:37 -0700
    Re: How to create a batch file for Java Console Application? Patricia Shanahan <pats@acm.org> - 2011-04-23 23:54 -0700
      Re: How to create a batch file for Java Console Application? Roedy Green <see_website@mindprod.com.invalid> - 2011-04-24 01:53 -0700
        Re: How to create a batch file for Java Console Application? Patricia Shanahan <pats@acm.org> - 2011-04-24 07:00 -0700
      Re: How to create a batch file for Java Console Application? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-04-24 08:55 -0700

csiph-web