You are not logged in.

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

1

Friday, January 31st 2014, 12:16am

Executing Mathematica functions from Jabaco

Include JLink.jar in your References/classpath.




Import com#wolfram#jlink.*

Public Sub main(ByJava args() As String)
Dim myArgs() As String
myArgs = args

Dim ml As KernelLink = Null
Dim nResult As Integer = 0
Dim sJLinkDir As String = ""
Dim sKernelLinkArguments As String = ""

sJLinkDir = "c:\Program Files\Wolfram Research\Mathematica\9.0\SystemFiles\Links\JLink"

System.setProperty( "com.wolfram.jlink.libdir", sJLinkDir )

sKernelLinkArguments = "-linkmode launch -linkname 'C:\Program Files\Wolfram Research\Mathematica\9.0\MathKernel.exe'"

ml = com#wolfram#jlink#MathLinkFactory.createKernelLink( sKernelLinkArguments )

ml.discardAnswer()
ml.evaluate( "3 + 5" )
ml.waitForAnswer()
nResult = ml.getInteger()

Debug().Print( nResult )

nResult = nResult


End Sub

Rate this thread
WoltLab Burning Board