This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Java


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
<http://x10.cvs.sf.net/x10/x10.common/examples/Constructs/Extern/Makefile?view=markup>,
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://cygwin.com/cgi-bin/cvsweb.cgi/wrappers/java/?cvsroot=cygwin-apps>
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]