X-Spam-Check-By: sourceware.org Date: Mon, 11 Jun 2007 18:17:41 -0400 (EDT) From: Igor Peshansky Reply-To: cygwin AT cygwin DOT com To: "Brian D. McGrew" cc: cygwin AT cygwin DOT com Subject: Re: Java In-Reply-To: <14CFC56C96D8554AA0B8969DB825FEA002C996AA@chicken.machinevisionproducts.com> Message-ID: References: <14CFC56C96D8554AA0B8969DB825FEA002C996AA AT chicken DOT machinevisionproducts DOT com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Mon, 11 Jun 2007, Brian D. McGrew wrote: > Good morning all, > > I'm brand new to cygwin but a veteran Unix engineer so I do know my way > around... I've successful compiled all of my C/C++ code in cygwin and > it's all running good now. However, I need java. There is a higher > level user interface that goes on top of our C/C++/X/Motif stuff that's > all done in Java. > > On Solaris and Linux I've got /usr/java and we rely on jdk's and jre's > from version 1.4.1 to 1.6. Of course with Solaris and Linux I just > download the platform version I'm using and I'm done. Is there such a > creature for cygwin? Can I get a Sun /usr/java package running under > cygwin? Cygwin can run Win32 programs. Thus, the regular Win32 JDK will work from Cygwin. However, it will not understand Cygwin paths, etc. That can be somewhat alleviated by using my Java wrapper scripts[*], but they will not (cannot) work in all cases (e.g., when the filename is read from a stream, or passed in a compound command-line argument). As for JNI, unless you want to deal with Cygwin DLL initialization issues (possible, but not trivial), your best bet would be to build your DLLs using "gcc -mno-cygwin". One final bit of advice is regarding the Windows linker and name mangling. First, if you don't provide a dll_entry() method, Windows will default to some weird behavior in a DLL (IIRC, things won't be initialized properly). Second, different JDKs use different JNI name mangling schemes for nested classes (yes, I know it's technically a bug, but the language spec leaves it unspecified). The latter will not affect you if you stick to one JDK and use its "javah". To see how we got around these problems, see , which will build a DLL that is loadable by all JDKs I've tested (IBM and Sun, at least) without having to recompile (it assumes that all JNI methods are prefixed with "Java_" -- a convention we had to adopt to enable this technique). HTH, Igor [*] -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!) |,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! Freedom is just another word for "nothing left to lose"... -- Janis Joplin -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/