sourceanalyzer: command not found (mac) - java

I just installed a newer version of the Fortify package (4.30) but every time I try to use the command line to manually scan a project, I get an error that sourceanalyzer isn't an available option. I've tried reinstalling and I still cant get it to work. I can only scan in audit workbench. I never had this problem with earlier versions of Fortify.

Add this line to your ~/.bash_profile
alias sourceanalyzer="/Applications/HP_Fortify/HP_Fortify_SCA_and_Apps_4.xx/bin/sourceanalyzer"
Note: Where it says HP_Fortify_SCA_and_Apps_4.xx, put the version you are using here. Make sure your path is working and you shouldn't have to worry about it anymore. Don't forget to update this when you update your fortify application.
After this is done, just run the following command in your terminal:
source ~/.bash_profile
that will reload the bash_profile in your terminal.

Start /Applications/HP_Fortify/HP_Fortify_SCA_and_Apps_4.30/bin/sourceanalyzer
Open a new tab and run your fortify bash script or run sourceanalyzer command from here
It still will not run in my other terminal windows, but will only run in this one.

Is HP_Fortify/HP_Fortify_SCA_and_Apps_4.30/bin in your path system variable? For Windows, look at system properties, advanced, environment variables, then edit the PATH system variable and look for the entry for 4.30/bin.

Related

Installing and using Emscripten

I installed Emscripten through the steps shown below:
1.) Download the emsdk-portable version for Linux/MacOSX
http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html#sdk-downloads
2.)
Run
$ ./emsdk update
$ ./emsdk install latest
$ ./emsdk activate latest
$ source emsdk_env.sh (To update your environment variables)
I believe everything installed correctly, however I am unable to run emscripten anywhere outside of the emsdk folder.
I need to be able to run em++ in my: Documents/project3/dataviz/graphiti folder.
Also, when I run em++ -v in my emsdk folder, I get the following message I have been unable to resolve:
Java does not seem to exist, requierd for closure compiler,
which is optional (define JAVA in /home/bryce/.emscripten if you want it)
I attempted to define the java path in the folder, but I'm not sure how it should look.
Any help resolving these two issues would be very much appreciated.
The first problem sounds like the PATH isn't being set correctly. Type echo $PATH after running source emdsk_env.sh and check that the path to your emscripten installation has been added.
Note that you have to export the PATH for each terminal session you're using (it might be an idea to put source <path to emsdk dir>/emsdk_env.sh in your .bashrc file so this gets done automatically).
Could this link help with the second problem?
https://kripken.github.io/emscripten-site/docs/building_from_source/verify_emscripten_environment.html#installing-missing-components

Java version does not change in windows command prompt

