Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 779549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:56:37+00:00 2026-05-14T19:56:37+00:00

The setup I have is I’m using a Java application to call native C-code

  • 0

The setup I have is I’m using a Java application to call native C-code with JNI, which in turn starts up the MATLAB runtime and calls functions on it (I know there are other solutions to call MATLAB methods from Java).

The problem is that the MATLAB engine crashes at some point during the initialization and I don’t know what’s causing it exactly. The crash causes my jvm to terminate, I assume it’s some kind of memory corruption.

The C++ code calling MATLAB functions that is actually crashing is

JNIEXPORT void JNICALL 
some_jni_vodoo_initializeLibrary(JNIEnv* env, jclass thisClass) {
  try {
      if (!mclInitializeApplication(NULL, 0)) {
          THROW_EXCEPTION(env, "Could not initialize the application properly.");
          return;
      }
      if (!<library>Initialize()) {
          THROW_EXCEPTION(env, "Could not initialize the library.");
          return;
      }
    } ...

The function <library>Initialize() crashes here, the Java error log reads

Stack Trace:
  [0] jmi.dll:0x793f4175(0x7934cdca, 1, 0x7937e67c "à;.y`E.y@E.ychar in C:\BUILD_ARE..", 0x792d6a32)
  [1] jvm.dll:0x792df9a5(0xc0000005, 0x79356791, 0x4961b400 "Ð\8y", 0x6d8b29de)
  [2] jvm.dll:0x792e0431(0x8b515008, 0x70f0e8ce, 0x8b5ffffa, 0xc25d5ec6)

------------------------------------------------------------------------
        Fatal Java Exception detected at Fri Apr 30 11:08:08 2010
------------------------------------------------------------------------

Configuration:
  MATLAB Version:   7.8.0.347 (R2009a)
  MATLAB License:   unknown
  Operating System: Microsoft Windows Vista
  Window System:    Version 6.0 (Build 6002: Service Pack 2)
  Processor ID:     x86 Family 6 Model 10 Stepping 5, GenuineIntel
  Virtual Machine:  Java is not enabled
  Default Encoding:  windows-1252

Java is not enabled

I really have no idea what could be wrong. Is there not enough memory from the jvm? I guess the problem is somehow related to Java, since calling the JNI functions from a simple test C++ program works fine…

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T19:56:38+00:00Added an answer on May 14, 2026 at 7:56 pm

    Initial Ideas

    The only similar thing I’ve ever seen is a silent exit from MATLAB due to an invalid license.

    Another possibility is the nested Java environments. Since MATLAB expects its own Java environment, perhaps there is some problem here. Edit: See below!

    Are you running the MATLAB Engine? Or are you calling separate MATLAB commands using some “system” or “exec” call? This might give a good clue.


    Answer

    The answer appears below in the comments. It is copied here for readability:

    When nesting an invocation of MATLAB’s engine in a process that has its own JVM, you must either tell MATLAB to run without a JVM by passing -nojvm to mclInitializeApplication or tell it which JVM to use by setting the global MATLAB_JAVA to the location of the JVM you wish to use, C:\Program Files\Java\jre6 for example.

    The first option will disable any functionality in MATLAB that requires the JVM, so the second option is preferable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have setup a simple test project for the EF 4.1 RC, using Code-First
I have setup a java servlet which accepts parameters from the URL and have
Setup : I have a Struts web application where I use displaytag elements to
I have setup ability for a user to specify some settings using the in-built
SETUP : I have this app which has 4 activities in a linear path,
I have setup Knockoutjs to dynamically create an editable list of values using the
I have setup memcached (unix socket) for my django application. However it seems that
Setup Have you ever had the experience of going into a piece of code
I have setup url routing in my ASP.NET 4 project, which works perfectly offline.
I have setup a build configuration in TFS2010 with MSBuild arguments to deploy using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.