Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [java]

Questions about interfacing Mathematica and Java, particularly using J/Link.

2
votes
1answer
34 views

Missing ticks and numbers on a plot when using JLink + Mathematica 11.3

I am facing a pretty random problem using JLink (Java) connected to a Mathematica 11.3 kernel and front-end. Basically I want to get an image using the JLink Java method ...
3
votes
1answer
120 views

Is there any way that convert entire mathematica code to java or python?

I am novice to Mathematica. I want to convert Mathematica code from my textbook to Java or Python to trace coding.
2
votes
1answer
56 views

Convert a Java object to interface via J/Link

I'm trying to use a Java library called CDK with Mathematica's J/Link. ...
11
votes
1answer
231 views

Using ImageJ filters directly from Mathematica through J/Link

tl;dr I am looking for a short but complete example that shows how to apply an ImageJ filter to a Mathematica Image through J/Link. Fiji/ImageJ is one of the ...
1
vote
0answers
87 views

Lock cursor position to mouse

I would like to lock the cursor position, i.e. the insertion point, to the current position of the mouse at all times in a given notebook. An experiment with J/Link approximates this, by repeatedly ...
9
votes
1answer
113 views

How to launch a separate Java VM on each sub-Kernel?

I have some code that process very large flat files in to separate HSQL(Standalone) databases using ParallelSubmit and JDBC for each file using the strategy in this post (19542). Lately I keep ...
5
votes
1answer
87 views

Incorrect number or type of argument when using Jlink to call setAccessible

I am trying to use Java reflection to access stateVector from the following package: ...
5
votes
1answer
172 views

Update Java used by Mathematica 10

I would like to update the Java version used by Mathmematica 10 from 1.7.x to 1.8.x/ Is it possible without installing Mathematica 11? I have the latest Java on my system, but Mathematica 10 uses an ...
1
vote
0answers
82 views

Is there a way to know how much Java heap space to set?

I have already set it to be 4GB. Needs["JLink`"] ReinstallJava[JVMArguments -> "-Xmx4096m"] However, when exporting a dataset to Excel sheet, I still get the ...
4
votes
2answers
130 views

J/Link HMAC Base64

I am trying to recreate a Java algorithm in Mathematica. It is taking a key and signing a message using the HMAC and SHA256 algorithm. The Java code for which I am basing it off is here I have ...
0
votes
0answers
86 views

How to save Image or Graphics in Terminal? [duplicate]

In my Linux computer,it can't save Image or Graphics to picture format such as ...
2
votes
0answers
99 views

System.Out.println in JLink does not flush to

I am playing with JLink in Mathematica. I created a simple Java(Kotlin) Class HelloKT like this: ...
0
votes
1answer
29 views

Need J/Link values returned in 1D instead of 2D format (i.e., not exponents, fractions, on multiple lines)

The following code shows how default KernelLink values are sent back to Java in 2D text form. Which becomes a heap-big mess in an array of exponential values, since all the exponents are printed first ...
1
vote
1answer
173 views

Trying to run J/Link SampleProgram.java from Mac Terminal: Exception in thread “main”

Trying to run the [WSTP J/Link SampleProgram.java][1] Mathematica version 11.0.1.0 file from the MacOS Sierra version 10.12.6 Terminal, generates "Exception in thread "main" ... Updating to Oracle ...
3
votes
1answer
209 views

What does it mean that GUIkit is being deprecated?

What is the disadvantage of using GUIKit now? What does it mean that it is being deprecated? Will it be removed from Mathematica in some later versions?
3
votes
1answer
58 views

Failed to load JLink in consecutive antcall's

I'm using Ant script in Eclipse using Workbench on Windows 7. I've used multiple versions but the issue persists. Essentially, I define multiple targets and call them in sequence like this: Multiple ...
6
votes
1answer
115 views

J/Link stealing focus from the Front End on OS X. Workaround?

Link to Wolfram Community version Calling getDefaultToolkit() through J/Link causes the Front End to lose focus. This is specific to OS X. Here is a minimal ...
3
votes
0answers
50 views

How to temporarily turn off log messages?

I'm using GUIKit in Mathematica 11.0, which throws an error message whenever a window or panel is shown. I know GUIKit is deprecated but I don't want to port a whole project to the newer controls. ...
2
votes
1answer
114 views

How to get the image in the clipboard with a J/Link method?

The Paste will not give a return,just print the content of clipboard.It is hard to asign the result to a variable.I make a .NET method here to get the image in ...
2
votes
0answers
461 views

How to lock a socket or create a queue for requests?

I try to implement sockets from java.net.ServerSocket in Mathematica. I execute this code step by step: Needs["JLink`"] InstallJava[] (* LinkObject[..] *) ...
4
votes
1answer
164 views

When using Java objects through JLink, how can I multitask the objects?

I use Mathematica 11.0.1 on Windows 10 and have a Java class which acts as a 'facade' for a headless browser (PhantomJS). In Mathematica I instantiate the class through JLink as follows: ...
1
vote
0answers
48 views

Instant detection of digital or analogue variation of a variable with Mathematica in Windows 8.1

I am using an assembly that contains two acquisition board (PCI-1742U-AE and PCIE-1816H-AE) and an external circuit, connected to boards. The computer uses Windows 8.1, and the communication is done ...
1
vote
0answers
51 views

Creating an automatic code feedback for class

I'm trying to create a server application that accepts uploaded Mathematica files (that follow a certain API), then run a few tests on modules defined within those files. This is for a course where ...
0
votes
2answers
109 views

Clearing the JavaClassPath at Runtime in JLink

