Eclipse can't see /usr/local folder on mac - eclipse

I am developing a web application in Java on my mac.
The web application will run on tomcat.
I have installed tomcat in /usr/local/apache-tomcat.
When I try to set the tomcat runtime in Server->Runtime Environments, I am not able to see the folder /usr/local. how do I get eclipse to see the /usr/local/apache-tomcat directory?
I am able to see /usr/local when using the Go to Folder option in Finder.

I had similar problem with loading external jar files in /usr/local/ for Eclipse on Mac
The way i resolved this was to create a soft-link using ln -s to the folder in /usr/local to a visible folder and then loaded the jars.
ln -s source visible_location/link
Works for me.

I just got a similar problem, and the workaround i found is to copy/paste the path of your tomcat base directory, and it works fine:
Go to your tomcat base directory
pwd to get the path and copy it
Go to eclipse -> preferences -> servers -> runtime environments -> add button -> select apache tomcat version -> then next
At this step, instead of browsing, you can simply paste the copied path in the Tomcat installation directory field!
et voilà

My guess is that you have your finder settings that hide hidden folders. It is possible to show them by following the instructions in this article.
The easiest way to do this is to type the following in your terminal:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
If you type out the full name of the installation folder instead of using the finder, does it work?

You can easily control hidden files writing this in bash_profile
alias hideOn='defaults write com.apple.finder AppleShowAllFiles TRUE'
alias hideOff='defaults write com.apple.finder AppleShowAllFiles FALSE'
alias kFinder='killAll Finder'
alias hOn='hideOn && kFinder'
alias hOff='hideOff && kFinder'
Then, reopen your terminal and write hOn. At root folder you will see hidden /usr. Just put it in your finder sidebar. Then write hOff and you will stop seeing the hidden files, but /usr will be always there at finder.

Related

PhpStorm PhpUnit via phar autocomplete not working

