Simple API call test in Visual Studio 2010 C++ can not find jvm.dll

Hello!

I started experimenting with the start-up of a Java program in C++ of the Interior program, wrote my code in Visual Studio 2010.

I use the latest code, that I could find:

< code >
#include < jni.h >

(...)

/ * indicates a virtual Java machine * /.
Machine Java virtual * jvm;

/ * pointer to the method native interface * /.
JNIEnv * env;

/ * Initialization JDK/JRE 6 VM arguments * /.
JavaVMInitArgs vm_args;

JavaVMOption options = new JavaVMOption [1];

".optionString options [0] = «-Djava.class.path=/usr/lib/java;

vm_args.version = JNI_VERSION_1_6;
vm_args.nOptions = 1;
vm_args.options = options;
vm_args.ignoreUnrecognized = false;

/ * load and initialize a virtual Java machine, return a JNI interface pointer in env * /.
JNI_CreateJavaVM (& jvm, (void *) & env, & vm_args);

remove options;

/ * call the method Main.test using the JNI * /.
JClass cls = env-> FindClass ("Main");
jmethodID mid = env-> GetStaticMethodID (cls, 'test', '(I) V');
env-> CallStaticVoidMethod (cls, mid, 100);

/ * We're done. */
virtual machine Java-> DestroyJavaVM();
< code >

In visual studio, make sure that:
* In the window of directories in VC ++, which includes the path 'directories Include:
C:\Program Files\Java\jdk1.6.0_24\include\win32
C:\Program Files\Java\jdk1.6.0_24\include

* Only the path of "Library directories" includes:
C:\Program Files\Java\jdk1.6.0_24\lib

* In the window of the linker to entry the path "Additional Dependencies" includes:
C:\Program Files\Java\jdk1.6.0_24\lib\jvm.lib

When you try to run the compiled executable, I get the following message:

"The program can't start because jvm.dll is missing on your computer. Try reinstalling the program to fix this problem. »

If I copy the jvm.dll in the same path as my executable, this does not happen, but I guess that this is not the right way to get there!

I tried to add the path "C:\Program Files\Java\jdk1.6.0_24\jre\bin\client" for the Win 7 path system, as well as in the path of directories executables directories of VC ++, but it does not work.

What would be the right way to ensure that my executable is jvm.dll?

Thank you!

Edited by: 841148 March 2, 2011 09:27

I tried to add the path "C:\Program Files\Java\jdk1.6.0_24\jre\bin\client" for the Win 7 path system, as well as in the path of directories executables directories of VC ++, but it does not work.

Myself I have not found much success with the env vars update unless I reboot (although log out then in could do.)

Tags: Java

