Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8281217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:57:13+00:00 2026-06-08T09:57:13+00:00

I have windows, using Cygwin, trying to set JAVA_HOME permanently through my .bashrc file.

  • 0

I have windows, using Cygwin, trying to set JAVA_HOME permanently through my .bashrc file.

.bashrc:

export PATH="$JAVA_HOME/bin:$PATH"  
export JAVA_HOME=$JAVA_HOME:"/cygdrive/c/Program Files (x86)/Java/jdk1.7.0_05"

.bash_profile:

if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

running cygwin:

-bash: $'\377\376if': command not found
-bash: $'then\r': command not found
: No such file or directorysu//.bashrc
-bash: /cygdrive/c/Users/jhsu//.bash_profile: line 3: syntax error near unexpected token `fi'
-bash: /cygdrive/c/Users/jhsu//.bash_profile: line 3: `fi'

I am not sure if I took the commands from a tutorial that was meant for another system or if I am missing a step. Or whitespace is causing my commands not to run properly.

I’ve looked at multiple similar questions but I haven’t found one where the question has my error exactly.


My home path:

$ echo $HOME
/cygdrive/c/Users/jhsu
$ echo ~
/cygdrive/c/Users/jhsu/

So I believe the files should be placed in the correct spot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:57:14+00:00Added an answer on June 8, 2026 at 9:57 am

    When all else fails in Cygwin…

    Try running the dos2unix command on the file in question.

    It might help when you see error messages like this:

    -bash: '\r': command not found

    Windows style newline characters can cause issues in Cygwin.

    The dos2unix command modifies newline characters so they are Unix / Cygwin compatible.

    CAUTION: the dos2unix command modifies files in place, so take precaution if necessary.

    If you need to keep the original file, you should back it up first.

    Note for Mac users: The dos2unix command does not exist on Mac OS X.

    Check out this answer for a variety of solutions using different tools.


    There is also a unix2dos command that does the reverse:

    It modifies Unix newline characters so they’re compatible with Windows tools.

    If you open a file with Notepad and all the lines run together, try unix2dos filename.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using windows server, I have a path to a file that, when you click
I'm trying to run genhtml using perl.exe from Cygwin in Windows. I have installed
I am using cygwin on Windows 7 . I have a directory with all
I am using cygwin to get unix environment on windows. I have some shell
I'm new to the NDK. (using Windows). I have downloaded cygwin and the NDK.
I'm using Windows XP, TortoiseGit (latest version) and Cygwin. I have git.exe installed and
I am trying to port a C++ program from Linux to Windows using cygwin.
I'm using Cygwin/Windows and I'm trying to build a native module for node.js. I
I am using cygwin on Windows 7 . I have a folder with about
noob here, I'm trying to transfer a file using rsync from windows to linux.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.