Beware of gedit

I love using gedit to make changes to config files in Linux. However, I have recently encountered some odd issues where config files that I edit using gedit just don’t work properly. However, making the exact same changes with vi or vim does not have any issues.

Looking at both files (one edited with gedit, the other with vim), they look exactly the same…so I thought. Apparently, gedit likes to add a \r (carriage return) to the end of some lines. This is a hidden character, so if you open the file with gedit, or vi/vim, you won’t see it. However, this hidden character can cause a very nasty side effect to your config files in that some applications will not properly parse the file. As a result, your application (or OS) will not work (talk about a great way to perform a nasty DoS attack).

This is the type of problem that will make you pull your hair out trying to solve. So, the solution? Either use vi/vim or nano. If you use gedit, make sure you do a find and replace where you want to find “\r” and leave the replace textbox blank. This will remove all instances of \r. Your file will “look” exactly the same, however, you eliminated that pesky hidden carriage return character causing all the problems.

You’re Welcome!

Fix Java apps not finding Java in 64-bit Windows

For Java apps to run in Windows, a JRE (Java Runtime Environment) must be installed.  If it’s installed, but your Java apps are throwing errors that it cannot find the JRE, then you will need to add an environment variable to point to the Java bin directory.

Here is a screenshot of such an error I received when trying to run the Android SDK:

AndroidSDK error showing that Java is not installed -- Even though it is.

(Also notice the typo in the above message: “Checking it it’s installed in …”)

Below are instructions for fixing this error on Windows 7 x64 with the 64-bit JRE installed:

  1. Click the “Start Orb”, and type: about system
  2. In the search results, you should see “System” appear.  Click on it, and you should have the “View basic information about your computer window” appear.
  3. In that window, on the left hand side, you should see a link to “Advanced system settings”.  Click it.  (Accept all UAC prompts)
  4. The “System Properties” window will appear.  Click the “Advanced” tab.
  5. On the “Advanced” tab, click the button towards the bottom of the window titled “Environment Variables…”
  6. The “Environment Variables” window should appear.  In this window, on the bottom half, you should see a section titled: “System variables”.  Scroll down that list for an entry titled: Path. Click the “Edit” button.
  7. The “Edit System Variable” window should appear.  In this window, select the textbox for “Variable value:”.  Scroll to the end of the entry, and add a semicolon (;) to the end of the line (assuming no semicolon is currently there).
  8. You will then need to locate where your Java bin directory is located.  For me, on 64-bit Windows 7 with the 64-bit JRE installed, it is located in the following path: C:\Program Files\Java\jre6\bin (This is the default location if installing the 64-bit JRE)
  9. Copy and paste the path to the bin directory after the semicolon we just added to the “Variable value:” textbox.
  10. Click OK to all the windows, and your application should work.

Copyright © /sarc All Rights Reserved · Using modified version of Green Hope Theme by Sivan & schiy · Proudly powered by WordPress