Hi Alexander,
Thanks for replying me. I am particularly interested in running Spark code 
written in Java on Zeppelin Notebook.  
 

    On Sunday, November 20, 2016 11:06 AM, Alexander Bezzubov <b...@apache.org> 
wrote:
 

 Good question :)
Actually, there is a not very well known yet "hack" (I talked about it a bit on 
ApacheCon this year) - to run a pure Java paragraph in Apache Zeppelin - you 
can just use `%beam` interpreter!
Beam interpreter uses Beam Java API, so you can leverage it i.e to run WEKA 
machine learning library (pure Java) in Zeppelin as below
```%beam
import java.io.BufferedReader;import java.io.FileReader; import 
weka.classifiers.Classifier;import weka.classifiers.lazy.IBk;import 
weka.core.Instance;import weka.core.Instances;import weka.core.Instances;
public class KNN {
 public static void main(String[] args) throws Exception { BufferedReader 
datafile = new BufferedReader(new FileReader("/home/ubuntu/ads-weka.txt"));  
Instances data = new Instances(datafile); 
data.setClassIndex(data.numAttributes() - 1);  //do not use first and second 
Instance first = data.instance(2); Instance second = data.instance(3); 
data.delete(2); data.delete(3);  Classifier ibk = new IBk();  
ibk.buildClassifier(data);  double class1 = ibk.classifyInstance(first); double 
class2 = ibk.classifyInstance(second);  System.out.println("first: " + class1 + 
"\nsecond: " + class2); }}```
It will compile the code the classes and execute it.
You just need to remember to build Zeppelin with `-Pbeam` (may be can be added 
to the release convenience binary as well?)
--Alex 
On Sun, Nov 20, 2016 at 11:42 AM, DuyHai Doan <doanduy...@gmail.com> wrote:

Or wait for Java9, there will be a REPL for Java
On Sun, Nov 20, 2016 at 11:40 AM, Felix Cheung <felixcheun...@hotmail.com> 
wrote:

I think you will need to convert Java code into Scala syntax? But Scala can 
call into Java libraries and so on.
I don't think we have an interpreter for Java since it does not come with a 
REPL until Java 9?


From: Abhisar Mohapatra <abhisar.mohapa...@inmobi.com>
Sent: Thursday, November 17, 2016 9:23:24 AM
To: users@zeppelin.apache.org; Muhammad Rezaul Karim
Subject: Re: Is it possible to run Java code on Zeppelin Notebook? Yes it will. 
I guess there are some implementations too
On Thu, Nov 17, 2016 at 10:41 PM, Muhammad Rezaul Karim <reza_cse...@yahoo.com> 
wrote:

Hi All,

I am a new user of Zeppelin and got to know that Apache Zeppelin is using Spark 
as the backend interpreter.

Till date, I have run some codes written in Scala on the Zeppelin notebook. 
However, I am pretty familiar with writing Spark application using Java. 
Now my question: is it possible to run Java code on Zeppelin Notebook?


 Thanks and Regards,
------------------------------ ---
Md. Rezaul Karim 
PhD Researcher, Insight Centre for Data Analytics 
National University of Ireland Galway
E-mail: rezaul.ka...@insight-centre.or g
Web: www.insight-centre.org
Phone: +353892311519


______________________________ ______________________________ _The information 
contained in this communication is intended solely for the use of the 
individual or entity to whom it is addressed and others authorized to receive 
it. It may contain confidential or legally privileged information. If you are 
not the intended recipient you are hereby notified that any disclosure, 
copying, distribution or taking any action in reliance on the contents of this 
information is strictly prohibited and may be unlawful. If you have received 
this communication in error, please notify us immediately by responding to this 
email and then delete it from your system. The firm is neither liable for the 
proper and complete transmission of the information contained in this 
communication nor for any delay in its receipt.





   

Reply via email to