It is assumed that you have installed java JDK. I am currently using JDK 1.7
Download the Eclipse luna and untar it to an /opt/ directory as a sudo
cd /opt/ && sudo tar -zxvf ~/Downloads/eclipse-*.tar.gz
Then, to add a shortcut, create a new file
sudo gedit /usr/share/applications/eclipse.desktop
in gedit, write the following lines, save and exit:
[Desktop Entry]
Name=Eclipse 4
Type=Application
Exec=/opt/eclipse/eclipse
Terminal=false
Icon=/opt/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Eclipse
Open eclipse under applications->programming.
When done, create a new Maven project by doing:
File->new->Project
Under Maven dropdown, select “Maven Project” then click on Next.
Select:
Create simple project ….
Use Default Workspace….
Click Next
Select ANYTHING for a groupID and ArtifactID then press FInish
Then go to a Project Explorer
Click on the root (name) of the project
Go to help->install new software->add…
The URL is http://download.scala-ide.org/sdk/lithium/e44/scala211/stable/site
For name use anything (Scala)
Select all suggestions and install them.
Under Package Explorer, double-click on the pom.xml
Locate the Dependencies tab and click on it
Click on Add… under the Dependencies and type
groupId: org.apache.spark
artifactId: spark-core_2.10
version: 1.2.0
Save and close the POM file’s tab.
in Package explorer, right click on src/main/java and select new class.
Make a new class with a main, you can call it NewClass
Copy and paste the code below
import org.apache.spark.SparkConf ;
import org.apache.spark.api.java.JavaSparkContext;public class NewClass {
public static void main(String[]args){
SparkConf conf = new SparkConf (). setMaster ( “local” ). setAppName ( “My App” );
JavaSparkContext sc = new JavaSparkContext ( conf );
}
}
Press run, the project will build and run
IF YOU GET AN ERROR:
Exception in thread “main” java.lang.NoClassDefFoundError: scala/Cloneable…
just import the Maven project from below (sorry):
https://drive.google.com/file/d/0B7egWfChXyoebTlvRHFiNUMzZWc/view?usp=sharing