通过批处理文件设置类路径并安装数据库
我希望通过批处理文件设置我的类路径。我正在使用Windows XP。 我有两个问题:
我的第一个问题:
我制作了一个批处理文件,其中 我输入了“设置类路径 = 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;
当我尝试运行这个文件时,它运行了,但是当我进入控制面板>系统>高级>环境变量然后选择类路径时,它没有显示我设置的类路径。通过批处理文件设置类路径的正确方法是什么?
退出”
我的第二个问题:
有什么方法可以通过批处理文件安装数据库,例如:postgresql8.2?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根本不应该设置全局类路径环境变量。这是 Java 早期的一个过时概念,不幸的是,它通过过时的互联网教程和教科书得以幸存。
应单独为每个应用程序设置类路径,最好通过 via启动应用程序时的命令行。
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.
从命令行设置类路径仅影响该批处理,它对将用于新进程的类路径没有影响。我不知道如何从命令行执行您想要执行的操作,但它可能涉及在注册表中进行操作。
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.
进入windos环境变量的控制面板自行设置类路径,这是最好的方法,也是最简单的方法。
go to the control panel of windos environment variables set the class path there it self, it is the best way and easy way.