Cygwin and Java

I am new to Cygwin. What are the usual steps that are taken when installing the Java classpath and just to run programs in Cygwin?

+4
source share
5 answers

I suggest taking a look at catalina.sh . This shell script runs java in both unix and cygwin environments. OpenJDK is not currently part of the Cygwin installer, and people working with Java use the Sun build MS executable. This means that the paths must be converted to Windows, and when starting Java they will be the same as if they were run from a batch file.

, catalina.sh cygpath:

case "`uname`" in
CYGWIN*) cygwin=true;;
esac

if $cygwin; then
  JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
  JRE_HOME=`cygpath --absolute --windows "$JRE_HOME"`
  CATALINA_HOME=`cygpath --absolute --windows "$CATALINA_HOME"`
  CATALINA_BASE=`cygpath --absolute --windows "$CATALINA_BASE"`
  CATALINA_TMPDIR=`cygpath --absolute --windows "$CATALINA_TMPDIR"`
  CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --windows "$JSSE_HOME"`
  JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
fi
+5

, Cygwin Classpath "" Windows, , , Windows, Cygwin .

+1

, Windows Unix- ( Java, , Windows-, Cygwin- UNIX). Unix Windows Cygwin, cygpath util.

0

cmd cygwin. dos cygwin. tomcat, startup.bat

0

1) JDK

Java "Program Files" "Program Files (x86)": , , .

2)

env-, : - DOS ( cmd "RUN" ) - C: - "dir/x" DOS ( ~) "Program Files *"

3) Cygwin:

  • C:\cygwin\home\
  • open the .bash_profile file and add the following two lines (convenient to configure to match the actual JDK path)
export JAVA_HOME="/cygdrive/c/PROGRA~1/Java/jdk1.8.0_65"
export PATH="$JAVA_HOME/bin:$PATH"

Now from Cygwin launch

javac -version

to verify the success of the configuration.

0
source

Source: https://habr.com/ru/post/1727342/


All Articles