Questions tagged [java-interop]
44 questions
3
votes
1 answer
How do I pass a Java function a String[] argument?
I have a function in Java that I would like to call from Clojure. The particular prototype is the following:
public MyClass create(String aaa, File bbb, String[] args)
I therefore need to pass a String[] as a parameter, from a Clojure function.…

nha
- 17,623
- 13
- 87
- 133
3
votes
2 answers
Clojure's :gen-class and double arrays
I am attempting to :gen-class a fn which takes a 2D array of Doubles as input. I have already seen the post and solution here concerning a similar topic, but I am still unable to produce a working solution.
(ns gui.heatmap
(:gen-class
:name…

cryptic_star
- 1,863
- 3
- 26
- 47
3
votes
2 answers
Why does HashMap.get not return a nullable type?
I was a bit surprised that the following example throws a NullPointerException:
fun main(args: Array) {
val hm = HashMap()
hm.put("alice", 42)
val x = hm.get("bob")
println(x) // BOOM
}
I thought there are no…

fredoverflow
- 256,549
- 94
- 388
- 662
3
votes
2 answers
When you extend a Java class in Clojure and define a method of the same name as one in that class, what is happening?
I've been reading through Programming Clojure, and I've been having some trouble understanding Stuarts primary Java Interop example. He extends DefaultHandler, and creates a startElement method, and then passes that handler to an XML parser. What I…

Rayne
- 31,473
- 17
- 86
- 101
2
votes
1 answer
Can I use Java Core libraries in Ceylon M1 Newton?
I've downloaded the Ceylon SDK and try to play a little bit, but after a while I realize of this:
...
SDK
At this time, the only module available is the language module
ceylon.language, included in the…

OscarRyz
- 196,001
- 113
- 385
- 569
2
votes
1 answer
Call Java method from .Net
I've to call a java method from a C# .Net concole application.
The solution at the following link
Process myProcess = new Process();
Process.StartInfo.UseShellExecute = false;
myProcess.StartInfo.FileName = "java";
myProcess.StartInfo.Arguments =…

C. Fabiani
- 129
- 2
- 12
2
votes
1 answer
Calling Java from Scala: protected constructor
This compiles without error on Scala 2.8.0 final:
import javax.swing.tree.TreePath
object A extends Application {
val path1 = new TreePath()
val path2 = new TreePath(path1, "foo")
}
However, on execution I get:
java.lang.IllegalAccessError:…

Matt R
- 9,892
- 10
- 50
- 83
2
votes
2 answers
MPXJ in .NET converting java Date to .NET DateTime
I'm using the MPXJ library in .NET for parsing MS Project (MPP) files, and it's working great. The one issue I'm having is trying to translate the task Start and Finish date into .NET DateTime to use with my data models.
I am going through all the…

Jeff Treuting
- 13,910
- 8
- 36
- 47
1
vote
0 answers
Not able to call Java class via Karate."org.graalvm.polyglot.PolyglotExcepti1on: TypeError: Access to host class is not allowed or does not exist."
I am trying to call a Java class which has two methods in it. But the execution fails in the below line.
`* def javademo = Java.type('feature.AuthCode')
Error:
* def javademo = Java.type('feature.AuthCode')
js failed:
>>>>
01:…

reshma
- 11
- 1
1
vote
0 answers
Unable to access java method having arguments using java interop in karate (methods with no arguments are accessed fine)
This is my Java Class (for the sake of simplicity, omitting few obvious details)
package com.abc.hstools.core.services;
import com.abc.hstools.core.css.MatchListResponse;
public class ConsumptionSportsService {
//constructor with…

RD96
- 11
- 1
1
vote
1 answer
Using javascript datetime in clojurescript
I want to show date and time in Clojurescript, but anything I tried did not work.
Can anyone help with an example? I tried to use JavaScript datatime in different syntax ways, but none of them worked.
Thank you.
Update
I tired these but they did not…

niloofar
- 2,244
- 5
- 23
- 44
1
vote
0 answers
Using custom java class in karate feature file
I have a user defined java class with a static method, in a classpath directory under src/test/java
package com.latch.configPackage;
public class base64Tohex {
public static void converter(String[] args) {
String guid =…

mnc
- 13
- 1
- 4
1
vote
1 answer
Clojure: gen-class and import it in java; packages, paths, classpaths
I want to call Clojure code compiled to a class from Java.
Clojure class:
(ns clj.core)
(gen-class
:name de.wt.TestClj
:state state
:init init
:prefix "-"
:main false
:methods [[setValue [String] void]
[getValue [] String]])
(defn…

waechtertroll
- 607
- 3
- 17
1
vote
1 answer
How to override properties of java classes in Kotlin?
Somewhere in Java code there is a class ViewHolder:
public static abstract class ViewHolder {
public final View itemView;
public ViewHolder(View itemView) { this.itemView = itemView; }
....
}
So in Kotlin instances of this class contain…

netimen
- 4,199
- 6
- 41
- 65
1
vote
1 answer
proxygen throws System.NullReferenceException
I want to use a dll file in our java application, I am using jni4net, when i tried to create proxy for our Dll it throws
System.NullReferenceException: Object reference not set to an instance of an object.
at…
user1220590