Using a sort of portable JDK on centOs - centos

This is the first time that I use linux in my life, I'm a little bit strugling.
Permissions, user, folder structure, it's a lot to take in.
Everything I did, I did with the ATH user which is a regular non sudoer user.
I got Centos minimal and put it in a VM
then I extracted the linux tar.gz jdk in /home/ath/monitoring/jdk1.8.0_70_linux64
And I added this to a sh script, this sh script call other sh script
I want them to only use this jdk
below #!/bin/sh I added
export JAVA_HOME=/home/ath/monitoring/jdk1.8.0_70_linux64
However when I launch the script I get :
Which : no java in (/usr/local/bin:/usr/bin:usr/local/sbin:/usr/sbin:/home/ath.local/bin:/home/ath/bin)
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME
What am I doing wrong?
Thanks
ps : I used (logged as root) chmod +x /home/ath/monitoring/elasticsearch/bin/elasticsearch/bin/elasticsearch.sh
on the sh script otherwhise it would not run

So I also had to add this line because the script was looking into PATH :
export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH
And I had to render all the file in jdk/bin executable running this inside
chmod a+x *
I don't get it tho, each time I'm getting a software I have to manually go and chmod every file that need it? quite bothersome.

Related

Mac OS: How do you fix a PATH to reach an executable file (in this case postgresql & netlify-cli) without messing up other paths?

In the mac terminal:
Does anyone know how to set the path variables for a Mac OS, without messing up other paths?
Current folder structure:
/
/Applications
/[a lot of applications]
/Postgres.app
/Contents
/Versions
/12
/bin
/psql
/Users
/userName
/Applications
/[nothing, except a couple hidden files]
Right now, if I run the command psql, I am getting:
command not found
If I type the full path:
/Applications/Postgres.app/Contents/Versions/12/bin/psql
it works, but typing this every time is not practical.
If I run git that command is available, or code .
Also, I installed netlify-cli globally with npm install -g netlify-cli, but when I run netlify-cli, I get:
command not found
and I don’t know where to find it in my system
… So, something is working correctly with my paths, and something is not. I don’t know how to fix the problem, without messing up other paths.
Does anyone know how I could find out where netlify-cli got installed and fix my paths to netlify-cli and psql without messing up any other paths?
For Mac OS to be able to find the psql executable, it has to be part of the PATH environment variable, you can check the value of that variable on your terminal with this command
echo $PATH
what you should do is add the psql executable to it, like this:
export PATH=/Applications/Postgres.app/Contents/Versions/12/bin/:$PATH
if that solves your problem, you can put that on your .zshrc or .bashrc to make it persistent

powershell and conda: conda activate env returns command not found

I have pip installed powerline-shell in my base conda env. Switching envs yields the following error:
conda activate <env_name>
-bash: powerline-shell: command not found
I also tried running conda init powershell but it took no actions.
I have miniconda3, with conda 4.7, installed on MacOS Mojave.
I don't know a simple solution to this. I'm thinking you either need to install it in every env (which I don't recommend because it's best to avoid using pip in Conda) or you create a link to the powerline-shell binary in another location that you can keep on PATH to avoid adding the entire miniconda3/bin/ directory to PATH. I've done something like this in the past, but never with a Python entry point before.
I'd try something like
mkdir -p ~/.local/bin
ln -s /your/path/to/miniconda3/bin/powerline-shell ~/.local/bin/powerline-shell
Then add .local/bin to PATH in your .bashrc, probably toward the beginning (e.g., before the Conda section). The path here (~/.local/bin) is totally arbitrary, so adjust to your preferences. Main point is to minimize what you are exposing globally in a shell session.
Note: conda init powershell is for Windows PowerShell users.

ionic install fails on fsevents on Windows

I have tried to install ionic on Windows but installation has failed. What should I do?
I have tried more than 20 times but still I got the same problem.
Here I have attached the screenshot for this
Entered commands:
npm install -g cordova
npm install -g ionic
Note: this one windows server machine
My guess is that the NPM global path has not been added to your windows path.
These are the steps to try:
First verify that the command just installed can run. The output contains the full path to the command installed, just copy and paste it to the command line. In your case it might be something like this %APPDATA%\Roaming\npm\iconic -v
Lets assume that works. That means that the command was successfully installed and will run, now we need to add it to your PATH so you can run it from the command line.
Next, Press Windows key and type "path" and select "Edit environment variables for your account". From here. Add or append the path %APPDATA%\Roaming\npm to your PATH variable, and save the results.
Once it is on your PATH you can run it from any command shell window.
Next, start a new command shell (e.g., Windows+R, cmd, Enter) and then type the command iconic -v. Viola, it should work without requiring the full path to the script.
I'm doing most of this from memory so hopefully it's correct. But if it needs some tweeks, let me know and I'll update the answer.
For completness, this install didn't actually fail. The lines with fsevents are warnings. The fsevents package is only designed to work on Mac Unix so these warnings can be safely ignored.
As Suraj Rao mentioned, also see Nodejs cannot find installed module on Windows?.

Chmod u+x windows cmd

I'm trying to install Scalatra on windows seven and need to change a file to executable...the Scalatra documentation says to do this, which is unix. What is the windows equivalant?
chmod u+x srt
You can simply open the relevant folder with a unix command prompt (I use git bash) and execute the unix commands from there
To get scalatra-sbt going on Windows, either port you own sbt.bat from scalatra-sbt, or install chmod via cygwin.
Assuming you've successfully installed the rest of Conscript and giter8, you can start a project that downloads scalatra-sbt. From there, one can look through the ./sbt source, and port the bash script functionality to your own windows specific script, or install a unix compatibility layer into Windows. If you go down the "windows specific script" route, perhaps the scalatra-sbt would appreciate the project contribution.
The "unix compatibility layer" route will eventually allow you to run ./sbt. chmod is a unix command line function, and is provided in a default package of the tool set cygwin, which provides a complete lunix-like environment. Once inside a cygwin terminal, you can chmod your file, as mentioned in the scalatra-sbt first project.
Diving into the contents of ./sbt from scalatra-sbt, this is actually unix script wrapper around the scala build tool (also referred to, confusingly, as sbt). If while trying to run ./sbt you get strange '\r' errors, install the cygwin package dos2unix, and then run it on the sbt file. If you run into any "which: no curl in..." or "which: no wget in..." errors, go back to the cygwin installer, find those packages such as wget, and then install those programs.
By the way, the last thing the scalatra-sbt script runs is the Scala build tool. The Scala build tool sbt itself has many reported issues with cygwin's default configuration, so you will likely need to do more research. Depending on what issues you're running into on your specific setup, you may need to make changes to the end of the ./sbt script to adjust the parameters used to launch the Scala build tool.

Makefiles in eclipse and their path

I'm trying to build a project with a specific compiler in Eclipse, and I'm using a Makefile to do the dirty work -- only problem is that it seems as if Eclipse doesn't share the same paths as my bash sessions. I've set .bash_profile and .profile (apparently Mac likes .profile just as much as .bash_profile), but neither of the exports that I've included are getting picked up. Do I need to manually set some symlinks in my /usr/bin or something like that? Or is there a way to manually set paths in eclipse?
This is because .bash_profile and .profile are read by bash when session is started. So you need to change the build command to bash -l -c "make".
Edited the Makefile and just added the absolute path:
PATH = /Users/me/yagarto/yagarto-4.6.2/bin/
TRGT = $(PATH)arm-none-eabi-