I am trying to change my java version because of compiler errors when running mvn install via the windows command prompt.
I changed the JAVA_HOME variable and made sure that it is referenced in the PATH variable (##EDIT##: had been done like this %JAVA_HOME%\bin;%PATH%;).
When I open the command prompt in the folder where my pom.exe is located (using the Windows 7 'Open command window here' shortcut) and type java -version the unchanged java version is displayed.
I made sure to close all instances of command prompts before starting a new one.
Strangely I discovered that when starting the command prompt via the Run dialog in the start menu (by typing cmd) the result of java -version is the desired version.
You need to modify path variable as well as below:
PATH=%JAVA_HOME%/bin;%PATH%
Post that make sure you open a new command prompt and rerun maven command.
When using the 'Open command window here' shortcut make sure to close and open the respective explorer window. When starting the command prompt in this way Windows uses cached environment variables and does therefore not retrieve the current version of java.
Took me a while to figure out because it was too surprising to expect this behavior. Before I was searching on google and stackoverflow.com without any results. Hope this saves someone the trouble.
In my case worked the following: after editing the environment variables, and checking by command line java -version and javac -version, javac was updated but not java, so you have to do it by command line also
set path=C:\Program Files\Java\jdk1.8.0_181\bin
Remove the existing JRE setups..
Install the one that you need to install.
Hope you have added it in the environment variable and path via settings... Test it, it should work!.
The same thing happened to me long ago, It was pointing to the older JRE, got stuck, so removed the existing JDKs and installed a fresh copy. It worked.
I too faced this problem where I want to change the java version in command prompt but failed. But finally I succeeded doing the below steps. First I'll show the failed attempt, followed by the actual success step so you will know the difference.
Failed Step:
1. Win + R
2. Type cmd and hit enter
3. Type java -version (Just to check if the version is the old one which we need to change)
4. Now try changing the path/classpath using set path=/classpath=
5. Now again type java -version(This will still show the old java version but not the new version which we set)
Success Step:
1. Win + R
2. Type open command window here and hit enter
3. Type java -version (Just to check if the version is the old one which we need to change)
4. Now try changing the path/classpath using set path=/classpath=
5. Now again type java -version and voila I see the changed java version here
Thanks!
I had the same problem too. After setting the JAVA_HOME, i couldn't see the new value in command prompt even though I started a new command prompt.
Strangely, it only occured when opening the command prompt from the Windows Explorer.
I faced this issue too. I changed the JAVA_HOME in the environment variable and then when I opened cmd and typed java -version, I've seen older version. Then, I deleted javapath file in C:/Program Files/Common Files/Oracle/Java. My issue has been fixed in this way.

Error: JAVA_HOME is not set and could not be found after Eclipse installation

Actually I installed hadoop successfully. hadoop version command worked fine. Now I wanted to run the map reduce program. So I installed eclipse. After which I am getting an error saying "Error: JAVA_HOME is not set and could not be found."
Even echo $JAVA_HOME command in cygwin terminal did not print the value after eclipse installation.
How can I fix this issue first?
How can I run the MaxTemperature map reduce program using eclipse.
Thanks
Try to set JAVA_HOME. You can do this by editing your env.sh such that it will have:
export JAVA_HOME=/absolute/path/to/your/java/home
In case the path contains spaces, surround it with double quotes.
Example:
export JAVA_HOME="/cygdrive/f/program files/java/jdk1.7.0_51"
You may need to refer to Eclipse Runtime Options.
I would try first to launch Eclipse with the -clean option
If that does not work, try launching Eclipse with -vm path to java vm
There are things you can do to modify the .ini file directly, but if these two fails, try to reinstall Eclipse. Remember, the java.exe exists in multiple locations on your PC. Changing your PATH variable manually might help you with Eclipse, but it may break other things. This is why some products use %JAVA_HOME% to distinguish from the Java that might be loaded before it.
If you want to really know what is going on with your Java installation, open a command prompt window and type c:\> where java.
As you can see, I have Java installed in multiple locations AND multiple versions of Java (7 and 8). It is important that you know these things before you start messing with environment variables.

I have problems after uninstalling jdk 7 on mac with rm -rf /Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk

I have problems after uninstalling jdk 7 on mac book pro with rm -rf /Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk
I also have installed java 8 and Intellij works well. But any attempt to run java -version or mvn crashes with error:
dyld: could not load inserted library '/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/libjsig.dylib' because image not found
[1] 1216 trace trap mvn
And in the same time I can build all the projects with IntelliJ.
I even can't run vim - I have the same mistake.
So, my questions:
1. What is the correct way to uninstall JDK?
2. What should I do in my situation to restore the system?
As mentioned by mattias in his answer, your problem stems from a command in one of your bash startup files, that tells bash to load certain dynamic libraries before it attempts to run any command.
Using unset DYLD_INSERT_LIBRARIES will only solve this temporarily, for the current running terminal. So you should fix the problem permanently, by first running that command, and then editing your .bash_profile and .bashrc files with vim or nano.
If you see a line that says
export DYLD_INSERT_LIBRARIES=/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/libjsig.dylib
just remove this line. If it inserts any additional libraries in addition to that libraries, just erase this particular library from /Library to libsig.dylib including the following : (if it's the last one, then the preceding :).
Exit Terminal, run it again and make sure your problem has been solved.
The procedure you have been following for removing the JDK is the correct one as suggested by Oracle. The problem was that once in the history of that machine, you or whoever was using it added that library to the DYLD_INSERT_LIBRARIES environment variable and this caused the problem. Also, the reason why this did not affect IntelliJ is that it is not running through bash, so bash commands do not affect it.
If you want to remove any other Java version, you should do the same as you did before, but make sure in advance that nothing in DYLD_INSERT_LIBRARIES refers to something inside /Library/Java/JavaVirtualMachines.
Have a look in your .bash_profile and try to look for
export DYLD_INSERT_LIBRARIES=/usr/lib/libSaturnFE.dylib
export DYLD_FORCE_FLAT_NAMESPACE=1
or anything similar. These might be causing the problem you experience.
Try commenting them out and reload your bash with
exec bash
and see if the problem persist.

Trouble in Setting Java Environment Path on Ubuntu (libjvm.so: cannot open shared object file: No such file or directory)

Found the solution!
Ubuntu by default ignore the command "RD_LIBRARY_PATH" therefore I need to add those codes in ".bashrc" instead of "/etc/environment" or .profile.
it now work perfectly fine!
I am trying to run a program that reads Java method from C/C++ code. (I made it on Windows successfully, now, I am working on Linux)
I made it successfully compiled and run on Ubuntu, however, the problem is..
Whenever I try to run the program, I have to type following commands on terminal..
source /etc/environment
./invoke #program name is invoke
If I do not type "source /etc/environment" every time I boot my PC, the error message I get is...
error while loading shared libraries: libjvm.so: cannot open shared object file: No such file or directory
Ok. Here is what I added in /etc/environment
export PATH="$PATH:/usr/lib/jvm/jdk1.7.0_25_x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_25_x64
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server
What I want is that, as you know, I want to run the program without typing "source /etc/environment".
I also tried typing those PATHs on /etc/profile, but result was same... I should type "source /etc/profile" every time I reboot my PC..
How to make it permanently applied to whole range of System without typing "source /etc/environment" stuffs everytime I boot?
if you need to see source code of the program, here is downloadable address:
http://cfile237.uf.daum.net/attach/247819495212DF1C07B9EB
This worked for me:
For x86:
export LD_LIBRARY_PATH=/usr/lib/jvm/default-java/jre/lib/i386:/usr/lib/jvm/default-java/jre/lib/i386/server
For x86_64
export LD_LIBRARY_PATH=/usr/lib/jvm/default-java/jre/lib/amd64:/usr/lib/jvm/default-java/jre/lib/amd64/server
I had the same problem of setting the path(permanently) however I was using Red Hat, If you look change PATH permanently on Ubuntu it might help you. There was a file on Red Hat .profile that once you add your exports statements, they will get loaded when the computer starts. :) There should be the kind of file for ubuntu
export PATH="$PATH:/usr/lib/jvm/jdk1.7.0_25_x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_25_x64
Put "-Djava.library.path=FULL_PATH_HERE/jre/lib/amd64" as a JVM option in your C code.
Edit the full_path_here part.
The path is allowed to be relative, but I don't think you can use $JAVA_HOME as a placeholder for the environment variable.
Found the solution!
Ubuntu by default ignore the command "RD_LIBRARY_PATH" therefore I need to add those codes in ".bashrc" instead of "/etc/environment" or .profile.
it now work perfectly fine!
add the path of the missing libraries in the file /etc/ld.so.conf
execute the following command: ldconfig
this way, you'll add the new libraries to the default ones.
To check whether the new libraries have been linked,
execute the following command: ldconfig -p
to have the list of libraries currently linked by default.

Categories