• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

abt path, classpath, and system DSN

 
kirtesh jain
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi..
I am Developing a java Desktop Application so i want to set automatically "path" , "clas path" and "System DSN for my database" instead of doing manully....please any one help me out...
and sorry if i posting this common question at wrong place(java in General)...
thank you..
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your PATH should be set as an environment variable. If you install a JRE on some computers (eg Windows) I think (but I am not at all sure) that is added to the PATH, or a program associated with the .jar files.
You can set the requisite CLASSPATH in a manifest file; it is somewhere in the Java Tutorials.
Don't know about DNS, I am afraid.
 
Rob Spoor
Sheriff
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For System DSNs you will probably go into the Windows registry. You can use Google to find out which registry keys you need.
 
ramya narayanan
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to set it in a batch file?
Regards.
 
kirtesh jain
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok...
can we use autoexec.bat file to store path and class path
if yes then can you tell how...
thank you..
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
off to the intermediate forum
 
Rob Spoor
Sheriff
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've searched and found the registry part that contains the DSN information:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI

There is one sub key for all DSNs there. You can then export that part to see what to write to the registry.

For user DSNs it's the same registry key but then in HKEY_CURRENT_USER.
 
ramya narayanan
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody brief about how this can be done?
Whether we can set path, classpath in a bat file like this

I know these kind of setup can be very much useful , when we give an exe file to client(who doesnot know anything abt java or its installation)
But in this case, we need to send java jars also right.

Regards.
 
Ove Lindström
Ranch Hand
Posts: 326
Android Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. The PATH to the Java Runtime (JRE) bin catalogue should be set when installing it. At least it declares the system environment variable JAVA_HOME that can be used in your start script.

2. You should set the classpath for the application when you start the application and NOT in the system classpath. Use a launcher or a bat-file for this.

3. You should not use a system DNS (JDBC DBC type 1 DB driver) in your programs. Instead, you should take a look at DataSource and have a configuration file that holds the data on how to connect to the database and then have a declared DataSource that any part of your application that needs to access the database needs to access.
 
kirtesh jain
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for reply

Mr Prime,
can you tell me how can i find this key in the system Please...


HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI


and one more thing as mr. ramya narayanan suggested can be done like that...

Thank You
 
Rob Spoor
Sheriff
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the Windows Registry editor (also known as regedit.exe).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic