• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in thread "main" java.lang....  RSS feed

 
Jacob James
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\pt\jtsc\dd\source\TgF\Tester>java Tester
Exception in thread "main" java.lang.NoClassDefFoundError: Tester (wrong name: TgF/Tester/Tester)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

After trying to settle with the classpaths I have encountered this new problem. I have set all my class paths as well as I can, and now the program compiles alright. But this is the latest problem on the front. Any help??

I've already tried to set the -cp through the systems console in Control Panel, I've created a classpath variable, in which I have placed the necessary lib jar files. I don't know what else to do now?

Please...any assist
[ June 15, 2004: Message edited by: J Js ]
 
Greg T Robertson
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without seeing your classpath settings or your package declaration for your class I'm gonna go out on a limb and say that you should actually do this:

C:\pt\jtsc\dd\source>java TgF.Tester.Tester

I believe that you probably have a package declaraion of TGF.Tester in your class but don't know that for a fact. If this doesn't work please post your package declaration and classpath.
 
Jacob James
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Greg

So that worked...:-D thank you

But now I've come up with another problem. Hopefully I'd explain this better. I have created a JAR file, which operates on a database platform program. This is located in a different directory to the main java and class files.

Directory of the Testing Program to run the DBP program:

C:\CRT

in which I've stored my test.jar which I made from the java class files for the Testing.

I used this as you said to create my test.jar
C:\pt\jtsc\dd\source\TgF\ <--directory where my java files are stored, there are subdirectories in this like the tester sub such as
C:\pt\jtsc\dd\source\TgF\Tester

My header and package importations for the main file (which begins the whole testing)teststarter.java is:

package TgF;
import TgF.biq.XML.*;
import TgF.TestThreads.*;
import TgF.Tester.*;
import TgF.OutputGenerator.*;
import TgF.Helpers.DateGenerator;
import java.io.*;
import java.util.Vector;
import java.util.Hashtable;

My header and package importations for the sub file Tester is :

package TgF.Tester;
import java.io.*;
import java.beans.XMLEncoder;
import java.beans.XMLDecoder;
import java.util.Vector;
import org.xml.sax.*;
import TgF.OutputGenerator.WrongTypeException;

But now I'm getting the following exceptions when I try to run this jar file which I created using
jar cvfm name.jar manifest.txt TgF

My Environment variables and classpaths are as such (which I've defined in the control panel)
C:\j2sdk1.4.2_04\bin;C:\j2sdk1.4.2_04\lib\tools.jar;C:\j2sdk1.4.2_04\lib\dt.jar;C:\j2sdk1.4.2_04\lib\rt.jar;C:\jdk1.1.8\bin;C:\crt\test.jar


The error I now get when I run the Test program is this

C:\crt>java -jar test.jar test.xml ON
Exception in thread "main" java.lang.NoClassDefFoundError: TgF/Test
er/Tester
at TgF.TestStarter.<init>(TestStarter.java:45)
at TgF.TestStarter.main(TestStarter.java:421)

C:\crt>pause -1
Press any key to continue . . .

These error lines are just lines calling the method Tester from TestStarter

m_Tester = new TgF.Tester.Tester();
and
TestStarter objTest = new TestStarter();

Please someone help me find a solution to this problem.

Thanks for the help in advance :-)
[ June 17, 2004: Message edited by: J Js ]
 
Jacob James
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pls any help would be appreciated...
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!