Questions tagged [java-interop]
44 questions
1
vote
1 answer
Maintain file permissions while unzipping in clojure
I want to unzip files from a zip package which can have text, executable files in it. I have figured out way using Java interop to unzip the contents of the file at given location.
However, after everthing's unzipped at given locations, I am not…

celeritas
- 398
- 1
- 4
- 16
1
vote
2 answers
Kotlin: double colon (reflection) operator over
So I was working with VertX Web, trying to make it work with Kotlin.
There's a router and you have to say something like
val vertx = Vertx.vertx()
val server = vertx.createHttpServer()
val router =…

caeus
- 3,084
- 1
- 22
- 36
1
vote
1 answer
Using Kotlin function as Java SAM type
When calling methods from a Java API that expect SAM (single abstract method) type arguments is there a consistent way to coerce a function literal to the correct type? I'm finding that sometimes Kotlin functions work just fine and others not…

Rob Fletcher
- 8,317
- 4
- 31
- 40
1
vote
1 answer
Using Stanford Core NLP in PHP?
In Ruby, there is this this nice Stanford Core NLP integration gem which simply acts as a bridge to the JVM version. In Python, there is this one, which while slightly more complicated, appears to do basically the same thing.
Does anyone know if…

Giuseppe
- 73
- 1
- 10
1
vote
1 answer
Having trouble calling getCodeBase in Clojure
I'm trying to write a function to play a sound file once, using some resources I found. The code is as follows:
(defn play [file]
(let [songp (URL. (.getCodeBase) file)
song (.newAudioClip songp)]
(. song play)))
The problem is,…

Rayne
- 31,473
- 17
- 86
- 101
1
vote
2 answers
Implementing Interfaces and calling Java Constants in Clojure (Newbie)
I am trying to write a wrapper for the google adwords api in Clojure but struggle with constants and Interfaces.
The java code looks like this :
CampaignServiceInterface campaignService =
…

C.A
- 620
- 1
- 11
- 23
0
votes
3 answers
Clojure adding a border to a JPanel and in general accessing java methods in objects
Coming from LISP I am having my most challenging moments when accessing java objects. I am trying to put a titled border on a JPanel. Here is my code and exception:
user=> (import '(javax.swing JComponent JPanel…

logigolf
- 301
- 1
- 3
- 10
0
votes
1 answer
Blazor WebAssembly **Microsoft.JSInterop.JSException** Error: The value 'sessionStorage.length' is not a function
From a basic standpoint what I am trying to do is get a list of keys (key names) from session storage.
The way I am trying to do this is by calling the JsRuntime.InvokeAsync method to:
Get the number of keys in session storage, and
loop thought…

user1433164
- 101
- 8
0
votes
1 answer
clojure -- name conflicts in a defined record?
I have a misbehaving piece of code; when I name a record MethodInfo, it no longer overrides the .toString method correctly.
(defrecord MethodInfo [^clojure.lang.ISeq x ^clojure.lang.ISeq y]
java.lang.Object
(toString [x]
(str (:x…

gatoatigrado
- 16,580
- 18
- 81
- 143
0
votes
2 answers
Can JNBridge be used under linux?
I have to consume some C# dll's under a linux host through java. Rewriting the code is currently not an option, and we can't expose the dll as a service because this linux server will exist in isolation.
Is it possible to generate my "java to .net"…

Shredder
- 3
- 1
0
votes
1 answer
Vert.x Kotlin Type Mismatch required Handler> found (Handler>) -> Unit
The following is a method rewritten in Kotlin from Java:
fun publishMessageSource(
name: String,
address: String,
completionHandler: Handler>
) {
val record = MessageSource.createRecord(name, address)
…

junglie85
- 1,243
- 10
- 30
0
votes
1 answer
Clojure : java interop, why does this code do not work?
I coded a class using Apache Maths (whatever) and I have a weird glitch (or maybe there is a problem in my Java code ?).
here is the code
package distributions;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import…

Joseph Yourine
- 1,301
- 1
- 8
- 18
0
votes
1 answer
Mixing definterface and defprotocol
I try to implement interface representing arithmetic expressions. The interface will be used by java-side but the whole logic is on clojure.
Having:
(defprotocol ExtendsExpression
(toTree [this]))
(extend-type String
ExtendsExpression
(toTree…

Lambder
- 2,953
- 1
- 26
- 20
-1
votes
1 answer
How to resolve "Access to host class is not allowed or does not exist" in Karate
A bit frustrated that can't make this work, as it is simply documented on this link https://github.com/karatelabs/karate#calling-java
Tried to create from scratch using maven archetype and the standalone jar just to make sure its not about folder…

Don
- 163
- 12