File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling Java from clojure

 
Gayathri kopparapu
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 290
9
Clojure Linux Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to provide a lot more detail than that!

At least show us your code.
 
Gayathri kopparapu
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 290
9
Clojure Linux Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to print the 'result'...how can i print it
 
Sean Corfield
Ranch Hand
Posts: 290
9
Clojure Linux Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
returns the Object.
returns the result of calling method on the Object.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic