This is the mail archive of the cygwin@cygwin.com 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: HELP: java path and classpath question


Wally,

[ For those of us doing Java programming under Cygwin, this has become a 
FAQ and there are messages in the Cygwin mail archive that cover it. ]


Please give us more information about what happens. Specifically, what 
commands are you issuing. Tell us what program you're invoking (since your 
alias invokes the "java" command via the PATH, tell us what PATH is so we 
know which java command is being executed). Tell us what error message(s) 
result.


After I see through the confusing names that suggest that you're using the 
Gnu Java Compiler (which, as far as I know, is not yet available for 
Cygwin), it appears that at least part of your problem (quite possibly all 
of it) is that you're using POSIX-style class-path syntax when in fact 
you're invoking a Windows Java VM and hence must use a Windows-style 
class-path (semicolons separating the components and Windows-style full 
names, not Cygwin / POSIX -style). This applies both to the CLASSPATH 
environment variable and the various file name and class-path arguments to 
the JVM / JRE and Java compiler (all the Sun JDK and / or JRE executables, 
in fact).

If you're unaware of how to accommodate this, look into the "cygpath" 
command. It translates path names between POSIX and Windows formats. It can 
operate on an individual file name or PATH variable-like strings. There's 
no man page, use "cygpath --help".

For your own convenience, I suggest you write some wrapper scripts that 
obscure the need for Windows file name and path formats by transforming 
Cygwin-style arguments to their Windows equivalents for you. Otherwise your 
makefiles and other build scripts lose their portability to other POSIX 
environments. I use a generic script that I link (hard or symbolic) to a 
file with the same name as the target command. That way I achieve complete 
transparency and / or compatibility with native POSIX environments such as 
Solaris, Linux or *BSD and need only make a new link should a new tool be 
added to the Java SDK.

Randall Schulz
Mountain View, CA USA


At 10:45 2002-02-11, wally liau wrote:
>I am having a problem compiling generic java source file with following 
>settings:
>
>alias gjc='java -ms12m gjc.Main -bootclasspath
>$GJ_HOME/classes:/cygdrive/c/jdk1.3.1_01/jre/lib/rt.jar:/cygdrive/c/jdk1.3.1_01/jre/lib/i18n.jar'
>
>
>export JAVA_HOME=/cygdrive/c/jdk1.3.1_01
>export GJ_HOME=/cygdrive/c/Programs/gj
>
>The error messages show that cygwin can't find java class (eg, it can't 
>find String class). However, compiling stardard java code using "javac" 
>works fine. I guess there may be some problems with how to set up paths 
>and hope someone out there could help me to fix it. Thanks a lot.


--
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/


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