Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set classpath in autoexec.bat?

Status
Not open for further replies.

piggy213

Programmer
Sep 27, 2002
19
TW
Hi,I am a new to java. Recently,I was in trouble with using JDBC Driver for SQL Server2000.
The problem is that I have downloaded SQL2000 JDBC Driver:mssqlserver.jar;msbase.jar;msutil.jar and I set it at C:\j2sdk1.4.0_02\lib. But I don't know how to set the classpath. Did it modify in autoexec.bat or just only set environment variables in system(in control plat)?Anybody kowns?

ps.1.My OS is WinXP
2.I have set environment variables in system--> PATH value:C:\j2sdk1.4.0_02\bin
3.My orginial autoexec.bat file was nothing.
Thank you!
 
Windows XP has an option in the Control Panel to let you set environment variables. You should be setting your environment variables there, not in autoexec.bat. As far as your jars go, you should probably put those in a seperate spot from the jdk, and then just point the CLASSPATH to them. You can set up the CLASSPATH just like you would set up the PATH.

-gc "I don't look busy because I did it right the first time."
 
Hi godcomplex,
Thanks for your suggestion. I tried to set up what you said. But it failed. Could you help me where the mistake is?
I set up two environment variables in the Control Panel :
variables value
CLASSPATH C:\j2sdk1.4.0_02\lib\mssqlserver.jar;C:\j2sdk1.4.0_02\lib\msbase.jar;C:\j2sdk1.4.0_02\lib\msutil.jar

PATH C:\j2sdk1.4.0_02\bin


It still show "Exception in thread "main" java.lang.NoClassDefFoundError:SQLTest" messages. In addition this time all programs couldn't work. If I just only set up the variable "PATH", it could work some program except the program SQLTest.java which wrote to test JDBC connection SQL Server.
Please help me!! Thank you very much!!

piggy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top