views:

178

answers:

3

Hi,

I want my classpath to be set via a batch file. I'm working on Windows XP. I have two questions:
My first question:

I made a batch file in which I typed
"set classpath = C:\WINDOWS\system32\;.;C:\jdk1.5.0\lib\tools.jar;C:\poi-3.6\poi-3.6-20091214.jar;C:\poi-3.6\poi-contrib-3.6-20091214.jar;C:\poi-3.6\poi-ooxml-3.6-20091214.jar;C:\poi-3.6\poi-ooxml-schemas-3.6-20091214.jar;C:\poi-3.6\poi-scratchpad-3.6-20091214.jar;E:\jdbc\postgresql-8.2-505.jdbc3.jar;C:\xmlbeans-2.5.0\lib\jsr173_1.0_api.jar;C:\xmlbeans-2.5.0\lib\resolver.jar;C:\xmlbeans-2.5.0\lib\xbean.jar;C:\xmlbeans-2.5.0\lib\xbean_xpath.jar;C:\xmlbeans-2.5.0\lib\xmlbeans-qname.jar;C:\xmlbeans-2.5.0\lib\xmlpublic.jar;C:\dom4j-1.6.1\dom4j-1.6.1.jar;
exit"
When I tried to run this file it ran but when I went into control panel >system>advanced>environment variables and then selected classpath, it didn't show me the classpath I did set. What is the correct way to set the classpath via batch file?

My second question:

Is there any way by which we can install database via batch file say for eg: postgresql8.2?

Thank you.

+1  A: 

Setting the classpath from the command line affects only that batch process, it has no effect on the classpath that will be used for new processes. I don't know how to do what you're trying to do from the command line, but it likely involves mucking about in the registry.

skaffman
Thank you. But can u tell me something more about mucking into registry and how it is going to solve my problem?
Supereme
@Supereme: it's not going to solve your problem; most likely it will create more problems.
Michael Borgwardt
A: 

go to the control panel of windos environment variables set the class path there it self, it is the best way and easy way.

sam
A: 

The global classpath environment variable should not be set at all. It's an antiquated concept from the earliest days of Java that has unfortunately survived via outdated internet tutorials and textbooks.

The classpath should be set for each application individually, preferably via the command line when starting the application.

Michael Borgwardt