I am trying to access a remote MongoDB database through Mathematica using JLink. The connection is fine, but my installation of Mathematica 10.0 seems to contain an SLF4J logger addon, which prints ...
3
votes
0answers
76 views

Failure connecting JLink with Android Studio -Java application

I want to connect an android application with Mathematica, in order to make some computations and then return the results to the user. I have downloaded Mathmatika and run the Examples from JLink ...
7
votes
1answer
444 views

How to create keypress simulation program?

Main Problem I'm trying to create a widely applicable keypress simulation program, but I don't know how to use Java so I can only search for Q&As on the site, which is inefficient. So I want to ...
2
votes
1answer
75 views

What does the function StartJava do? [closed]

In Mathematica's autocomplete list, the function StartJava appeared. I searched the mathematica's reference site and found that the function was undocumented. What does it do?
15
votes
2answers
963 views

Implementing Local HTTP Server

How might I implement a local HTTP server using either Java, C#, C or purely Mathematica? It should be able to respond with Mathematica input to GET and POST requests ideally on W7. This is related ...
3
votes
0answers
88 views

What is the appropriate way to handle JVM memory issues in a Mathematica package?

I maintain a large Mathematica package (here) that, for certain operations, calls out to a Java library (here). The details of the libraries are not important, but I've come across a frustration with ...
2
votes
1answer
1k views

How to fix a “Java failed to load class” when using custom Java class using JLink?

I have a Java project compiled into a jar file with a class called HttpClientSSO. The commandline java -cp bota.jar org.nilostep.bota.HttpClientSSO executes ...
3
votes
1answer
136 views

How to stop running Java?

<< JLink`; InstallJava[]; Clear[serverSocket, socket]; serverSocket = JavaNew["java.net.ServerSocket", 12345]; socket = serverSocket@accept[]; If I enter ...
3
votes
0answers
44 views

Can JLink return a structured object?

What I want to achieve seems obvious but I cannot figure it out: I need to find a way that when I send an expression to be evaluated from a Java back end to a Mathematica kernel, I can live with it ...
0
votes
0answers
77 views

Popup window shows after kernel closed when using J/Link

A popup window always show after kernelLink.close(); And this only happen after expression evaluated as graph. Such as ...
3
votes
1answer
261 views

How could get all escape characters in Mathematica?

I am evaluating expression by using KernelLink. But the kernel will be suspended endless when meets a invalid escape character. ...
11
votes
0answers
701 views

How to bundle JLink with Java application using apache maven

The context: I am planning to visualize some results from my MMA code using D3.js. So I wanted to make a simple REST api using the light weight SparkJava framework. Given my fairly nonexistent ...
1
vote
0answers
42 views

MathCanvas.setMathCommand behaving badly and I have no Idea how to debug

For my first attempt to call Mathematica from Java, I got the GraphicsApp sample program working, then defined a package with a function called "metric" and made sure that that package works when ...
3
votes
0answers
66 views

Java anonymous functions from JLink?

JLink is really great to act on Java objects and access Java static methods. I'm asking myself if there would be a way to have access to a more recent Java syntax that allows anonymous functions, ...
6
votes
0answers
148 views

Echo server with Mathematica

Consider the following scenario: two wireless notebooks communicating via ad hoc one computer (the client) send packets via TCP protocol without Mathematica the other one is an echo server ...
10
votes
1answer
224 views

Converting text from unsupported encodings like 866 into known by Mathematica?

The list of character encodings currently supported by Mathematica is still extremely limited. For example, it supports only three standard IBM PC (OEM) code pages: ...
1
vote
1answer
70 views

can CDFDeploy command work via JLink

I tried the following command in notebook. It creates a .cdf file. ...
2
votes
0answers
354 views

How to run existing mathematica nb from Java

I have the Mathematica notebook (Test.nb in this case), how can I run in from Java? So far I have the following code. If I type: ...
3
votes
0answers
114 views

Showing Mathematica's dynamic UI in external Java programs

I want to run Mathematica from an external Java program and display an interactive app in my own Jpanel. Is it possible? When I tried using MathGraphicsJpanel, I am getting only the snapshot of the ...
12
votes
1answer
205 views

Using Java log4j in Mathematica

Someone has a code example of how log4j can be used to create logs in Mathematica? RLink uses it, as can be checked in ...
3
votes
1answer
377 views

Problem trying to compile JLink application

I have no trouble compiling and running the sample Java to Mathematica program SampleProgram.java that can be found in the Wolfram installation: ...
2
votes
1answer
105 views

What is the Java converter?

I notice that there is a directory: C:\Program Files\Wolfram Research\Mathematica\10.2\SystemFiles\Converters\Java. What is this? I could not find any documentation ...
10
votes
1answer
343 views

Fast way to pass an array of integers to Java using JLink

I am using a package from java to compress a list of integers, this package provide me two methods, one for compress and other one for uncompress. Each of these methods has a version to ...
2
votes
1answer
345 views

Can I use Mathematica Online kernel to evaluate expressions from java on my PC?

I know it's possible to evaluate expressions using Mathematica kernel that's on my computer using J/Link. Is it possible to do the same but use the remote kernel that my Mathematica Online uses?
1
vote
0answers
210 views

Awkward DatabaseLink JDBC Error [closed]

I've created a GUI application (a database editor) that uses DatabaseLink and it is currently working fine on my PC (M10.02, Windows 7) and on a clients's PC (CDF Player Pro 10.02, Windiws 8). While ...
4
votes
1answer
82 views

InstallJava on a parallel kernel while debugging in Wolfram Workbench

Here's my problem. I need to create a link between a client that is a parallel Wolfram kernel and a server through a Java API. I'm using Wolfram Workbench in debugging mode (like most of the time ...