Similar Questions

  • just upgraded to windows 2010 and can not find a way to get to the top of my game of spider solitaire

    I don't know how to download and access windows 2010 Games

    It just shows how dumb can use computers sometimes!  lol I meant windows 7!   And I thought about it... but thanks for the laughs!

  • Compiling with Visual Studio 2010 beta

    Hello

    I know that only Visual Studio 2005 is supported for the Acrobat SDK kit. But maybe one of you is also experimenting with visual Studio 2010 and got to work.

    I get the following error message. Anyone solves this problem.

    Error error 105 MSB3073: the command "if not"¬roSDKPIDir %"has ==" "has if not exist"% ¬roSDKPIDir"mkdir"% ¬roSDKPIDir""»»
    If not "% ¬roSDKPIDir' a ==" "a 'C:\Users\test\Documents\Visual Studio 2010\Projects\EPapers_Button\EPapers_Button\Debug\EPapers_Button.dll' copy '% ¬roSDKPIDir'"»
    If not "¬roSDKPIDir %" == «"echo EPapers_Button copied to '% ¬roSDKPIDir'.»
    If '% ¬roSDKPIDir' == ""echo not executed. " No value of the AcroSDKPIDir environment variable.

    ': VCEnd ' came out with code 255.

    Thanks for your help.

    I think that you should disable this type of Vista security.  Or you run VS "Run as Administrator".

  • Unit test, Visual Studio 2010 digital input read event

    Hello!

    I have problems in Visual Studio 2010, using NOR-DAQmx, but ONLY in a unit test project. I have compiled a dll that uses a DigitalChangeDetection task handler. The dll work very well in a draft standard form, but does not work in a Test project.

    I used .NET Framework 4.0 with success. Tried to switch to .NET framework 3.5, but it is not possible for a test project in Visual Studio 2010.

    When I start my test, it works fine until the event is raised. Once he does, the test will stop without exception or detail except the following result:

    "The agent process was stopped during the execution of the test."

    Nothing is caught in the trap in debugging.

    Also, I get the following in the Event Viewer error message:

    Log name: Application
    Source: VSTTExecution
    Date: 2010-12-01 11:32:31
    Event ID: 0
    Task category: no
    Level: error
    Keywords: Classic
    User: n/a
    Computer: xxx
    Description:
    The description for event ID 0 in source VSTTExecution is not found. Either the component that triggers this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

    If the event is on another computer, the display information had to be saved with the event.

    The following information has been included in the event:

    (devenv.exe, PID 5592, walk on 73) OutOfProcessStrategy.ProcessMonitorThread: The Agent process was closed unexpectedly. will attempt to restart

    the message resource is present, but the message is not in the string/message table

    The event XML:
    http://schemas.Microsoft.com/win/2004/08/events/event">
     
       
        0
        2
        0
        0 x 80000000000000
       
        10312
        Application
        xxx
       
     

     
        (devenv.exe, PID 5592, walk on 73) OutOfProcessStrategy.ProcessMonitorThread: The Agent process was closed unexpectedly. will attempt to restart
     

    I understand that Visual Studio 2010 is not yet officially supported so here's my 2 questions:

    -I'm the only one experiencing this problem? (Easily duplicated by taking the sample project: DotNET3.5\Digital\Read Values\ReadDigChan_ChangeDetection_Events and extract the relevent part of to put in a separate dll so that you can try to UnitTest in a project UnitTest.)

    -Update on what NOR-DAQmx will rely on VS2010? (I read here: http://forums.ni.com/t5/Measurement-Studio-for-NET/Support-for-Visual-Basic-2010-NET-4-Framework/m-p... this is supposed to be before the end of the year, but no updates would be great because I could not find any information on it)

    Best regards

    Pierre-Luc

    Hello Pierre,.

    As NOR-DAQmx is not yet officially supported in Visual Studio 2010, it is not quite clear why this problem occur. At this point, the official release date has not been announced yet, however, please continue to check the updates to www.ni.com/support (drivers and updates). Thank you

    Best regards

    M Ali

    Technical sales engineer

    National Instruments

    www.NI.com/support

  • Target platform by default the value of Visual Studio 2010

    In Visual Studio 2010, how can I set the default target platform for new projects to x 86? For some models, which already seems the case, but for example for the class library Visual Basic, the default value is Any Cpu and even can not be changed.

    Where I can centrally define that all projects should be directed to the x 86 platform?

    This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)
    *
  • Call the library function does not find the DLL in the directory where are my LLBs

    I'm using LabVIEW 8.6.  I have a set of screws in several LLBs.  All LLBs located in a directory.  Most of my screws is wrappers for the functions in a DLL.  I was told to put my DLL in the directory where are the LLBs, and apparently this is how the previous programmer has worked (using an earlier version of LabView).

    In the configuration of the library call, I've specified .dll without path.  (This is how we want our screws are an API that will integrate other programmers, so I don't know where they put things and I can't use absolute paths).

    When I insert the VIs in LabVIEW, LabVIEW can not find the DLL and wonder of spotted.  It's just that here in the directory with the LLBs and when I double click on it, everything works fine.  However my absolute path to the DLL now appears in the library to call configuration, and we don't want that.

    Does anyone know how to make this work?  I guess the location of the screw (or LLBs, in this case) should be the current directory and thus Windows search there for the DLL.  However, it seems that this is not the case (in the least, in the latest version of LabVIEW).

    Thank you.

    Batya

    Well someone using your library should not have to dig into your screws and do it all on his own. Instead your library must wrap that and hide disorders it altogether.

    The cluster of error has been added when the dynamic path option has been added. It is not useful hide this error output, so it's always there. As well as the dynamic path, there was the improved error handling added the CLN. One of them is that the level of verification when calling function errors (exception handling) can be specified. I guess that some of these options may generate an error code instead of bring up a dialog box, as they did before and that the output of error code can be useful even in the case of static calls.

    As to what you want to do, I would have long managed that with a DLL that has essentially the same functions as your other wrapper DLLs and an initiliasation function that returns a pointer to a structure of functional distribution based on the actual DLL you want to call. Quite like what an object-oriented function dispatch table is. Then, when your interface initilising you call initialize function and specify the device interface/type that you want to use and after that all other functions take a pointer extra function parameter expedition as the first parameter, in addition to the parameters of the real function. This dispatch function pointer would be just a pointer to a structure that contains the table of function for this interface pointers and the sake of LabVIEW would simply be an integer of size pointer.

    The wrapper function then checks the pointer structure validity send feature and call the actual function with the remaining parameters. It is a C programming and may require a planning and desigining the different interfaces to facilitate this kind of technique of the expedition, but it will certainly pay to long-term and make your library even can be used in previous versions of LabVIEW, so that VB etc. without delicate dynamic loading in the level high, programming environment.

    Rolf Kalbermatter

  • I get the blue screen error after installation of Visual Studio 2010 Professional Test Edition. Help?

    A brief overview of ALALA situation and how it happened:

    1. I went to microsoft.com and download Microsoft Visual Studio 2010 Professional Trial Edition

    2. I opted to use the Installer web pro (4.3 MB) and it correctly installed, restarted and completed the installation.

    3. I opened one of my previous Visual Studio 2008 Solutions and it prompted me to convert the solution.

    4. it is the solution converted successfully and open well.

    But now for some reason any my computer started to give me a blue screen. It forces the computer to restart, and then it connects back with errors:

    "The system has recovered from a serious error, a log of this error has been created"

    "Error signature".

    BCCode: 1000007f BCP1: 00000008 BCP2: BA348D70 BCP3: 00000000

    "BCP4: 00000000 OSVer: 5_1_2600 SP: 3_0 product: 256_1.

    "The following files should be included in this error report:
    C:\DOCUME~1\DSmith1\LOCALS~1\Temp\\WER81ad.dir00\Mini10311-04.dmp

    C:\DCUME~1\DSmith1\LOCALS~1\Temp\\WER81.ad.dir00\sysdata. XML ".

    It's about every 30 minutes now. It only started after installing Visual Studio. Any help?

    Hello

    You can check this link:

    General causes of errors "STOP 0x0000007F"

    http://support.Microsoft.com/kb/137539

  • DAQmx QAnywhere (Visual Studio 2010/Windows 7)

    Hello

    I'm under Visual Studio 2010/Windows 7 and I installed the software driver OR DAQmx 9.2.2. The installer doesn't install the .NET API reference, even though I checked it in the Installer (it creates a dead link). How to access the reference of the .NET API? It is available online?

    This page answered my question of VS2003, VS2005 and VS2008, but what about VS2010?

    Hi mola.

    Visual Studio 2010 support added in NOR-DAQmx 9.2.3, so I expect to install a copy of the API reference that works with VS2010. However, to develop programs DAQmx with VS2010, so perhaps you need to one of the workarounds described in this thread: VS2010 crashes with BSOD when target framework changes

    Brad

  • Visual Studio 2010 Express hangs after Windows Update

    June 11, 2010, I have 19 updates from Windows Update for my Windows XP Home SP3 Swedish (exceptionally many using the computer every day). After I rebooted, Visual Studio 2010 Express crashed at startup saying "(défini par l'utilisateur point d'arrêt-un point d'arrêt dans une application indique erreur de programme)." Re - installation of VS) did not help. Being run/scannow CFS does not report a problem any. Run the program in WinDbg, the program stops at a breakpoint in ntdll.dll. However, if I then go into the debugger program seems to operate normally. Also authorized the virus program Norton Internet Security (NIS) fails on startup with breakpoint in ntdll.dll. This should indicate that there was a problem with ntdll.dll, but all the tests that I ran to the DLL files are all problems. Other programs on the computer seem to work normally, including AVG 9.0 free virus checker, I installed to compensate for the NIS. NIS experts spent several hours in my computer without finding the reason. All clever out there who can help me?

    The problem is solved!

    I run the SDK Direct-X (latest version) in Debug mode and when I changed the retail fashion problems disappeared. Since there is no problem with Debug mode, before the updates of Windows, I guess that these updates were not compatible with debugging DLLs in the SDK. MS has probably forgotten to test in Debug mode or something. Instead however, annoying because the Debug mode is useful during the development of applications of DX.

  • How can I create a Windows using NOR-DAQmx application in Visual Studio 2010 64-bit

    Hello

    How can I create a Windows using NOR-DAQmx application in Visual Studio 2010 64-bit?

    I'm transferring a 32-bit application on 64-bit.  In visual Studio, I added the 64-bit project configuration.  He compiled the source very well but the reports link errors:

    error LNK2019: unresolved external symbol DAQmxReadAnalogF64 referenced in function NI6008_AnalogInput NI_6281\NI6281.obj
    error LNK2019: unresolved external symbol DAQmxCreateAIVoltageChan referenced in function NI6008_AnalogInput NI_6281\NI6281.obj
    error LNK2019: unresolved external symbol DAQmxReadDigitalLines referenced in function NI6008_DigitalInput NI_6281\NI6281.obj
    error LNK2019: unresolved external symbol DAQmxCreateDIChan referenced in function NI6008_DigitalInput NI_6281\NI6281.obj
    error LNK2019: unresolved external symbol DAQmxWriteDigitalLines referenced in function NI6008_DigitalOutput NI_6281\NI6281.obj
    error LNK2019: unresolved external symbol DAQmxCreateDOChan referenced in function NI6008_DigitalOutput NI_6281\NI6281.obj

    These, of course, are the functions OR that I use.  The NIDAQmx.lib has been added to the Input of the link property.

    Any help would be appreciated.

    Thank you

    -Neil shore

    Hi LaserShore,

    Think you that you added the 64-bit platform settings target according to this page? : http://zone.ni.com/reference/en-XX/help/372636F-01/mstudiowebhelp/html/64bitcore/

    Already running 32-bit application? Have you changed references to the 64-bit version?

    You use Measurement Studio? If so some features are not supported with 64 bit.

    Also when you say that you have added the NIDAQmx.lib, did you follow this KB:http://digital.ni.com/public.nsf/allkb/38F67B28D995C6958625706E000C580C

  • An error occurred when creating a project in Visual Studio 2010 &amp; 2012 CVI

    While creating a VS2010 project, with CVI 2012 installation. I get this error after attempting to convert or create a project of the CVI. The CVI dialog box has also no details.

    The error is going on after the installation of SP1 for Visual Studio 2010

  • Microsoft Visual Studio 2010, cannot install

    I can't install visual studio 2010 on pc may. What I would do to this error?

    Hello

    Visual Studio is not supported in these forums. Please instead of asking your question in the relevant Microsoft forum here:

    Visual Studio forums   (on MSDN)

    Hope that helps.

  • Unable to connect to Visual Studio 2010 with patch SP1 & GDR TSF.

    We're trying to access collection server TFS 2013 from Visual Studio 2010 (with patches SP1 & RDA recommended by MS supports), but get error below.

    \

    First of all, we had problems with the application of SP1 & GDR patch, by MS supports, we repaired the v & re-installed these patches worked well. But after that we are gettign above error.

    can someone please tell how to fix this?

    Thank you!

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.msdn.Microsoft.com/forums/en-us/home

  • Problem with Visual Studio 2010, c# and SQL Server

    Several years ago, I programmed in Fortran. In order to get my stack of punch cards to run, I needed a couple of cards that said to the central computer what to do; It was very difficult to get this information as if it were some sort of secret. Today, I am using Visual Studio 2010, and programming in c#. It seems to work OK, but when I try to create a situation of SQL, I find that Windows authentication does not work; If I connect as long as administrator, I can see the database administrator; If I sign my name, I don't see a database created under my name, so that Windows authentication does not work. It seems that I need to know this little piece of information that nobody wants to tell me. I would like to work with an application that I'm developing, but if I can't trust him, I can't use it. I need seamless connections and unequivocal. Help!

    Hello

    It is not a community forum for Visual Studio.

    Try the Visual Studio forums.

    http://social.msdn.Microsoft.com/forums/en-us/category/VisualStudio

    Don

  • How to run XsdObjectGen in Visual Studio 2010?

    I have some classes that were generated with XsdObjectGen in Visual Studio 2005. Now, we're heading Visual Studio 2010.

    Does anyone know how to run XsdObjectGen in Visual Studio 2010?

    If Visual Studio 2010 does not support this tool, what is the replacement tool? But the generated XML classes must be the same, because we have other classes and third party requests for reference for the classes and the XML files generated by XsdObjectGen in 2005 VS.

    Thank you very much in advance.

    Hello

    The question you posted would be better suited in the TechNet Forums for problems of Visual studio. I would recommend posting your query in the TechNet Forums.

    Hope this helps

Maybe you are looking for