• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class path problem Help please

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am beginner. This may be a simple problem for you.

operating system is Windows 98.
In Autoexec.bat, added tst library in path.

So, path = C:\WINDOWS;C:\PROGRAMFILES\JAVA;C:\TST;
SET CLASSPATH = C:\tst;

After above setting, i rebooted system also tried to run autoexec file from dos prompt.

created directory named tst
created following java file in library named tst and compiled. It compiled fine. Gives me error during running by command Java C:\tst\packex or java packex

I tried to run it from c: root directory, from c:\tst and from java library in all cases, it fails.

I am getting error as 'Exception in thread "main" Java.lang.NoClassDefFoundError: C:\tst\packex'



Please suggest solution so i can run it from any library without specifying directory path.


package tst;

class packex
{
public static void main(String ara[])
{
{
System.out.println("Testing package");
}
}
}
 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your class name isn't "packex" -- it's actually named "tst.packex" because it's in package "tst". Therefore, assuming the class file "C:\tst\packex.class" exists, at the commant prompt you'd navigate to C:\ and run your application via:
java tst.packex
[ September 14, 2004: Message edited by: Max Rahder ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic