You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

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