I have PHPStorm 8.0.1.
PHPUnit is installed via PHAR archive like:
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
sudo mv phpunit.phar /usr/bin/phpunit
PHPUnit works via cli:
user#pc:/usr/bin$ cd ~
user#pc:~$ phpunit --version
PHPUnit 4.3.5 by Sebastian Bergmann.
I followed the instructions from JetBrains website https://www.jetbrains.com/phpstorm/webhelp/enabling-phpunit-support.html#d298258e897
In PHPStorm File->Settings tab PHP/PHPUnit
the radio button Path to phpunit.phar is checked
and value is set to /usr/bin/phpunit
I have a file with a test defined like:
class MyTest extends PHPUnit_Framework_TestCase {
...
At this point PHPStorm marks Undefined class PHPUnit_Framework_TestCase
I've restarted PHPStorm and Computer, but still have the same problem.
I've also tried adding /usr/bin to include path (right click on external libraries in project view, and choose option Configure PHP include paths) without success.
Here's the config for PHPStorm Settings, tab PHP (if it matters):
PHP Language level: 5.5 (finally, generators, etc.)
Interpreter: PHP 5.5 (5.5.9-1ubuntu4.5)
Include path is empty
In order to have a PHAR archive indexed by the IDE it has to have a .phar extension (that's a requirement).
The easiest solution is to place phpunit.phar somewhere in your project (usually it would be PROJECT_ROOT/vendor/ folder).
If having local copy inside the project folder is not desired (for whatever reason; although Composer and other similar kind of tools (bower/npm/etc) are primarily aimed at keeping dependency stuff/packages locally), you may use symbolic links:
either create a symbolic link to that file locally (e.g. PROJECT_ROOT/phpunit.phar --> /usr/bin/phpunit)
or place a full copy (or such symbolic link) in a separate folder outside of the project and then reference it via PhpStorm's Settings | PHP | Include Paths functionality.
The above fix by Calin worked for me too on PhpStorm 2019.1.1, so I'll post it as an answer for easier visibility:
Try right clicking on the .phar and clicking "Exclude phar from project", then clicking "Include phar into project" to refresh it.
In my case, both the .phar file and my .idea folder were pulled from a git commit. I guess PhpStorm didnt realise that the file needed reimporting.
I noticed even though PHP itself can find and run phar that is in its include path, PHPStorm having trouble finding and parsing them.
LazyOne's explanation is correct, however, I didn't need to put it in project folder to be recognized, you can put them in any path as long as its path is introduced to IDE. In my case, I put all phar files in PHP folder, so I just needed to add PHP folder to Include Path list in IDE
Include Path for PHP is under Settings -> Language & Frameworks -> PHP screen (that tiny + at the bottom of screen).

How to use SASS with Netbeans 8.0.1

I'm trying to use SASS in Netbeans 8.0.1. I have Ruby and SASS set up correctly based upon the feedback from ruby -v.
I have a web application set up with css and scss folders under Project\Web Pages\resources.
My input and output are set to /scss and /css respectively and I have checked 'Compile Sass File on Save'. I have created a styles.scss file and added some SASS/CSS.
When I save the styles.scss file, is it supposed to generate a styles.css? Nothing happens when I save or compile the project.
Has anyone run into any similar problems or have suggestions on how to debug this problem?
Thanks in advance!
Installing SASS on Windows10, Ruby2.2.3, Netbeans8
Download SASS for Windows - RubyInstaller.org
Install Ruby like:
Search windows for CMD (Command Prompt) and start it.
Access Ruby's bin folder using cd \Ruby\bin (Hit Enter)
Install sass using the command gem install sass (Hit Enter to install)
Wait for the installation to finish
In Netbeans open
Options → Tools → Miscellaneous (HTML/JS in v8.1+) → CSS Preprocessors tab
Enter the path to the installed sass.bat C:\Ruby\bin\sass.bat than click Install Sass.
Confirm your changes with Apply / OK
Use an existing one or Create a New Project (HTML5, PHP, whatever...).
After the project is created open the Projects window.
Right-Click your project and choose > Properties.
From the Project Properties popup select CSS Preprocessors.
Select the Compile SASS Files on Save.
(If you want the compiler to automatically minimize your .css result file, use --style compressed under the Compiler Options)
You can see from the image above that the compiler uses two default Input(watchable)/Output(compiled destionation) folders paths.
Create the scss folder (an optionally the css folder) in your project as well.
You're done!
As soon you create a new .scss file or you save it Netbeans will automatically compile the file to .css in the /css folder.
Yes, when you save the file, the css should be created/updated. I think you have wrong mapping for the input/output directories. The paths need to be relative to site root/web root. I don't know for sure what your project is (HTML5 or PHP or Java Web or other?), but if you have Java Web project, then the paths need to be
resources/scss -> resources/css
Salam guys, the below image form my (Command Prompt with Ruby) says that:
"Ruby Sass has reached end-of-life and should no longer be used"
For modern SASS and Netbeans we can just use https://github.com/sass/dart-sass/releases/tag/1.56.1 and install it in our PATH.
The release has the sass.bat file we need (as Roko C. Buljan pointed in his tutorial for Ruby).
There's not need to install Ruby and any other environment.
I applied this on Netbeans 15

Diff in PhpStorm

How can I compare a document in the current project with one that is not part of the project?
How can I compare two arbitrary files on my computer with phpStorm?
Currently, the easiest way that I found to compare a project file with a non-project file is by copying the external file to the clipboard and clicking on "View-> Compare with clipboard".
It can be done only externally:
You can also open the difference viewer without running PhpStorm. This is done through the following command:
<path to PhpStorm executable file> diff <path_1> <path_2>
where path_1 and path_2 are paths to the files in question, which can be of various types, including jar.
From inside PhpStorm you can only compare files that are available in the project.
What I do for comparing two external sources (web page sources etc.)
1 - Open a new scratch file from "File" Menu -> "New Scratch File" and choose a file type
2 - Copy & Paste Source 1 to this new scratch file
3 - Either create a new scratch file for second source and click "Compare With" from "View" Menu
or
better just directly copy second to clipboard and from "View" Menu click to "Compare with Clipboard"
MacOS
Create a file in /usr/local/bin/ named PhpStorm
Paste this
#!/bin/sh
open -na "PhpStorm.app" --args "$#"
And make it executable
chmod +x /usr/local/bin/PhpStorm
And now you can do this
PhpStorm diff <path1> <path2>
Windows
Add PhpStorm bin to your PATH
setx PATH=%PATH%;C:\Program Files\JetBrains\PhpStorm\bin
Now you can do this
phpstorm.bat diff <path1> <path2>
Linux
Create a link to your PhpStorm launcher script :
# Path to PhpStorm installation may differ
ln -s /opt/phpstorm/bin/phpstorm.sh /usr/local/bin/phpstorm
Now you can do
phpstorm diff <path1> <path2>
Sources from jetbrains werbsite :
https://www.jetbrains.com/help/phpstorm/command-line-differences-viewer.html
https://www.jetbrains.com/help/phpstorm/working-with-the-ide-features-from-command-line.html
In phpStorm 2016.2 (and possibly some earlier editions) you can navigate to the external file via File >> Open... , which will open a tab showing the external file's content. You can then use View>> Compare with... to compare the external file to a file within your project.

Running Eclipse on desktop = can't find companion library

I just downloaded Eclipse Juno onto my machine. I extracted the files to an Eclipse subdirectory in "C:\Program Files". When I try to launch eclipse from here, it works great! But I don't want to have to navigate to this directory every time I want to launch eclipse. I tried just moving the executable to my Desktop, but then when I try to run it I get this message:
The eclipse executable launcher was unable to locate its companion library.
How do I let eclipse know where it's companion library is if I don't plan to have them in the same folder? Please be very specific.
Thanks!
You dont move the executable to your desktop because the executable needs to be in the same directory with other files where it was. get it back and then make a shortcut or link to it. you are free to make the shortcut or link where you want.
Well i had the same problem sometime back, and i figured out that since i've changed the location of my elcipse.exe , it has some how effected the "eclipse.ini " file
1.Path to -startup
D:\ < elcipse folder> elcipse:\ plugins\org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar \this is the start up jar file.
2.Path to shared lucher library
D:\ < elcipse folder> elcipse:\ org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813 \this is the shared launcher library jar file.
just set the follwing two paths and ti will start up again like befor..
Happy coding..
This is a bug filed with Eclipse for Windows and Mac:
When attempting to launch Eclipse (double click on Eclipse.app), the launch fails. The only action is a dialog box with this message:' the eclipse executable launcher was unable to locate its companion shared library'. I found an online description of the problem and the workaround here:
Specifically, as per the instructions above:
I opened the Eclipse.app package, located eclipse.ini, edited it
searched the plugins folder for something matching org.eclipse.equinox.launcher.carbon.
copied the maching folder name (from plugins)
pasted it as the terminating portion of the path for --launcher.library
replaced the --launcher.library line with that path
https://bugs.eclipse.org/bugs/show_bug.cgi?id=288112
Eclipse Neon, 2017:
I copied my old .p2 folder found in my home.
Ran eclipse again and it worked.
It used to be that you could just copy eclipse as a zip and it would work fine, but it seems some plugins now rely on the .p2 folder.

Cannot add a glassfish server in eclipse!

After many efforts, i did installing of java_ee on my system.
I'm using eclipse Galileo. After i try to add a new server, I choose the location for glassfish, click next and it gives me:
home/banco/glassfishv3/glassfish/domains/domain1 is not writable
Since the glassfish is situated in Home folder, i can't understand the reason for this error
Because it is placed in your home directory, it doesn't give you automaticly write permission to files.
Have you checked the folder permissions with ls -l ?
ls -l home/banco/glassfishv3/glassfish/domains/domain1
Sometimes I decompress archives as the wrong user in my home directory and have similiar errors...