10 Replies - 417 Views - Last Post: 19 February 2012 - 06:15 PM Rate Topic: -----

#1 Lara84  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 29
  • Joined: 15-February 12

error with java

Posted 19 February 2012 - 04:04 PM

Hi,
I have used "jedit" to run java programming,It have worked well but yesterday I have downloaded eclipse and I have connected mysql with java using JDBC.but now nethier jedit nor eclipse work well.when I compile any program they work well but they give me an runtime error which is " Exception in thread main java.lang.NoclassDefoundError "
I might have a problem with user and system environment

thanks in advance
Is This A Good Question/Topic? 0
  • +

Replies To: error with java

#2 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2651
  • View blog
  • Posts: 11,182
  • Joined: 20-September 08

Re: error with java

Posted 19 February 2012 - 04:16 PM

Please post the full error message
Was This Post Helpful? 0
  • +
  • -

#3 Lara84  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 29
  • Joined: 15-February 12

Re: error with java

Posted 19 February 2012 - 04:22 PM

Exception in thread "main" java.lang.NoClassDefFoundError:Test 
press any key to countinue..


it gave me the same error even those programs that it has run properly before..
Was This Post Helpful? 0
  • +
  • -

#4 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2651
  • View blog
  • Posts: 11,182
  • Joined: 20-September 08

Re: error with java

Posted 19 February 2012 - 04:26 PM

If you have automatic build disabled try rebuilding the code
Was This Post Helpful? 0
  • +
  • -

#5 Lara84  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 29
  • Joined: 15-February 12

Re: error with java

Posted 19 February 2012 - 04:28 PM

could you give me further explanation,actually,I dont know what do you mean because I am new in programming..
thanks
Was This Post Helpful? 0
  • +
  • -

#6 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2651
  • View blog
  • Posts: 11,182
  • Joined: 20-September 08

Re: error with java

Posted 19 February 2012 - 04:31 PM

I would do something like this: http://eclipsetutori...albeginner.html
Was This Post Helpful? 0
  • +
  • -

#7 Lara84  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 29
  • Joined: 15-February 12

Re: error with java

Posted 19 February 2012 - 05:30 PM

here is full error message:
Exception in thread "main" java.lang.NoClassDefFoundError:MyClass
caused by:java.lang.classNotFoundException:MyClass
at java.net.URLClassLoader$1.run(Unknown sourse)
at java.security.AccessCountroller.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown sourse)
at java.lang.ClassLoader.loadClass(Unknown sourse)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown sourse)
at java.lang.ClassLoader.loadClass(Unknown sourse)
could not find the main class:Myclass.program will exit

Was This Post Helpful? 0
  • +
  • -

#8 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1817
  • View blog
  • Posts: 4,625
  • Joined: 14-March 10

Re: error with java

Posted 19 February 2012 - 05:34 PM

Can you post your code please?
This problem means it cant find the main class. Make sure for the following:
- Your file has the same name as your class. If your class name is MyClass, then file name will be MyClass.java

- Your main() method is in the same public class which you are trying to run.

- You are running the correct class
Was This Post Helpful? 0
  • +
  • -

#9 Lara84  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 29
  • Joined: 15-February 12

Re: error with java

Posted 19 February 2012 - 05:43 PM

Yes everything is all right since i have installed eclipse and connection with JDBC this error happen I can not run even my old programs.when I tried to download eclipse I have changed my JDK from 32-bit to 64-bit but Iam not sure this bring me to this problem or not
Was This Post Helpful? 0
  • +
  • -

#10 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1817
  • View blog
  • Posts: 4,625
  • Joined: 14-March 10

Re: error with java

Posted 19 February 2012 - 05:47 PM

So you need to set the main class in your Eclipse, I use netBeans so dont know where you can find that feature in eclipse, but there is one where you can set the main class for the project
Was This Post Helpful? 0
  • +
  • -

#11 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2651
  • View blog
  • Posts: 11,182
  • Joined: 20-September 08

Re: error with java

Posted 19 February 2012 - 06:15 PM

Set the main class in Run configuration under the Run menu
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1