* Cannot load class.
@ 2009-10-09 6:01 abhishek desai
2009-10-09 6:26 ` abhishek desai
0 siblings, 1 reply; 2+ messages in thread
From: abhishek desai @ 2009-10-09 6:01 UTC (permalink / raw)
To: java
Hi
I am have a c++ file startup.cpp which tries to load a class com.abc.HelloWorld.
The program is shown below.
void _Jv_RunMain (jclass klass, const char *name, int argc, const
char **argv, bool is_jar);
int main(int argc, const char **argv)
{
JvVMInitArgs vm_args;
bool jar_mode = false;
vm_args.options = NULL;
vm_args.nOptions = 0;
vm_args.ignoreUnrecognized = true;
using namespace java::lang;
try
{
_Jv_RunMain( &vm_args, NULL, "com.abc.HelloWolrd", argc - 1,
(char const**) (argv + 1) , false);
}
catch (Throwable *t)
{
System::err->println(JvNewStringLatin1("Unhandled Java exception:"));
t->printStackTrace();
}
}
I have compiled this program and put it in directory xyz
The hello world program is as below.
package com.abc;
public class HelloWorld
{
public static void main(String args[])
{
System.out.println("Inside HelloWorld main.");
}
}
I have compiled this file to a class file and put it in the directory
xyz/com/abc
I change dir to xyz
When I execute the "startup" program, it thows a class not found
exception. When I try to lead the same class using the command "gij
com.abc.HelloWorld" . The class is loaded and its main function is
executed.
what could be wrong ?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Cannot load class.
2009-10-09 6:01 Cannot load class abhishek desai
@ 2009-10-09 6:26 ` abhishek desai
0 siblings, 0 replies; 2+ messages in thread
From: abhishek desai @ 2009-10-09 6:26 UTC (permalink / raw)
To: java
Sorry.. There was a spelling mistake in the class name HelloWolrd
instead of HelloWorld.
On Fri, Oct 9, 2009 at 11:31 AM, abhishek desai <abhi00@gmail.com> wrote:
> Hi
>
> I am have a c++ file startup.cpp which tries to load a class com.abc.HelloWorld.
>
> The program is shown below.
>
> void _Jv_RunMain (jclass klass, const char *name, int argc, const
> char **argv, bool is_jar);
>
>
> int main(int argc, const char **argv)
> {
> JvVMInitArgs vm_args;
> bool jar_mode = false;
> vm_args.options = NULL;
> vm_args.nOptions = 0;
> vm_args.ignoreUnrecognized = true;
>
> using namespace java::lang;
>
> try
> {
> _Jv_RunMain( &vm_args, NULL, "com.abc.HelloWolrd", argc - 1,
> (char const**) (argv + 1) , false);
> }
> catch (Throwable *t)
> {
> System::err->println(JvNewStringLatin1("Unhandled Java exception:"));
> t->printStackTrace();
> }
> }
>
> I have compiled this program and put it in directory xyz
>
> The hello world program is as below.
>
> package com.abc;
>
> public class HelloWorld
> {
> public static void main(String args[])
> {
> System.out.println("Inside HelloWorld main.");
> }
> }
>
> I have compiled this file to a class file and put it in the directory
> xyz/com/abc
>
> I change dir to xyz
> When I execute the "startup" program, it thows a class not found
> exception. When I try to lead the same class using the command "gij
> com.abc.HelloWorld" . The class is loaded and its main function is
> executed.
>
> what could be wrong ?
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-09 6:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-09 6:01 Cannot load class abhishek desai
2009-10-09 6:26 ` abhishek desai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).