aspose file tools*
The moose likes Java in General and the fly likes abt path, classpath, and system DSN Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "abt path, classpath, and system DSN" Watch "abt path, classpath, and system DSN" New topic
Author

abt path, classpath, and system DSN

kirtesh jain
Ranch Hand

Joined: Nov 15, 2008
Posts: 44
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

Joined: Oct 13, 2005
Posts: 39436
    
  28
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

Joined: Oct 27, 2005
Posts: 19722
    
  20

For System DSNs you will probably go into the Windows registry. You can use Google to find out which registry keys you need.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
Is it possible to set it in a batch file?
Regards.
kirtesh jain
Ranch Hand

Joined: Nov 15, 2008
Posts: 44
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

Joined: Oct 14, 2002
Posts: 8829
    
    5
off to the intermediate forum


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

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

Joined: Oct 06, 2008
Posts: 338
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

Joined: Mar 10, 2008
Posts: 326

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

Joined: Nov 15, 2008
Posts: 44
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

Joined: Oct 27, 2005
Posts: 19722
    
  20

Use the Windows Registry editor (also known as regedit.exe).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: abt path, classpath, and system DSN