I am trying to get Spark running locally. When I launch it, I get the following error, suggesting something is weird with my java installation (or the path to it). This is on Mac OS Yosemite.
line 190: /usr/java/jdk1.7.0_51/bin/java/bin/java/bin/java: No such file or directory
Any suggestions how to remedy this? Let me know if you need more info (I don't know where to start)
Edit: Clearly there is a setting wrong somewhere, I'm just not sure where.
In my bash-profile, there is a line
JAVA_HOME=usr/bin/java
Also when I run java -version I get:
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
Solution:
Something was weird with where Spark was looking for Java. Not sure how the default is set, but I found a way to override it.
1) In terminal run this and copy and paste the results. This gives you the path of your Java installation.
$(dirname $(readlink $(which javac)))/java_home
2) In the spark-whatever/conf folder, make a file "spark-env.sh" and write "export JAVA_HOME="
Related
I am trying to package a jar file into an executable file using the jpackage tool in Java, but the command is not recognized in the command prompt using Windows 10 and Java version:
> java --version
java 17.0.1 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
I have the full JDK installed and the command javac is recognized.
I checked my computer with the "where java javac jpackage" command and it only found the first two in the CommonFiles folder.
I looked in the folder path "ProgramFiles\Java\jdk-17.0.1\jmods" and both the "jdk.jlink.jmod" and "jdk.jpackage.jmod" files are present.
Can someone please help me figure out why the tool isn't recognized by Windows?
I found the issue to be the way my Environment Variables were set up for Java. To fix my problem, I went into the JAVA_HOME variable and changed the entry from
C:\ProgramFiles\Java\jdk-17.0.1\lib
to
C:\ProgramFiles\Java\jdk-17.0.1
Next I updated the path variable to include "%JAVA_HOME%\bin". Before I had it listed as C:\ProgramFiles\Java\jdk-17.0.1\bin. Both of these changes were made under the System variables using the "Edit" button. I want to thank dave_thompson_085 for pointing me in the right direction.
When I try to run .bin/elasticsearch, I get the following error:
could not find java in bundled jdk at /home/ubuntu/Elastic
Search/elasticsearch-7.8.0/jdk/bin/java
I have absolutely no idea what's going on. I know this topic has been created before, but I haven't found a way to fix. For java -version I get:
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~20.04-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)
Can anyone help me please? Thank you!
The most probable reason for the above error is that JAVA_HOME is not set
To display JAVA_HOME variable path, run this command echo $JAVA_HOME
If nothing appears then follow the below steps:
To see all the java versions installed in Ubuntu, use this command:
sudo update-alternatives --config java
Set your java path using this. - export JAVA_HOME=<YOUR-JAVA-PATH>
I had the similar problem on linux, when I was running elasticsearch using
sh elasticsearch
I got the error
Elasticsearch: could not find java in bundled jdk at .../jdk/bin/java
Then I referred to the official document
and set ES_JAVA_HOME environment variable.
After running elasticsearch again, I got the following message and it ran successfully
ignoring JAVA_HOME=/project/jdkForElasticSearch/; using ES_JAVA_HOME
Note: After setting environment variable, restart your terminal to reflect the updated value in it.
Hello guys this is the first time i write a question here and not just read an answer.
My problem is that I have a Macbook with Sierra on it and hava a tomcat with my wsdl file and i wanted to generate my classes with axis2 so i started the wsdl2java.sh in Eclipse and till that point everything works fine.
But then it says:
You must set the JAVA_HOME variable before running Axis2 Script.
but when i open a terminal and lookup for
echo $JAVA_HOME it will say:
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
and also when i type in java -version i get this result:
java version "1.8.0_101" Java(TM) SE Runtime Environment (build
1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
my question is why does eclipse not found my JAVA_HOME path?
i allready started eclipse as sudo directly through the terminal and also tried to change the .bash_profile but nothing works for me
I hope i described the Problem so that you can help me !
thanks a lot
As Minh Kieu recommended in the comments, I added this to the shell script of wsdl2java:
export JAVA_HOME=$(/usr/libexec/java_home)
Then I restarted Eclipse and now it worked.
I try to install CPLEX on my Mac. When I open terminal and type
chmod +x /Users/MarjoleinKroon/Downloads/cplex_studio126.osx.bin
/Users/MarjoleinKroon/Downloads/cplex_studio126.osx.bin
I get the following error
Preparing to install...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
/Users/MarjoleinKroon/Downloads/cplex_studio126.osx.bin: line 2374: Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java: No such file or directory
/Users/MarjoleinKroon/Downloads/cplex_studio126.osx.bin: line 2374: Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java: No such file or directory
No Java virtual machine could be found from your PATH
environment variable. You must install a VM prior to
running this program.
I searched the internet to solve this problem, and I found several things to check. If I type java -version I get
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
So it seems like java is installed properly. Furthermore, when I type /usr/libexec/java_home -V, a VM seems to be there:
Matching Java Virtual Machines (1):
1.8.0_40, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
Online I read something about PATHs, but I have not enough knowledge to understand this exactly. However, if I type echo $PATH I get
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin
I don't know what this means, but it seems kind of strange to me.
Can anyone help me? Please be as clear as possible, because I don't have a lot of knowledge concerning this. Thanks in advance!
I am trying to setup Android build environment for my Mac 10.8.3
I dont understand, Apple provide instructions on how to revert mac back to Java 1.6 here :
http://support.apple.com/kb/HT5559?viewlocale=en_US&locale=en_US
They are clear instructions that I followed.
Yet when I still get the following :
unknown-98:fe:94:3f:92:ce:~ newuser$ java -version
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
Please please help me solve this problem.
The Mac comes with, and occasionally updates, JDKs 1.4 through 1.6. You can see the versions you have installed in this directory:
/System/Library/Frameworks/JavaVM.framework/Versions
This is how you change the JDK
1. Command Line Java
My Java is coming from /usr/bin/java, which points off to one of the versions in the 'Versions' dir described above. To change the version of the JDK you're getting here, use the Java Preferences application under Applications -> Utilities -> Java:
You can drag the JDK you'd like to the top and it should be reflected immediately from the command line:
hostname% java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_16-133, mixed mode)
hostname% java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)
2. Scripts and Applications That Use Java
Generally, other built-in applications or one that you install will use the JAVA_HOME environment variable to pick a JDK. By default, you won't have this set, and Mac-specific versions of startup scripts will usually create one by using the CurrentJDK link in the Java 'Versions' directory. The steps to add environment variables are documented in this article, but I can save you a little time. Create a directory .MacOSX in your home directory and add a file called environment.plist. Here are the entire contents of my ~/.MacOSX/environment.plist file:
<!-- When changing this, also run Java Preferences and change there. -->
<key>JAVA_HOME</key>
<string>/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home</string>
With this value set, all processes started as you will have JAVA_HOME available to them. Since this file is read when you log in, you'll have to log out/in once after you create or edit this file.
Special case: NetBeans
The IDE I use is NetBeans, but the following idea probably applies to other large applications as well. When NetBeans is installed, it will pick a JDK to use and hard code it in a properties file. If you want it to rely on the JAVA_HOME that you're now setting in environment.plist, you just need to edit one file. Edit this file:
/Applications/NetBeans/NetBeans\ 6.5.app/Contents/Resources/NetBeans/etc/netbeans.conf
..and you can set the JDK by changing this line:
netbeans_jdkhome=$JAVA_HOME
Note that, as the netbeans.conf file points out, you can always force a different JDK to be used by specifying it on the command line when starting the IDE. For your copying and pasting pleasure, here is the command to use to start it from terminal (I'm giving the 'help' option in this case). If you're using a different version, autocomplete ought to help with the version part of the path:
/Applications/NetBeans/NetBeans\ 6.5.app/Contents/MacOS/netbeans
--help
Recap
To recap, you can switch JDKs for your whole system by using the Java Preferences application along with changing the value in your environment.plist file. To switch on the fly, use the Preferences app and set a new value for JAVA_HOME in whatever terminal you're using, though some apps like NetBeans will still pick up the system value and you should specify the desired JDK on the command line.
Resources where I found this solution: https://blogs.oracle.com/bobby/entry/switching_jdks_on_mac