Could not create the Java Virtual Machine Error - java

I'm trying to run this command on my linux machine:
java -noverify -Xbootclasspath/p:burp-loader-keygen-2020_2.jar -jar burpsuite_pro_v2020.2.jar
and i keep getting these errors:
-Xbootclasspath/p is no longer a supported option.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I tried to install again these versions:
sudo apt update
sudo apt install default-jdk -y
sudo apt install default-jre -y
But i kept getting the same error over and over, any solution or help or suggestion?

You are running the Burp Suite JAR file the wrong way.
If this is an older version of Burp Suite, you must use Java 8 which still supports the -Xbootclasspath option. Note it is not sufficient to simply install Java 8. You need to make sure that java -version says it is Java 8, or use the full path to the Java 8 version of the java
command.
This won't work with Burp Suite 2020.4 or later.
Conversely, if you are using Burp Suite 2020.4 or later, then you need to use Java 9 or later, and you need to run like this:
java -jar -Xmx4g /path/to/burp.jar
Source:
Burp Suite Releases: Professional / Community 2020.4
Launching Burp Suite from the command line (as of the time of writing this answer).

Related

JavaFX on Oracle Linux 8.6

I have a Java application which uses javaFX to process images (using the javafx.scene.image.Image and some related functionality, and instantiating an javafx/embed/swing/JFXPanel object to force JavaFX to initialise). I'm trying to run this application on an Oracle free server running Oracle Linux 8.6 with Oracle Java 1.8.0_351 (OpenJDK and Oracle Java 19 give errors relating to JavaFX not being present). I've compiled my application into a JAR (compiling for Java 1.8.0_301 using Oracle Java on Windows). However, on the server, this doesn't work; I get the exception java.lang.UnsupportedOperationException: Unable to open DISPLAY.
This question's answer suggests using xvfb:
Deploy JavaFX on Ubuntu server without display
I've tried this, but get a "GLX version 1.3 or higher is required" error instead.
Is there a solution for running JavaFX with Oracle Linux?
What I've tried:
I've tried with two different OSes available with Oracle free;
Oracle Linux 8.6
OpenJDK was installed with sudo dnf install java-1.8.0-openjdk-devel.x86_64.
Running the jar gives the NoClassDefFoundError error.
I couldn't work out how to install javafx with dnf on Oracle Linux.
I decided to give Oracle Java a go; OpenJDK was unlinked with sudo unlink /etc/alternatives/java.
The Oracle jdk 19 was downloaded and installed with sudo rpm -ivh jdk-19_linux-x64_bin.rpm. Running the jar (with java -jar MyJar.jar) still gives the same error.
I tried uninstalling that (with sudo dnf remove jdk-19) and openJDK (with sudo dnf remove java) and installing Oracle Java 1.8.0 from a .rpm file. I then get an java.lang.UnsupportedOperationException: Unable to open DISPLAY error.
Xvfb was installed using sudo dnf install xorg-x11-server-Xvfb. xdpyinfo was installed using sudo dnf install xdpyinfo.
Xvfb was started using export DISPLAY=:99 and sudo xdpyinfo -display $DISPLAY > /dev/null || Xvfb $DISPLAY -screen 0 1024x768x16 & (taken from here: https://unix.stackexchange.com/a/297882 )
When running the JAR, I then get the exception
ES2 Prism: Error - GLX extension is not supported
GLX version 1.3 or higher is required
java.lang.UnsupportedOperationException: Internal Error
Canonical Ubuntu 22.04 Minimal
OpenJDK was installed with sudo apt-get install openjdk-8-jdk.
Running the jar gives the NoClassDefFoundError error.
OpenJFX was installed with sudo apt-get install openjfx. Same error.
I tried running the JAR with --module-path argument pointing to /usr/share/openjfx/lib/; --module-path is an unrecognised option with Java 8.
I upgraded to the latest openjdk sudo apt-get install openjdk. After this I'm able to use --module-path.
I tried running the JAR with java --module-path /usr/share/openjfx/lib/ --add-modules javafx.controls,javafx.base,javafx.graphics,javafx.swing -jar MyJar.jar (I'm not sure which modules correspond to which packages...). This causes a java.lang.UnsupportedOperationException: Unable to open DISPLAY error.

Jenkins installtion using java 1.6

I am trying to install Jenkins on a Solaris 5.10 machine and the Java version 1.6.0_161. I executed
"java -jar jenkins.war"
to install Jenkins but got the following log.
$ java -jar jenkins.war
Jenkins requires Java8 or later, but you are running 1.6.0_161-b13
from /usr/jdk/instances/jdk1.6.0/jre
java.lang.UnsupportedClassVersionError: 50.0
at Main.main(Main.java:124)
Its an Int server and we cannot upgrade java. Please let me know how to install jenkins in this using java 1.6.0_163
Please let me know how to install jenkins in this using java 1.6.0_163
The error message tells you already Jenkins requires Java8 or later. Why do you believe there would be a way to run in with Java 6?
If it would be enough to install Java for a specific user you could download the JDK/JRE from [1] and follow the installation instruction [2].
[1] http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
[2] https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html#A1012444

javac command not working in linux environment

I had successfully installed java on my linux system. When I ran a hello world test sample from desktop it ran successfully, but then after few days when I again tried to run it from terminal using javac command it gave me following response:
The program 'javac' can be found in the following packages:
* default-jdk
* ecj
* gcj-5-jdk
* openjdk-8-jdk-headless
* gcj-4.8-jdk
* gcj-4.9-jdk
* openjdk-9-jdk-headless
Try: sudo apt install <selected package>
When I test my JAVA_HOME env. variable using echo $JAVA_HOME its showing:
/usr/lib/jvm/java-8-openjdk-amd64
its also there with PATH variable.
When I ran a which java command its showing:
/usr/lib/jvm/java-8-openjdk-amd64/bin/java
and with command whereis java its showing:
java: /usr/lib/jvm/java-8-openjdk-amd64/bin/java /usr/share/man/man1/java.1.gz
So, I don't understand the problem, as I, myself applied the env. variables, and its showing everything perfect, then why is not javac command running? can any one look into this problem.
The core problem is that you do not have the Java Develoment Toolkit (which is different than the Java runtime) installed on your system. This means that utilities used to create Java programs (such as javac, jar, etc) are not on your system.
Thorbjørn Ravn Andersen gave the answer for Debian-family Linux systems, here's the answer for RedHat-family systems
yum install java-devel
or if you are on the latest Fedora
dnf install java-devel
Undo your environment settings and run sudo apt install openjdk-8-jdk. javac should now be in your path.
Just my 5 cents.
On CentOS 7 (assuming you want LTS Java 11):
sudo yum install java-11-openjdk-devel
/usr/lib/jvm/java-8-openjdk-amd64/bin/java
is not an dir, its an excecuteable.
try excecute the following to use javac:
/usr/lib/jvm/java-8-openjdk-amd64/bin/javac
or
/usr/lib/jvm/java-8-openjdk-amd64/bin/jstack

Cant run java program on raspberry Pi [duplicate]

This question already has an answer here:
JavaFx Ensemble on Raspberry pi
(1 answer)
Closed 7 years ago.
I have downloaded the latest OS for the pi from here http://downloads.raspberrypi.org/raspbian_latest
Then i have downloaded the latest Java JDK to run my JavaFX application from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html and selected the Hard Flat v6/v7 file.
I have transferred and unzipped the JavaJDK onto my Pi.
Now if i execute this command on my local machine, my application starts
Java -jar program_name.jar
But if i run the same command on the Pi, i get an error saying
Could not find or load main class application.Main
If i change the .jar file into a .zip, i can clearly see a directory called application, and file called Main.class
So why is my program working on my (windows 10) machine, whether i run it from eclipse or the command line, but not on the raspberry Pi?
To install the Java Runtime Environment (JRE) run the following command:
sudo apt-get install openjdk-7-jre
This installs the Java JRE (Java Runtime Environment) which will allow you to run applications written in Java.
To install the JDK run the command:
sudo apt-get install openjdk-7-jdk
This allows you to compile Java applications to bytecode.
If you want the Oracle Java VM, which is a lot faster (optimized for embedded arm CPUs) and is also a developer preview (applications maybe buggy or crash) until some time into the future. Instead of the above instructions you need to download the file called Oracle JDK 8 (with JavaFX) for ARM Early Access on the Oracle Java 8 download page.
Remember to download the Oracle Java system on your Pi, or you won't be able to install it.
To install the Oracle Java System:
sudo tar zxvf jdk-8-ea-b36e-linux-arm-hflt-*.tar.gz -C /opt
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.8.0/bin/java" 1
sudo update-alternatives for other commands if needed (e.g. javac).
java -version
Then it is all installed.
Another thing, if you have more then one Java runtime installed you have to check which version you use with the command java -version. If the output is:
java version 1.5.0 gij (GNU libgij)
Then you are using another java runtime. You can resolve the issue by running
sudo update-alternatives --config java
and choosing the OpenJDK or Oracle option.

Pyspark: Exception: Java gateway process exited before sending the driver its port number

I'm trying to run pyspark on my macbook air. When i try starting it up I get the error:
Exception: Java gateway process exited before sending the driver its port number
when sc = SparkContext() is being called upon startup. I have tried running the following commands:
./bin/pyspark
./bin/spark-shell
export PYSPARK_SUBMIT_ARGS="--master local[2] pyspark-shell"
with no avail. I have also looked here:
Spark + Python - Java gateway process exited before sending the driver its port number?
but the question has never been answered. Please help! Thanks.
One possible reason is JAVA_HOME is not set because java is not installed.
I encountered the same issue. It says
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/spark/launcher/Main : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:406)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/spark/python/pyspark/conf.py", line 104, in __init__
SparkContext._ensure_initialized()
File "/opt/spark/python/pyspark/context.py", line 243, in _ensure_initialized
SparkContext._gateway = gateway or launch_gateway()
File "/opt/spark/python/pyspark/java_gateway.py", line 94, in launch_gateway
raise Exception("Java gateway process exited before sending the driver its port number")
Exception: Java gateway process exited before sending the driver its port number
at sc = pyspark.SparkConf(). I solved it by running
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
which is from https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04
this should help you
One solution is adding pyspark-shell to the shell environment variable PYSPARK_SUBMIT_ARGS:
export PYSPARK_SUBMIT_ARGS="--master local[2] pyspark-shell"
There is a change in python/pyspark/java_gateway.py , which requires PYSPARK_SUBMIT_ARGS includes pyspark-shell if a PYSPARK_SUBMIT_ARGS variable is set by a user.
Had this error message running pyspark on Ubuntu, got rid of it by installing the openjdk-8-jdk package
from pyspark import SparkConf, SparkContext
sc = SparkContext(conf=SparkConf().setAppName("MyApp").setMaster("local"))
^^^ error
Install Open JDK 8:
apt-get install openjdk-8-jdk-headless -qq
On MacOS
Same on Mac OS, I typed in a terminal:
$ java -version
No Java runtime present, requesting install.
I was prompted to install Java from the Oracle's download site, chose the MacOS installer, clicked on jdk-13.0.2_osx-x64_bin.dmg and after that checked that Java was installed
$ java -version
java version "13.0.2" 2020-01-14
EDIT To install JDK 8 you need to go to https://www.oracle.com/java/technologies/javase-jdk8-downloads.html (login required)
After that I was able to start a Spark context with pyspark.
Checking if it works
In Python:
from pyspark import SparkContext
sc = SparkContext.getOrCreate()
# check that it really works by running a job
# example from http://spark.apache.org/docs/latest/rdd-programming-guide.html#parallelized-collections
data = range(10000)
distData = sc.parallelize(data)
distData.filter(lambda x: not x&1).take(10)
# Out: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
Note that you might need to set the environment variables PYSPARK_PYTHON and PYSPARK_DRIVER_PYTHON and they have to be the same Python version as the Python (or IPython) you're using to run pyspark (the driver).
I use Mac OS. I fixed the problem!
Below is how I fixed it.
JDK8 seems works fine. (https://github.com/jupyter/jupyter/issues/248)
So I checked my JDK /Library/Java/JavaVirtualMachines, I only have jdk-11.jdk in this path.
I downloaded JDK8 (I followed the link).
Which is:
brew tap caskroom/versions
brew cask install java8
After this, I added
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
to ~/.bash_profile file. (you sholud check your jdk1.8 file name)
It works now!
Hope this help :)
I will repost how I solved it here just for future references.
How I solved my similar problem
Prerequisite:
anaconda already installed
Spark already installed (https://spark.apache.org/downloads.html)
pyspark already installed (https://anaconda.org/conda-forge/pyspark)
Steps I did (NOTE: set the folder path accordingly to your system)
set the following environment variables.
SPARK_HOME to 'C:\spark\spark-3.0.1-bin-hadoop2.7'
set HADOOP_HOME to 'C:\spark\spark-3.0.1-bin-hadoop2.7'
set PYSPARK_DRIVER_PYTHON to 'jupyter'
set PYSPARK_DRIVER_PYTHON_OPTS to 'notebook'
add 'C:\spark\spark-3.0.1-bin-hadoop2.7\bin;' to PATH system variable.
Change the java installed folder directly under C: (Previously java was installed under Program files, so I re-installed directly
under C:)
so my JAVA_HOME will become like this 'C:\java\jdk1.8.0_271'
now. it works !
Had the same issue with my iphython notebook (IPython 3.2.1) on Linux (ubuntu).
What was missing in my case was setting the master URL in the $PYSPARK_SUBMIT_ARGS environment like this (assuming you use bash):
export PYSPARK_SUBMIT_ARGS="--master spark://<host>:<port>"
e.g.
export PYSPARK_SUBMIT_ARGS="--master spark://192.168.2.40:7077"
You can put this into your .bashrc file. You get the correct URL in the log for the spark master (the location for this log is reported when you start the master with /sbin/start_master.sh).
After spending hours and hours trying many different solutions, I can confirm that Java 10 SDK causes this error. On Mac, please navigate to /Library/Java/JavaVirtualMachines then run this command to uninstall Java JDK 10 completely:
sudo rm -rf jdk-10.jdk/
After that, please download JDK 8 then the problem will be solved.
I had the same error with PySpark, and setting JAVA_HOME to Java 11 worked for me (it was originally set to 16). I'm using MacOS and PyCharm.
You can check your current Java version by doing echo $JAVA_HOME.
Below is what worked for me. On my Mac I used the following homebrew command, but you can use a different method to install the desired Java version, depending on your OS.
# Install Java 11 (I believe 8 works too)
$ brew install openjdk#11
# Set JAVA_HOME by assigning the path where your Java is
$ export JAVA_HOME=/usr/local/opt/openjdk#11
Note: If you installed using homebrew and need to find the location of the path, you can do $ brew --prefix openjdk#11 and it should return a path like this: /usr/local/opt/openjdk#11
At this point, I could run my PySpark program from the terminal - however, my IDE (PyCharm) still had the same error until I globally changed the JAVA_HOME variable.
To update the variable, first check whether you're using the zsh or bash shell by running echo $SHELL on the command line. For zsh, you'll edit the ~/.zshenv file and for bash you'll edit the ~/.bash_profile.
# open the file
$ vim ~/.zshenv
OR
$ vim ~/.bash_profile
# once inside the file, set the variable with your Java path, then save and close the file
export JAVA_HOME=/usr/local/opt/openjdk#11
# test if it was set successfully
$ echo $JAVA_HOME
/usr/local/opt/openjdk#11
After this step, I could run PySpark through my PyCharm IDE as well.
Spark is very picky with the Java version you use. It is highly recommended that you use Java 1.8 (The open source AdoptOpenJDK 8 works well too).
After install it, set JAVA_HOME to your bash variables, if you use Mac/Linux:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
export PATH=$JAVA_HOME/bin:$PATH
There are many valuable hints here, however, none solved my problem completely so I will show the procedure that worked for me working in an Anaconda Jupyter Notebook on Windows:
Download and install java and pyspark in directories without blank spaces.
[maybe unnecessary] In the anaconda prompt, type where conda and where python and add the paths of the .exe files' directories to your Path variable using the Windows environmental variables tool. Add also the variables JAVA_HOME and SPARK_HOME there with their corresponding paths.
Even doing so, I had to set these variables manually from within the Notebook along with PYSPARK_SUBMIT_ARGS (use your own paths for SPARK_HOME and JAVA_HOME):
import os
os.environ["SPARK_HOME"] = r"C:\Spark\spark-3.2.0-bin-hadoop3.2"
os.environ["PYSPARK_SUBMIT_ARGS"] = "--master local[3] pyspark-shell"
os.environ["JAVA_HOME"] = r"C:\Java\jre1.8.0_311"
Install findspark from the notebook with !pip install findspark.
Run import findspark and findspark.init()
Run from pyspark.sql import SparkSession and spark = SparkSession.builder.getOrCreate()
Some useful links:
https://towardsdatascience.com/installing-apache-pyspark-on-windows-10-f5f0c506bea1
https://sparkbyexamples.com/pyspark/pyspark-exception-java-gateway-process-exited-before-sending-the-driver-its-port-number/
https://www.datacamp.com/community/tutorials/installing-anaconda-windows
I got the same Java gateway process exited......port number exception even though I set PYSPARK_SUBMIT_ARGS properly. I'm running Spark 1.6 and trying to get pyspark to work with IPython4/Jupyter (OS: ubuntu as VM guest).
While I got this exception, I noticed an hs_err_*.log was generated and it started with:
There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (malloc) failed to allocate 715849728 bytes for committing reserved memory.
So I increased the memory allocated for my ubuntu via VirtualBox Setting and restarted the guest ubuntu. Then this Java gateway exception goes away and everything worked out fine.
If you are trying to run spark without hadoop binaries, you might encounter the above mentioned error. One solution is to :
1) download hadoop separatedly.
2) add hadoop to your PATH
3) add hadoop classpath to your SPARK install
The first two steps are trivial, the last step can be best done by adding the following in the $SPARK_HOME/conf/spark-env.sh in each spark node (master and workers)
### in conf/spark-env.sh ###
export SPARK_DIST_CLASSPATH=$(hadoop classpath)
for more info also check: https://spark.apache.org/docs/latest/hadoop-provided.html
After spending a good amount of time with this issue, I was able to solve this. I own MacOs Catalina, working on Pycharm in an Anaconda environment.
Spark currently supports only Java8. If you install Java through command line, it will by default install the latest Java10+ and would cause all sorts of troubles. To solve this, follow the below steps -
1. Make sure you have Homebrew, else install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. Install X-code
xcode-select –-install
3. Install Java8 through the official website (not through terminal)
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
4. Install Apache-Spark
brew install apache-spark
5. Install Pyspark and Findspark (if you have anaconda)
conda install -c conda-forge findspark
conda install -c conda-forge/label/gcc7 findspark
conda install -c conda-forge pyspark
Viola! this should let you run PySpark without any issues
I got the same Exception: Java gateway process exited before sending the driver its port number in Cloudera VM when trying to start IPython with CSV support with a syntax error:
PYSPARK_DRIVER_PYTHON=ipython pyspark --packages com.databricks:spark-csv_2.10.1.4.0
will throw the error, while:
PYSPARK_DRIVER_PYTHON=ipython pyspark --packages com.databricks:spark-csv_2.10:1.4.0
will not.
The difference is in that last colon in the last (working) example, seperating the Scala version number from the package version number.
In my case this error came for the script which was running fine before. So I figured out that this might be due to my JAVA update. Before I was using java 1.8 but I had accidentally updated to java 1.9. When I switched back to java 1.8 the error disappeared and everything is running fine.
For those, who get this error for the same reason but do not know how to switch back to older java version on ubuntu:
run
sudo update-alternatives --config java
and make the selection for java version
I figured out the problem in Windows system. The installation directory for Java must not have blanks in the path such as in C:\Program Files. I re-installed Java in C\Java. I set JAVA_HOME to C:\Java and the problem went away.
I got this error because I was running low on disk space.
Had same issue, after installing java using below lines solved the issue !
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
I have the same error.
My trouble shooting procedures are:
Check out Spark source code.
Follow the error message. In my case: pyspark/java_gateway.py, line 93, in launch_gateway.
Check the code logic to find the root cause then you will resolve it.
In my case the issue is PySpark has no permission to create some temporary directory, so I just run my IDE with sudo
I have the same error in running pyspark in pycharm.
I solved the problem by adding JAVA_HOME in pycharm's environment variables.
I had the same exception and I tried everything by setting and resetting all environment variables. But the issue in the end drilled down to space in appname property of spark session,that is, "SparkSession.builder.appName("StreamingDemo").getOrCreate()". Immediately after removing space from string given to appname property it got resolved.I was using pyspark 2.7 with eclipse on windows 10 environment. It worked for me.
Enclosed are required screenshots.
For Linux (Ubuntu 18.04) with a JAVA_HOME issue, a key is to point it to the master folder:
Set Java 8 as default by: sudo update-alternatives --config java. If Jave 8 is not installed, install by: sudo apt install openjdk-8-jdk.
Set JAVA_HOME environment variable as the master java 8 folder. The location is given by the first command above removing jre/bin/java. Namely: export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/". If done on the command line, this will be relevant only for the current session (ref: export command on Linux). To verify: echo $JAVA_HOME.
In order to have this permanently set, add the bolded line above to a file that runs before you start your IDE/Jupyter/python interpreter. This could be by adding the bolded line above to .bashrc. This file loads when a bash is started interactively ref: .bashrc
The error occured since JAVA is not installed on machine.
Spark is developed in scala which usually runs on JAVA.
Try to install JAVA and execute the pyspark statements.
It will works
This usually happens if you do not have java installed in your machine.
Go to command prompt and check the version of your java:
type : java -version
you should get output sth like this
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)
If not, go to orcale and download jdk.
Check this video on how to download java and add it to the buildpath.
https://www.youtube.com/watch?v=f7rT0h1Q5Wo
Step:1
Check the java vesrion on from the terminal.
java -version
If you see the bash: java: command not found,which mean you don't have java installed in your system.
Step:2
Install Java using the following command,
sudo apt-get install default-jdk
Step:3
No check java version, you'll see the version have been downloaded.
java -version
result:
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
Step:4
Now run the pyspark code,
you'll never see such error.
I met this problem and actually not due to the JAVE_HOME setting. i assume you are using windows, and using Anaconda as your python tools. Please check whether you can use command prompt. I cannot run spark due to the crash of cmd. After fix this, spark can work well on my pc.
Worked hours on this. My problem was with Java 10 installation. I uninstalled it and installed Java 8, and now Pyspark works.
For me, the answer was to add two 'Content Roots' in 'File' -> 'Project Structure' -> 'Modules' (in IntelliJ):
YourPath\spark-2.2.1-bin-hadoop2.7\python
YourPath\spark-2.2.1-bin-hadoop2.7\python\lib\py4j-0.10.4-src.zip
This is an old thread but I'm adding my solution for those who use mac.
The issue was with the JAVA_HOME. You have to include this in your .bash_profile.
Check your java -version. If you downloaded the latest Java but it doesn't show up as the latest version, then you know that the path is wrong. Normally, the default path is export JAVA_HOME= /usr/bin/java.
So try changing the path to:
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
Alternatively you could also download the latest JDK.
https://www.oracle.com/technetwork/java/javase/downloads/index.html and this will automatically replace usr/bin/java to the latest version. You can confirm this by doing java -version again.
Then that should work.
Make sure that both your Java directory (as found in your path) AND your Python interpreter reside in directories with no spaces in them. These were the cause of my problem.

Categories

Resources