This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Clojure and the fly likes Calling Java from clojure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » Clojure
Bookmark "Calling Java from clojure" Watch "Calling Java from clojure" New topic
Author

Calling Java from clojure

Gayathri kopparapu
Greenhorn

Joined: Nov 07, 2013
Posts: 11
Hi Everyone,

I am calling my defined java class from clojure file which will return a integer value
But , I am getting the proper integer value

Ex: I am returning '12345' from java,
when i call the file from clojure , I am getting "namespace_of_java_file@141cd01"

Please help me
Sean Corfield
Ranch Hand

Joined: Feb 09, 2011
Posts: 252
    
    5

You'll need to provide a lot more detail than that!

At least show us your code.
Gayathri kopparapu
Greenhorn

Joined: Nov 07, 2013
Posts: 11
This is the sample code
clojure file ::
(defn send-to-geolocation-touchpoint [id services {:keys [code]}]
(log :info (str "inside the send-to-location-touchpoint"))
(let [body (doto (MainSample.)
(.myResult code))]
body)

java file::
public class MainSample {
public Map myResult(final String Cdoe,final String Id){

Logger LOG = Logger.getLogger(MainSample.class);
Map result=null;
try{
result.put("area_code",Cdoe);
result.put("id",Id);
return result;}
catch (Exception e){
System.out.println(e);
}
return result;
}
}
Sean Corfield
Ranch Hand

Joined: Feb 09, 2011
Posts: 252
    
    5

Your function returns the MainSample object - body - so if you print that you'll get what you are seeing. So there's no error here.

What are you trying to do?
Gayathri kopparapu
Greenhorn

Joined: Nov 07, 2013
Posts: 11
I am trying to print the 'result'...how can i print it
Sean Corfield
Ranch Hand

Joined: Feb 09, 2011
Posts: 252
    
    5

returns the Object.
returns the result of calling method on the Object.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling Java from clojure
 
Similar Threads
retunring value from main()?
Calling Clojure from Java code
Clojure question
Performance and Scalability
JEE Enterprise Market scenario and Clojure