This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes package problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package problem" Watch "package problem" New topic

package problem

jawwad ahmed
Ranch Hand

Joined: Dec 01, 2001
Posts: 179
Well i am making a simple program
package chatting;
public class Test
public static void main(String args[])
where chatting is stored in
and jdk1.3 is installed in
i set path like
c:\chatting:>set path=c:\jdk1.3\bin
it compiles well but give the following exception when run.
Exception in thread "main"
java.lang.NoClassDefFoundError: Test (wrong name: cha
Please tell whats wrong.
Arun Boraiah
Ranch Hand

Joined: Nov 28, 2001
Posts: 233
one way to run this class be in the c prompt. and give
java chatting.Test
it works.

Sharing is learning
jawwad ahmed
Ranch Hand

Joined: Dec 01, 2001
Posts: 179
well there is still problem giving following exception
Exception in thread "main" java.lang.NoClassDefFoundError: Test/java
Please tell.
Rob Ross

Joined: Jan 07, 2002
Posts: 2205
The PATH is just so your command shell can locate the java.exe binary.
You need to set your classpath variable.
java -classpath C:\ chatting.Test
note the space between the "C:\" and "chatting.Test"
[ February 18, 2002: Message edited by: Rob Ross ]

SCJP 1.4
Bhushan Jawle
Ranch Hand

Joined: Nov 22, 2001
Posts: 249
Or try running it as "java chatting/Test" from "C:\" if you don't want to set classpath.
It must work.
I agree. Here's the link:
subject: package problem
It's not a secret anymore!