Thread: setting classpaths in cygwin to use with java
hello all. in my cygwin.bat file, i set my PATH and CLASSPATH variables using the forward slash "/" since cygwin needs the "/" for interpreting the executables in the PATH variable. however, i'd like to set my CLASSPATH using back slashes "\" for java to be able to interpret correctly. i saw an old post about using "cygpath.exe -p -w $CLASSPATH" to return the $CLASSPATH using "\". however, how do i do this within my cygwin.bat file after setting my $CLASSPATH? i want to try to do something like: set CLASSPATH= $(cygwin.exe -p -w $CLASSPATH) * this obviously doesn't work, but i'm trying to find out what the correct equivalent is. thanks... -------------- TERRORIST ATTACK ON AMERICA (tues, sept 11, 2001) Information and Disaster Relief Resources http://www.konrad.ws/special/20010911_terroristAttackOnAmerica/infoAndDisasterReliefResources.htm
Konrad, On Sun, Oct 07, 2001 at 12:52:36AM +0900, Konrad Hernblad wrote: > i want to try to do something like: > > set CLASSPATH= $(cygwin.exe -p -w $CLASSPATH) > * this obviously doesn't work, but i'm trying to find out what the correct > equivalent is. IMO, the proper way to set personal environment variables (e.g., CLASSPATH), is to set them in your .bash_profile (or .bashrc). If you choose to following this suggestion, then remember to start bash with the "--login" option. Jason
Konrad, In the future, please keep your replies on-list to prevent dangling threads. On Mon, Oct 08, 2001 at 11:28:21PM +0900, Konrad Hernblad wrote: > although it didn't exactly solve my problem, it did prompt me to dig around > a little more. the problem was that i had mounted my c:\ as "/0" in my > cygwin/etc/profile file using the following command: > > mount -s -b c:/ /0 The above is a very strange mount command. Do you know how it got into your /etc/profile? > (etc/profile) I don't recommend adding personal environment setup to the system-wide /etc/profile -- use your .bash_profile instead. > CLASSPATH=/0/java/dev/myPrj Assuming that you are using Sun's Java (or some other Win32 JVM), then you must use Win32 and *not* Posix path: CLASSPATH=$(cygpath -w /0/java/dev/myPrj) > i tried changing my CLASSPATH env (in either file) to: > > CLASSPATH=\\java/dev/myPrj > > and when i tried running my program "Test" again (as above), it worked. I have no idea why the above works. > however, i still do not understand why a prefix of "/0" does not work if i > have mounted that prefix to point to "c:\"? The above should work if you use cygpath as described above. BTW, cygwin@cygwin.com is probably a more appropriate mailing list for these types of issues. Jason
export CLASSPATH=... > -----Original Message----- > From: pgsql-cygwin-owner@postgresql.org > [mailto:pgsql-cygwin-owner@postgresql.org]On Behalf Of Jason Tishler > Sent: Monday, October 08, 2001 9:07 PM > To: Konrad Hernblad > Cc: pgsql-cygwin@postgresql.org > Subject: Re: [CYGWIN] setting classpaths in cygwin to use with java > > > Konrad, > > On Sun, Oct 07, 2001 at 12:52:36AM +0900, Konrad Hernblad wrote: > > i want to try to do something like: > > > > set CLASSPATH= $(cygwin.exe -p -w $CLASSPATH) > > * this obviously doesn't work, but i'm trying to find out what > the correct > > equivalent is. > > IMO, the proper way to set personal environment variables (e.g., > CLASSPATH), is to set them in your .bash_profile (or .bashrc). If you > choose to following this suggestion, then remember to start bash with the > "--login" option. > > Jason > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >
At 07:02 01/10/09 -0400, Jason Tishler wrote: >Konrad, > >In the future, please keep your replies on-list to prevent dangling >threads. will do. sorry. >On Mon, Oct 08, 2001 at 11:28:21PM +0900, Konrad Hernblad wrote: > > although it didn't exactly solve my problem, it did prompt me to dig around > > a little more. the problem was that i had mounted my c:\ as "/0" in my > > cygwin/etc/profile file using the following command: > > > > mount -s -b c:/ /0 > >The above is a very strange mount command. Do you know how it got into >your /etc/profile? i put it there. probably should have gone in .bashprofile instead? i looked at the cygwin docs and it listed a similar command for mounting the c:\ to the posix prefix of your choice. http://sources.redhat.com/ml/cygwin/2001-09/msg00014.html > > (etc/profile) > >I don't recommend adding personal environment setup to the system-wide >/etc/profile -- use your .bash_profile instead. ok, thx. > > CLASSPATH=/0/java/dev/myPrj > >Assuming that you are using Sun's Java (or some other Win32 JVM), then >you must use Win32 and *not* Posix path: > > CLASSPATH=$(cygpath -w /0/java/dev/myPrj) this works (if i add the -p option also) at the cygwin prompt. for example, java -cp $(cygpath -p -w $CLASSPATH) JavaClass * where JavaClass is the name of a .class file. * also /0/java/dev/myPrj is defined in $CLASSPATH this works, but it is very inconvenient to type this long command at the prompt everytime one wants to run a java program. >BTW, cygwin@cygwin.com is probably a more appropriate mailing list for >these types of issues. how can one subscribe to this mailing list? thank you.
Konrad, On Tue, Oct 09, 2001 at 05:57:48PM +0900, Konrad Hernblad wrote: > At 07:02 01/10/09 -0400, Jason Tishler wrote: > > > mount -s -b c:/ /0 > > > >The above is a very strange mount command. Do you know how it got into > >your /etc/profile? > > i put it there. probably should have gone in .bashprofile instead? No. The mount command only needs to be executed once since it is persisted in the Windows registry. > >Assuming that you are using Sun's Java (or some other Win32 JVM), then > >you must use Win32 and *not* Posix path: > > > > CLASSPATH=$(cygpath -w /0/java/dev/myPrj) > > this works (if i add the -p option also) at the cygwin prompt. for example, Oops, I forgot the "-p" option. > java -cp $(cygpath -p -w $CLASSPATH) JavaClass > > * where JavaClass is the name of a .class file. > * also /0/java/dev/myPrj is defined in $CLASSPATH > > this works, but it is very inconvenient to type this long command at the > prompt everytime one wants to run a java program. There is no need. Just define (and export) CLASSPATH appropriately (i.e., using Win32 style paths) in your .bash_profile and you will be all set. > >BTW, cygwin@cygwin.com is probably a more appropriate mailing list for > >these types of issues. > > how can one subscribe to this mailing list? http://www.cygwin.com/lists.html Jason