Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Trouble with running java application(ClassNotFoundException)
Trouble with running java application [message #771035] Mon, 26 December 2011 05:03 Go to next message
Donovan Ng
Messages: 3
Registered: December 2011
Location: Singapore
Junior Member
Hi,
I need help with compiling the code in eclipse. I have looked around the web and thought that classpath was the problem and fixed it but i am still getting this error...

Exception in thread "main" java.lang.NoClassDefFoundError: Driver
Caused by: java.lang.ClassNotFoundException: Driver
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)


Can anyone help me understand further what I must do to solve this?
Re: Trouble with running java application [message #771224 is a reply to message #771035] Mon, 26 December 2011 18:04 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkar
Messages: 424
Registered: July 2009
Senior Member
Seems to be a classpath issue to me.
Have you put the required library path in the classpath ?

cheers,
Saurav


Re: Trouble with running java application [message #771444 is a reply to message #771224] Tue, 27 December 2011 09:17 Go to previous messageGo to next message
Donovan Ng
Messages: 3
Registered: December 2011
Location: Singapore
Junior Member
I am using mac to run eclipse. It is different from setting it like Windows.
Is there any reference to configure it on mac platform?

Also I am planning to build its scale in near future, do you suggest I use Ant to prevent from re-specifying from each compilation?
Re: Trouble with running java application [message #771928 is a reply to message #771444] Wed, 28 December 2011 14:55 Go to previous messageGo to next message
Russell Bateman is currently offline Russell Bateman
Messages: 3193
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2011.12.27 2:17, Donovan Ng wrote:
> I am using mac to run eclipse. It is different from setting it like
> Windows.
> Is there any reference to configure it on mac platform?
>
> Also I am planning to build its scale in near future, do you suggest I
> use Ant to prevent from re-specifying from each compilation?

Unless I've misunderstood, what you want to do is add the library (JAR)
containing the symbol that's apparently missing to "the classpath" via
right-clicking your project, choosing Build Path, then the Libraries
tab. It make no difference whether you're running Eclipse on Windows or
Macintosh.
Re: Trouble with running java application [message #772122 is a reply to message #771928] Thu, 29 December 2011 03:26 Go to previous messageGo to next message
Donovan Ng
Messages: 3
Registered: December 2011
Location: Singapore
Junior Member
Hi,
Would like to ask further regarding your post..

If I am missing a specific .class file for eclipse, how would I know which one is missing for me to place it on to eclipse?

Any recommended ways? I apologize as I am don't normally use an IDE to compile my java files. Just wanted to try something new Smile THanks!
Re: Trouble with running java application [message #772332 is a reply to message #772122] Thu, 29 December 2011 14:34 Go to previous message
Russell Bateman is currently offline Russell Bateman
Messages: 3193
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2011.12.28 20:26, Donovan Ng wrote:
> Hi,
> Would like to ask further regarding your post..
>
> If I am missing a specific .class file for eclipse, how would I know
> which one is missing for me to place it on to eclipse?
>
> Any recommended ways? I apologize as I am don't normally use an IDE to
> compile my java files. Just wanted to try something new :) THanks!

Typically, you add .class files to Eclipse projects as JARs via Build
Path. You can hand-copy a .class file to a project, but then you have to
wire things up specially for that as dropping it into a subdirectory
with the .class files created by Eclipse compilation will also subject
it to being deleted, either by Eclipse (not necessarily) or ant (well,
the way I write it would delete it). In any case, it's not a very stable
proposition.

As I don't grok exactly what you're trying to do, nor do I think I've
done what you're doing, it's hard to give experienced or knowledgeable
advice.

Give more details in your reply if you wish to pursue this.

Best,

Russ
Previous Topic:Problem Opening Eclipse
Next Topic:How to create an eclipse install with plugins pre-installed.
Goto Forum:
  


Current Time: Sat Sep 20 10:07:50 GMT 2014

Powered by FUDForum. Page generated in 0.02033 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software