I am trying to update RJava to reflect the latest version of Java 1.8 on my mac. I think I found the right information in doing so but the issue arises when I use 'Terminal' to run some code. I have to run:
sudo R CMD javareconf -n
but I receive an error of:
sudo: R: command not found
I found some information online and I found out I need to change the path in Terminal. I found out that the path where R is '/usr/bin/R'. When I changed the path using the command:
export PATH=/usr/bin/R:$PATH
and then tried to run the code again; I got no where and I am out of luck. I don't understand what the code is but I can only assuming what it does. Hopefully I can get some insight on how I can change the path so I can update rJava to the updated Java Version. Thank you for anyone's time.
The PATH setting would be PATH=/usr/bin:$PATH or you even easier
sudo /usr/bin/R CMD javareconf
Note that -n wouldn't do anything so you probably didn't mean that. Also if you don't even have /usr/bin on your PATH, you have probably even bigger issues since you also need to find java in the first place. In cases like that you may have better luck using sudo -i and then using the shell to fix whatever env vars are not setup correctly in your system.
Related
While I have some experience in Python and JavaScript, I am new to Java and am trying it out for the first time. To get started, I went to http://www.java.com, downloaded the dmg there, and then used the package it gave me to install Java. After doing so, I received confirmation that Java had been installed successfully and I closed and trashed the dmg and package. Afterwards, I hopped on my terminal (I am using a Mac running on MacOS Monterey) and tried to use javac on a script I wrote. I received the following error message:
The operation couldn’t be completed. Unable to locate a Java Runtime that supports javac.
Please visit http://www.java.com for information on installing Java.
I went online and did some typical troubleshooting searches. First, I found a site suggesting that I create an environment variable $JAVA_HOME and set it equal to $(/usr/libexec/java_home) in .zshenv (yes, I use zsh not bash). I followed this instruction and when I run echo $JAVA_HOME I get /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home. However, running javac still did not work.
Once more, I went online and this time, I found the suggestion of adding javac to $PATH. So I went into .zshenv and added usr/bin/javac to $PATH (the $PATH export line now looks like this: export PATH="/Users/[redacted]/Library/Python/3.8/bin:/usr/bin/javac:$PATH"). This alteration was confirmed when I exited an reentered terminal and ran echo $PATH. However, once again, running javac yielded the same error.
I feel as if I am facing what must be a pretty common and easily fixable issue, but yet, I haven't yet been able to find a solution that works despite perusal of several other StackOverflow posts and tech articles. Still, I know I'm probably missing something simple, and if this is a duplicate of another question, please link that question in a comment, and I'll take this one down.
Thanks!
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.
I got a new mac and installed the same xampp web server as my old one.
Everything has been fine except when I call a java file :
$str_exec = "java -jar HelloWorld.jar";
exec($str_exec, $output,$result);
$output is now an empty array(), and $result = 5
I've tried absolute paths, permissions on everything, changing the user and group in https.conf (none of which I had to do before!)
I swear nothing has changed except I'm now using a macbook pro instead of an air. The files have always matched our main server files. The only thing appearing in the error log is:
dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /Applications/XAMPP/xamppfiles/lib/libJPEG.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Help please!! I've gone through all the similar threads to this issue on here and can't find anything on the internet anywhere! Gnh
EDIT:
Don't use the solution below. It will eventually break, as expected. Mine finally broke, throwing dyld errors when I tried to start the apache server. It wouldn't start at all. No idea why it worked before and doesn't now, but it doesn't matter. Just ditch XAMPP, and follow these instructions to spin up your own stack: http://jason.pureconcepts.net/2012/10/install-apache-php-mysql-mac-os-x/
Good luck!
ORIGINAL ANSWER:
Ok, I've got a working solution, although I know that it's not the safest by a long shot.
Here's what's up:
DYLD_LIBRARY_PATH is a var that modifies the way that the dynamic linking library looks for libs. Apparently many developers think that your software should not use this var. XAMPP does.
According to one solution, you can simply edit out the lines that include this file. (http://www.pdflib.com/fileadmin/pdflib/pdf/support/PDFlib-in-PHP-HowTo.pdf).
Open xamppfiles/bin/envvars with an editor and remove the lines that set and export DYLD_LIBRARY_PATH. Then restart apache.
However, this did not work for me. I also tried the same in a file called xamppfiles/bin/envvars-std. Still didn't work. It may be worth a try though.
The problem is that the XAMPP library conflicts with the mac osx library. So I just (effectively) deleted the XAMPP library. Of course that broke another library, but I continued on deleting the (hopefully redundant) XAMPP libs until it worked. Here's what I had to do:
XAMPP/xamppfiles/lib% sudo mv libjpeg.dylib _changed_libjpeg.dylib
XAMPP/xamppfiles/lib% sudo mv libtiff.dylib _changed_libtiff.dylib
XAMPP/xamppfiles/lib% sudo mv libpng.dylib _changed_libpng.dylib
XAMPP/xamppfiles/lib% sudo mv libiconv.2.dylib _changed_libiconv.2.dylib
XAMPP/xamppfiles/lib% sudo mv libexslt.0.dylib _changed_libexslt.0.dylib
XAMPP/xamppfiles/lib% sudo mv libxml2.2.dylib _changed_libxml2.2.dylib
XAMPP/xamppfiles/lib% sudo mv libxslt.1.dylib _changed_libxslt.1.dylib
After I moved each library to a name where it couldn't find it, I reran the script. It would error on another lib, and I would move it. After a few of these, it stopped. Everything still seems to be working fine in my XAMPP and Apache deployments.
And more importantly, I can now run exec("/usr/bin/php -v"); successfully!
HTH
I am trying to get a grasp of unitTesting and have set out to follow this netTuts tutorial. In the tutorial it gets you to download a javafile from here. This file is then moved and then using
java -jar /usr/local/bin/selenium-server-standalone-2.38.0.jar
the file is meant to run.
My problem is that I get the message
Invalid or corrupt jarfile /usr/local/bin/selenium-server-standalone-2.38.0.jar
The searches I have made to resolve this issue talk about people creating their own file or something going wrong with the download as the file size should be bigger than what has been downloaded. Mine is 34.6MB which is what I believe to be about correct. I have also checked what Java version I am running (1.6.0_65), (here says 1.6+ is fine).
This appears to be a common problem, but I have not been able to find any solutions.
After trying a number of different options (including re-downloading on several occasions) it seems the file WAS corrupt.
I downloaded from here instead and it worked first time.
I faced this issue on Mac for selenium-server-standalone-4.0.0-alpha-1.zip.jar because of a bug https://github.com/angular/webdriver-manager/issues/370.
If someone is still facing the issue after trying all the solutions mentioned above, easiest way to get it working is to run the command with version(latest - stable).
sudo webdriver-manager --versions.standalone=3.9.1 update
then to start webdriver -
sudo webdriver-manager --versions.standalone=3.9.1 start
where 3.9.1 is version.
Apart from this also check for correct Java version
I was behind a corporate firewall when this corrupt file was created. I'm using OSX. For me, removing the file then re-downloading with proxy setting provided solved the problem.
1) sudo rm /usr/local/lib/node_modules/protractor/selenium/selenium-server-standalone-2.42.2.jar
2) sudo webdriver-manager update --proxy=http://<your proxy server>
Hope this helps!
On mac, I had to sudo on both.
sudo npm install -g protractor
sudo webdriver-manager update
Else it would give me the corrupt jar error, no need for proxy
I had the same error. It was corrupt and I just removed the .jar and did a webdriver-manager update again and got a new working .jar.
Well, this worked for me in windows.
In the command prompt, type the following commands in order.
webdriver-manager clean --out_dir
webdriver-manager update
Replace the file from here:
http://selenium-release.storage.googleapis.com/index.html
I downloaded the file from here and replaced it in my selenium folder.
When I run MATLAB install script in Ubuntu, I get the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.awt.Component
longer output is available here
I know that it's a Java problem and could potentially be fixed by changing the classpath or something like that but I don't exactly know how.
Any Ideas?
For me this error was fixed when I installed the JRE on my system:
apt-get install default-jre
on Ubuntu 12.04, instead of having MATLAB use its own.
I've been battling this problem for the whole evening as well but I stumbled onto a solution that works for me at least.
After trying to install using the silent installer I got a different error with a bit more information. It turned out that a library was missing (libXtst.so.6). I was able to install that on my Ubuntu system with:
apt-get install libxtst6
After that I tried running the GUI installer (over X forwarding) and it looks like it's going to work now.
For MATLAB R2012a Student Edition, in Ubuntu 14.04, I had to install these prerequisites first:
sudo apt-get install default-jre libxtst6:i386 libXext6:i386 libxi6:i386 libncurses5:i386 libxt6:i386 libxpm4:i386 libxmu6:i386 libxp6:i386
Next I installed/activated per MATLAB's instructions (sudo ./install). I answered "yes" when the installer asked to add a symbolic link in /usr/local/bin/
Finally, when launching MATLAB, I have to specify that it run in 32-bit mode:
matlab -glnx86
I assembled those steps from this answer: https://askubuntu.com/questions/363878/how-to-install-32-bit-matlab-in-ubuntu-64-bit
and the Ubuntu MATLAB guide:
https://help.ubuntu.com/community/MATLAB
Optional
I didn't want to type the -glnx86 option each time I launch MATLAB, so I replaced the matlab symbolic link in /usr/local/bin/ with a script that automatically specifies the -glnx86 option:
ls -l /usr/local/bin/matlab #note the destination of the symbolic link
sudo mv /usr/local/bin/matlab /usr/local/bin/matlab.bak
#ensure the first path below matches your symbolic link's destination
echo '/usr/local/MATLAB/R2012a_Student/bin/matlab -glnx86 "$#"' | sudo tee /usr/local/bin/matlab
sudo chmod +x /usr/local/bin/matlab
With that, I can type 'matlab' and it launches properly. (The "$#" in the script forwards all input arguments to matlab.) There's probably a more elegant way to accomplish this, but it worked.
I also encountered a "/lib/libc.so.6: not found" error on matlab startup, which I fixed by following this answer.
Installing gnome (sudo apt-get install gnome) fixed this problem for me. I'm sure this was total overkill, but the required libraries are now available.