This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Class path problem Help please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Class path problem Help please" Watch "Class path problem Help please" New topic
Author

Class path problem Help please

Nitin Bhagwat
Ranch Hand

Joined: Sep 09, 2004
Posts: 132
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");
}
}
}


"Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
Max Rahder
Ranch Hand

Joined: Nov 06, 2000
Posts: 177
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 ]
 
 
subject: Class path problem Help please
 
Similar Threads
javac: no classpath found
package & classpath I am lost !
Problem running program with packages
Packages and Executables
Package