|
OK so trying to read memory address 0 indicates you have an uninitialized pointer. Check your code to see where your pointers are set up. More specifically check the code where you are calling FindClass() and ensure that your name parameter actually points to something.
It's time for a new signature.
|
|
|
|
|
Hey Richard,
Here in 'FindClass(this, name)' name parameter is pointing to some value but 'this' pointer is pointing to 0x00000000.
Plzz help........
|
|
|
|
|
ravi120486 wrote: Plzz help.
You will need to show some of your code, both Java and C for me to have any possibility of seeing how you are getting to this point.
BTW please don't rely to your own messages as I don't get a notification of the update.
It's time for a new signature.
|
|
|
|
|
I am not posting the entire code,Tell me if its sufficient
Following is my Code:
int MyAPI(Parameters* Params, int i) {
.
.
.
JNIEnv *env;
JavaVM *jvm;
JavaVMInitArgs vm_args;
char clspath[400]="-Djava.class.path=";
resCheckVM = JNI_GetCreatedJavaVMs(&jvm, bufLen, &nVMs);
if( resCheckVM < 0 || nVMs < 1 )
{
.
.
.
JNI_GetDefaultJavaVMInitArgs(&vm_args);
fflush(stdout);
res = JNI_CreateJavaVM(&jvm,(void**)&env,&vm_args);
if (res < 0)
fprintf(stderr, "Failed to Create JVM.\n");
}
else
{
fflush(stdout);
res = (jvm)->AttachCurrentThread((void**)&env, NULL);
if (res < 0)
fprintf(stderr, "Failed attaching current thread to JVM.\n");
}
cls = (env)->FindClass(Params[i].lib);
if (cls == 0)
{
fprintf(stderr, "Can't find Prog class \n",Params[i].lib);
return 1;
}
{
fprintf(stderr, "Can't find function \n");
return 1;
}
.
.
.
return 0;
}
Here I am getting this message "Failed to Create JVM."
Then a run time error at FindClass(Params[i].lib).
|
|
|
|
|
ravi120486 wrote: Here I am getting this message "Failed to Create JVM."
Well, I don't think anything will work after this. If you have not managed to instantiate the JVM then your application should die as there is nothing further it can do.
It's time for a new signature.
|
|
|
|
|
Hey Richard,
Can u tell me the reasons why JVM creation might have failed , so that i can loook for it .
Regards,
Ravi
|
|
|
|
|
You should check the JNI error code returned from your call to JNI_CreateJavaVM() ; I would also check the values of your input parameters prior to the call to ensure all are correct.
It's time for a new signature.
|
|
|
|
|
Ravi,
I have been doing some more testing and figure that some of your code is not needed and some needs correcting.
- The call to
JNI_GetCreatedJavaVMs() will never succeed as you do not have any created VMs at that point. Also this call is not used in newer versions so can be removed. - The call to
JNI_GetDefaultJavaVMInitArgs() is no longer necessary and does not serve any purpose. - Before calling
JNI_CreateJavaVM() you need to initialize your vm_args structure with the correct values as described here[^]
It's time for a new signature.
|
|
|
|
|
Dear all,
I need to implement a javascript function that triggers an AJAX refresh request every 2 seconds in JSF page.
thnx
|
|
|
|
|
Did you know java and javascript are different?
And why do you need to refresh using it?
There is a simple and very easy way to refresh a page, irispective of the server implimentation:
<HEAD>
[... stuff ...]
<META HTTP-EQUIV="Refresh" CONTENT = 2>
</HEAD>
<BODY>
[... stuff ...]
</BODY>
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
Dear all,
i need to refresh ONLY part of a jsf page using AJAX every 2 seconds
e.g.: facebook notifications
|
|
|
|
|
Did you try searching Google for "jsf ajax"? There are a lot of articles and tutorials showing you how to use AJAX with JSF.
Or there is IceFaces which is a JSF-AJAX library although that may be a bit OTT for you if this is just a very simple requirement.
|
|
|
|
|
This is a Java forum and Javascript is different cup of coffee!
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
Hello Friends
One of my java application is using around 70MB when I checked through Task Manager.I tried to monitor through java profiler then there it is showing 4MB Heap memory and 64Mb non Heap Memory.
And In actual application is not taking this much memory So i want to reduce this memroy consumption.
Any Ideas Guys.
Thanks & Regards
Yogesh
|
|
|
|
|
This isn't a particulary large amount of memory, but then it depends on the app. If it's HelloWorld then it's way too much, if it's a word clone then you're doing well.
Seriously, check that you are not duplicating objects, two references to the same object uses less memory than two instances. Don't hold objects once they are no longer needed. Do you have a collection of objects that are rarely used, maybe you can optimise there by only holding in memory what is used.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
Thanks A Lot Mr.Nagy For ur valuable time to my answer.
Regards
Yogesh
|
|
|
|
|
Hello,
I need to determine that whether given file is a class file or not? Perhaps I may change the extension to .exe/.xml or some other . I need to dtermine that given file if a class file will be parsed differently and if it would be some other, it'll be parsed in that manner.
How can we determine by reading class file format if, How can we read programatically class file format?
Regards
Usman
|
|
|
|
|
What are you trying to do exactly ? What is the reason why you want to do something like that ?
Are you talking about .java files ?
glitteringsound wrote: How can we read programatically class file format?
A class loader does that for you.
|
|
|
|
|
I need to just read and parse programatically Java class file header. So that I can determine weather its class file or not. I need that one to determine in my case. Possibly not in usual cases but just in my case.
|
|
|
|
|
glitteringsound wrote: I need to just read and parse programatically Java class file header.
What do you mean by header ?
But you still didn't answer my question, you merely repeated your first post: what is the reason why you want to do something like that ? Your request seems really akward, so it would help a lot to understand your question if you provide the context.
|
|
|
|
|
Respectfully
Sir,
I am working on app (kind of framework) which parse and extract function signatures and populate them on GUI. This needs to be first determine weather given file is a class file, Win32 File or COM Exe/DLL, Js or HTML file.(As in my case these all files can be made as input to framework by the user). This needs to parse given file format (probably headers)first to determine whether given file is within above mentioned context or not.?
Regards
Usman
|
|
|
|
|
glitteringsound wrote: I am working on app (kind of framework) which parse and extract function signatures and populate them on GUI.
Are the classes loaded in your application ? If yes, it would be much easier to use reflection to extract the information about the classes and methods (you won't need to do the parsing yourself, which is not an easy job).
glitteringsound wrote: This needs to parse given file format (probably headers)first to determine whether given file is within above mentioned context or not.?
A class file is just a text file, so there's no "header" (like for instance in a binary file) containing info about the file. You could check the extension though (it should be .java).
|
|
|
|
|
|
A simple Google search found this[^] document containing all the detail you need?
It's time for a new signature.
|
|
|
|
|
Hello Friends
I want to install java on client machine if it is not installed through applet tag.I did through object tag but same I want to do through Applet tag.
Here is Object Tag:
<object id="viewer" classid="clsid:CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA"
codebase="http://java.sun.com/update/1.6.0/jinstall-6-fcs-windows-i586.cab"
width=360
height=557 >
<param name="code" value="org.jdesktop.applet.util.JNLPAppletLauncher" >
<param name="archive" value="http://download.java.net/media/applet-launcher/applet-launcher.jar,
This code automatically installs java but I want to do same through applet tag.I made some changes but it is not asking user to install.here is applet tag and please let me know wat do i need to change to install java?
Applet tag:
<applet
code="print_canvas3d.PrintCanvas3D "
codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-win.cab"
width=360
height=557
archive="http://www.styku.com/wer.jar,
http://download.java.net/media/applet-launcher/applet-launcher.jar,
And one more prob is If I provide class name directly in code=pkg.classname then it is giving me right Id but If i use JNLPAppletLauncher at the same place then I am getting the Id of jnlpLaunched that I dont want ,I want the id of mine main class.How can i get?
Thanks & Regards
Yogesh
|
|
|
|