NoClassDefFoundError

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

NoClassDefFoundError

Bookie Bookshah
Hi there. I have a project which I am writing in netbeans 4.1, to which I
added the scripting library. Everything works fine when I choose to test-run
the project from within the IDE, the scripts I wrote work, but when I build
the project into a jar file, loads of weird stuff happens.

Firstly, there is an Interpreter object named theInterpreter inside the main
class. Just declaring at the start of the class doesn't do any harm.

class RemoteAdmin
{
import bsh.*;
bsh.Interpreter theInterpreter;

However, changing this to:

bsh.Interpreter theInterpreter = new bsh.Interpreter();

means that the .jar file generated, when run, comes up with an error 'Could
not find main class' and refuses to run at all. If you change this line back
to how it was, and create the object inside some other area of
code(theInterpreter = new Interpreter();), it insists it can't find any
class bsh.Interpreter.

I have no idea what the hell is going on. I think its just that I'm doing
something wrong in netbeans, not including the library properly, but I'm not
sure. I should probably go to the netbeans forum or something, but I just
thought it was worth asking, has anybody else come across stuff like this?

Thanks

_________________________________________________________________
SEEK: Over 80,000 jobs across all industries at Australia's #1 job site.  
http://ninemsn.seek.com.au?hotmail



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError

patniemeyer

On Jul 7, 2005, at 9:02 AM, Bookie Bookshah wrote:

> class RemoteAdmin
> {
> import bsh.*;
> bsh.Interpreter theInterpreter;
>
> However, changing this to:
>
> bsh.Interpreter theInterpreter = new bsh.Interpreter();
>
> means that the .jar file generated, when run, comes up with an  
> error 'Could not find main class' and refuses to run at all. If you  
> change this line back to how it was, and create the object inside  
> some other area of code(theInterpreter = new Interpreter();), it  
> insists it can't find any class bsh.Interpreter.
>
> I have no idea what the hell is going on. I think its just that I'm  
> doing something wrong in netbeans, not including the library  
> properly, but I'm not sure. I should probably go to the netbeans  
> forum or something, but I just thought it was worth asking, has  
> anybody else come across stuff like this?

Hi,

Sorry for the slow reply.  That is very odd.  Where is the bsh-jar  
file installed in your NetBeans installation?  I bet it's got some  
quirks about locating jar files if they are part of its own  
installation.

Please let us know what the resolution was (or if you are still  
experiencing trouble)

thanks,
Pat


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError

Yemi Bedu
In reply to this post by Bookie Bookshah
Bookie Bookshah <dabookshah@...> writes:

>
> Hi there. I have a project which I am writing in netbeans 4.1, to which I
> added the scripting library. Everything works fine when I choose to test-run
> the project from within the IDE, the scripts I wrote work, but when I build
> the project into a jar file, loads of weird stuff happens.
>
> Firstly, there is an Interpreter object named theInterpreter inside the main
> class. Just declaring at the start of the class doesn't do any harm.
>
> class RemoteAdmin
> {
> import bsh.*;
> bsh.Interpreter theInterpreter;
>
> However, changing this to:
>
> bsh.Interpreter theInterpreter = new bsh.Interpreter();
>


Hello,
 So a question would be, how do you try to execute the application outside the
netbeans environment? If you don't set the classpaths right, I can see the
issue. So if the two jars (your app and bsh), then you can use the -cp".;" that
may help. If not, you may want to explicity give the absolute path to each jar
you will use with the application. Good day.

Yemi Bedu



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users