RE: javac on cygwin
On Mon, Jan 13, 2003 at 11:26:28AM -0800, Shankar Unni wrote: Christopher Faylor wrote: I remember speculating at one point about creating wrappers to the win32 functions like CreateFile, MoveFile, etc. which would understand cygwin paths. You could theoretically modify an .exe to load cygwin1.dll and use the wrapper functions. Or you could use some of Windows hook facilities to do that. Hmm. Would that even work? This is a project I might work on when I have the time. Chris -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: javac on cygwin
On Wed, Jan 15, 2003 at 09:07:42AM -, Chris January wrote: On Mon, Jan 13, 2003 at 11:26:28AM -0800, Shankar Unni wrote: Christopher Faylor wrote: I remember speculating at one point about creating wrappers to the win32 functions like CreateFile, MoveFile, etc. which would understand cygwin paths. You could theoretically modify an .exe to load cygwin1.dll and use the wrapper functions. Or you could use some of Windows hook facilities to do that. Hmm. Would that even work? This is a project I might work on when I have the time. Cool! Thanks, Chris! I can't think of anyone better to work on this. If you (Chris) want to send private email to discuss, feel free. Or, better yet, discussion on cygwin-developers would probably tap even more experience. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: javac on cygwin
Christopher Faylor wrote: Hmm. Would that even work? Yes. Hmm again. It'll be interesting to see this in action.. -- Shankar. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: javac on cygwin
Christopher Faylor wrote: I remember speculating at one point about creating wrappers to the win32 functions like CreateFile, MoveFile, etc. which would understand cygwin paths. You could theoretically modify an .exe to load cygwin1.dll and use the wrapper functions. Or you could use some of Windows hook facilities to do that. Hmm. Would that even work? I remember trying, way back when, to provide a checking malloc library on Windows, and then discovering that there was *no* way of intercepting malloc() calls *inside LIBC itself*. In the Windows PE world (unlike the ELF world), a call to a routine that lives inside the same DLL is automatically bound to the local copy without any way to hijack the call. Thus there's no way to play games with LD_LIBRARY_PATH (or PATH, rather) to load a malloc that'll hijack all calls successfully. And there's definitely nothing like the LD_PRELOAD mechanism to wrap existing pre-linked programs to inject support libraries into the lib list. So any CreateFile calls inside the windows libraries would always go to the built-in CreateFile. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: javac on cygwin
On Mon, Jan 13, 2003 at 11:26:28AM -0800, Shankar Unni wrote: Christopher Faylor wrote: I remember speculating at one point about creating wrappers to the win32 functions like CreateFile, MoveFile, etc. which would understand cygwin paths. You could theoretically modify an .exe to load cygwin1.dll and use the wrapper functions. Or you could use some of Windows hook facilities to do that. Hmm. Would that even work? Yes. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: javac on cygwin
Kevin, Someone asked on news:comp.lang.java.softwaretools about makefiles for Java. Another person replied with a pointer to this site: http://geosoft.no/javamake.html, which appears to have a good makefile for Java. It should be usable as-is or easily be modified to work under Cygwin. I haven't tried it, but I remembered your query and thought you might like to check it out. Randall Schulz At 03:52 2003-01-04, Kevin Cheng wrote: Ok, I've searched for articles on getting a java compiler working on cygwin. I got very vague info. Can someone please give me the newbie quick setup on setting up a java compiler to work on cygwin. I've got the java JDK 1.4.1 from java.sun.com. Now what do I do? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: javac on cygwin
David, Thanks for considering this. The only real way to identify major (and minor) issues, however, is testing, so, hopefully, people will use these scripts. Once they are deemed reasonably robust, it might even be worth it to release a java wrapper package for Cygwin... Actually, the custom java.io.File wrapper is very useful in that it's orthogonal to the purpose of my scripts and takes care of one of the caveats (namely, the filenames passed to Java programs). It might be a good idea to post that code along with the scripts (there must be some tricks one can play with the CLASSPATH to transparently substitute the real java.io.File with the wrapper, so the programs don't have to change). Igor On Mon, 6 Jan 2003, David P. Caldwell wrote: Igor: I'm going through a big site reorganization right now (the code, not the material), but I do intend to get your scripts up on my site (probably in the FAQ). I glanced at them and didn't identify any major issues with them. I don't have much of a need for them for a few reasons: (1) I use a wrapper class for java.io.File in my own programs which recognizes Cygwin-style paths, (2) I don't develop on UNIX, so don't have much need for portable build scripts, (3) For most of my own projects, I use a stupid little build tool I wrote myself (which is similar to Ant), and for customer projects, I have used Ant itself. Thanks for the contribution, though ... getting those scripts out there will only help other people and/or make them better. -- David. -Original Message- From: Igor Pechtchanski [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 04, 2003 4:55 PM To: David P. Caldwell; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: javac on cygwin On Sat, 4 Jan 2003, David P. Caldwell wrote: Kevin: Ok, I've searched for articles on getting a java compiler working on cygwin. I got very vague info. I've got the java JDK 1.4.1 from java.sun.com. Now what do I do? Not sure what your background is, so I'm not sure how to answer. Right now, you could be someone who doesn't know Java, someone who doesn't know Cygwin, someone who doesn't know UNIX ... so without sitting down and writing a script that would satisfy all three audiences (a combined Java/Cygwin/UNIX tutorial), I can't really answer your question. You might want to check out http://www.inonit.com/cygwin/ Perhaps you can let us know specifically what you've tried and what happened so that we can assess your situation more accurately. -- David. For what it's worth, I use the attached scripts as wrappers for java, jar, javadoc and javac (the javac one is not extensively tested as I use a Cygwin-compiled jikes for java compilation). The only caveat is that filenames passed as parameters to Java programs and custom doclet options in javadoc are not converted. You will need to change the *_EXEC values close to the beginning of the scripts to conform to your system (I have IBM JDK 1.3). Hope this helps. David, feel free to post them on the web page if needed. I'd also appreciate any comments or bug reports. Thanks. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_[EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk! -- /usr/games/fortune -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: javac on cygwin
Igor: Actually, the custom java.io.File wrapper is very useful in that it's orthogonal to the purpose of my scripts and takes care of one of the caveats (namely, the filenames passed to Java programs). Actually, the way it works now, the programs I write have to be Cygwin-aware (I don't have a java.io.File substitute -- I have an inonit.cygwin.File class which can represent a Windows or UNIX-style path). However, as you mention, it's at least occurred to me that the entire java.io.File class could be re-implemented with Cygwin-aware functionality and then could be used in preference to the java.io.File class by putting it in front of rt.jar in the -bootclasspath (at least on JDK 1.2 and later). One would probably also have to change FileInputStream and other classes -- I haven't looked into it extensively. -- David. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: javac on cygwin
Igor: I'm going through a big site reorganization right now (the code, not the material), but I do intend to get your scripts up on my site (probably in the FAQ). I glanced at them and didn't identify any major issues with them. I don't have much of a need for them for a few reasons: (1) I use a wrapper class for java.io.File in my own programs which recognizes Cygwin-style paths, (2) I don't develop on UNIX, so don't have much need for portable build scripts, (3) For most of my own projects, I use a stupid little build tool I wrote myself (which is similar to Ant), and for customer projects, I have used Ant itself. Thanks for the contribution, though ... getting those scripts out there will only help other people and/or make them better. -- David. -Original Message- From: Igor Pechtchanski [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 04, 2003 4:55 PM To: David P. Caldwell; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: javac on cygwin On Sat, 4 Jan 2003, David P. Caldwell wrote: Kevin: Ok, I've searched for articles on getting a java compiler working on cygwin. I got very vague info. I've got the java JDK 1.4.1 from java.sun.com. Now what do I do? Not sure what your background is, so I'm not sure how to answer. Right now, you could be someone who doesn't know Java, someone who doesn't know Cygwin, someone who doesn't know UNIX ... so without sitting down and writing a script that would satisfy all three audiences (a combined Java/Cygwin/UNIX tutorial), I can't really answer your question. You might want to check out http://www.inonit.com/cygwin/ Perhaps you can let us know specifically what you've tried and what happened so that we can assess your situation more accurately. -- David. For what it's worth, I use the attached scripts as wrappers for java, jar, javadoc and javac (the javac one is not extensively tested as I use a Cygwin-compiled jikes for java compilation). The only caveat is that filenames passed as parameters to Java programs and custom doclet options in javadoc are not converted. You will need to change the *_EXEC values close to the beginning of the scripts to conform to your system (I have IBM JDK 1.3). Hope this helps. David, feel free to post them on the web page if needed. I'd also appreciate any comments or bug reports. Thanks. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_[EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk! -- /usr/games/fortune -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: javac on cygwin
Kevin: Ok, I've searched for articles on getting a java compiler working on cygwin. I got very vague info. I've got the java JDK 1.4.1 from java.sun.com. Now what do I do? Not sure what your background is, so I'm not sure how to answer. Right now, you could be someone who doesn't know Java, someone who doesn't know Cygwin, someone who doesn't know UNIX ... so without sitting down and writing a script that would satisfy all three audiences (a combined Java/Cygwin/UNIX tutorial), I can't really answer your question. You might want to check out http://www.inonit.com/cygwin/ Perhaps you can let us know specifically what you've tried and what happened so that we can assess your situation more accurately. -- David. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: javac on cygwin
Kevin, Javac is not particularly special. It is a Windows-native program, and as such requires absolute file and directory names be provided in Windows format (forward slashes are OK, but drive letters are required and the Cygwin notion of root is completely unknown to such programs). PATH-like variables (specifically CLASSPATH) must be in Windows format (semicolon separators). Both of these conversions is handled by the cygpath utility. Learn about it. I strongly suggest that if your development environment, either individually or as a group, is or is at all likely to become cross-platform (betwen Windows and any kind of Unix), that you adopt a Unix-centered set of build scripts and then create cover scripts that encapsulate the operations that bridge the gap between the POSIX / Unix world of Cygwin and the underlying native Sun Java SDK tools. Do so in a way that allows those translations to be easily switched off, replaced or made null when not needed (when you're working on an actual Unix system). I do lots of Java under Windows with Cygwin and have for quite a while. Feel free to come back with further questions. Randall Schulz At 03:52 2003-01-04, Kevin Cheng wrote: Ok, I've searched for articles on getting a java compiler working on cygwin. I got very vague info. Can someone please give me the newbie quick setup on setting up a java compiler to work on cygwin. I've got the java JDK 1.4.1 from java.sun.com. Now what do I do? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: javac on cygwin
) arg=$arg' '$1' '$2 shift shift ;; -charset | \ -docencoding) arg=$arg' '$1 shift ;; esac ARGS=$ARGS '$arg' done eval set -- $ARGS exec $JAVADOC_EXEC $@ #!/bin/bash # # A wrapper for calling Javac from Cygwin # Author: Igor Pechtchanski [EMAIL PROTECTED] # ME=`basename $0` JAVAC_EXEC=/cygdrive/c/Program Files/IBM/Java13/bin/javac.exe ARGS= while [ -n $1 ]; do arg=$1 shift case $arg in -classpath | \ -sourcepath | \ -bootclasspath | \ -extdirs | \ -d) arg=$arg' '`cygpath -p -w $1` shift ;; esac ARGS=$ARGS '$arg' done eval set -- $ARGS exec $JAVAC_EXEC $@ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: javac on cygwin
Randall R Schulz wrote: Javac is not particularly special. It is a Windows-native program, and as such requires absolute file and directory names be provided in Windows format (forward slashes are OK, but drive letters are required and the Cygwin notion of root is completely unknown to such programs). Javac is a pure java program. The windows executable is only there as a thin native wrapper that launches sun.tools.javac.Main. The bigger problem is that Sun JRE is compiled to the native Win32 API, not to cygwin, so *any* Java programs running in the Sun JRE will never understand cygwin mount points. In theory, someone could invest in the effort to port, say, the Linux port of the Sun JRE to cygwin, but it would be a huge effort. Igor's idea (wrappers that run cygpath -m on the paths being passed to Java) would be the best approach in this situation, especially for well-known Java programs like javac. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: javac on cygwin
Shankar, At 14:17 2003-01-04, Shankar Unni wrote: Randall R Schulz wrote: Javac is not particularly special. It is a Windows-native program, and as such requires absolute file and directory names be provided in Windows format (forward slashes are OK, but drive letters are required and the Cygwin notion of root is completely unknown to such programs). Javac is a pure java program. The windows executable is only there as a thin native wrapper that launches sun.tools.javac.Main. That may be true, but it's irrelevant. Its external interface via its command line options follows the Windows conventions. That's all that matters. It is a Windows executable for all intents and purposes. The bigger problem is that Sun JRE is compiled to the native Win32 API, not to cygwin, so *any* Java programs running in the Sun JRE will never understand cygwin mount points. Yes, of course. That's hardly surprising. In theory, someone could invest in the effort to port, say, the Linux port of the Sun JRE to cygwin, but it would be a huge effort. Igor's idea (wrappers that run cygpath -m on the paths being passed to Java) would be the best approach in this situation, especially for well-known Java programs like javac. That's what I do. I have a generic one that converts anything that looks like a file name via cygpath. It's not fool-proof, but the criteria for converting names could be refined. The alternative is a target-specific script that understands what all the arguments options and option arguments are and converts them as needed. Randall Schulz -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: javac on cygwin
On Sat, Jan 04, 2003 at 04:20:36PM -0800, Randall R Schulz wrote: At 14:17 2003-01-04, Shankar Unni wrote: Randall R Schulz wrote: Javac is not particularly special. It is a Windows-native program, and as such requires absolute file and directory names be provided in Windows format (forward slashes are OK, but drive letters are required and the Cygwin notion of root is completely unknown to such programs). Javac is a pure java program. The windows executable is only there as a thin native wrapper that launches sun.tools.javac.Main. That may be true, but it's irrelevant. Its external interface via its command line options follows the Windows conventions. That's all that matters. It is a Windows executable for all intents and purposes. The bigger problem is that Sun JRE is compiled to the native Win32 API, not to cygwin, so *any* Java programs running in the Sun JRE will never understand cygwin mount points. Yes, of course. That's hardly surprising. In theory, someone could invest in the effort to port, say, the Linux port of the Sun JRE to cygwin, but it would be a huge effort. Igor's idea (wrappers that run cygpath -m on the paths being passed to Java) would be the best approach in this situation, especially for well-known Java programs like javac. That's what I do. I have a generic one that converts anything that looks like a file name via cygpath. It's not fool-proof, but the criteria for converting names could be refined. The alternative is a target-specific script that understands what all the arguments options and option arguments are and converts them as needed. I remember speculating at one point about creating wrappers to the win32 functions like CreateFile, MoveFile, etc. which would understand cygwin paths. You could theoretically modify an .exe to load cygwin1.dll and use the wrapper functions. Or you could use some of Windows hook facilities to do that. I don't think my idea met with much enthusiasm when I mentioned it, but I always thought it would be an interesting exercise. It wouldn't help for programs which actually do parsing on input file specs outside of the standard Windows API, though. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/