简体   繁体   中英

Run and compile java code in cygwin

I just installed cygwin and I am wondering how do I compile and run my java code through cygwin ?

My java code is at my desktop saved in a file named Java.

Assuming you have Java SDK for Windows installed.

In the simplest case:

  1. Ensure/Add java to PATH in cygwin:

     export PATH=$PATH:"/cygdrive/C/Program\\ Files/Java/jdk1.8.0_31/bin/" 

    (don't forget the backslash after Program)

  2. cd to your desktop:

     cd /path/to/Desktop 
  3. run java compiler:

     javac HelloWorld.java 

In complex projects you will need to provide a bunch or arguments to javac to make it compile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM