Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2005

Tip: Looking for answers? Try searching our database.

problem linking java virtual machine...

Thread view: 
enantiomer - 11 Mar 2005 23:52 GMT
 I am trying to get JNI to work from my C++ based application.
Starting from the very most basic, i am just trying to create an
instance of the JVM in my main program.  Below is the code in main.

JavaVMOption options[1];
JNIEnv *env;
JavaVM *jvm;
JavaVMInitArgs vm_args;
long status;
jclass cls;
jmethodID mid;
jobject obj;

options[0].optionString = "-Djava.class.path=.";
memset(&vm_args, 0, sizeof(vm_args));
vm_args.version = JNI_VERSION_1_4;
vm_args.nOptions = 1;
vm_args.options = options;
status = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);

I got the code from a website that had some examples.  I added the
reference to the jni.h header and when i added the link to the
application within my VC++ 6.0 project with the path like
C:\j2sdk1.4.2_02\lib\jvm.lib.  the problem i am noticing is that when i
try to run the application, I get an erro that says "This applicaiton
has failed to start because jvm.dll was not found..." I am assuming
that the jvm.lib file links to the jvm.dll file, but I am not sure
exactly how to make VC++ see this.  Any ideas?  Thanks,

Jonathan
Owen Jacobson - 12 Mar 2005 05:23 GMT
> I got the code from a website that had some examples.  I added the
> reference to the jni.h header and when i added the link to the application
[quoted text clipped - 4 lines]
> jvm.lib file links to the jvm.dll file, but I am not sure exactly how to
> make VC++ see this.  Any ideas?  Thanks,

In order to run an application, all of its code must be visible.  For
Windows DLLs, this means the DLL must be either in the same directory as
the executable, in the working directory, or somewhere on the PATH.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.