Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2 Questions - I'm Really At A Loss!

 
Gary Farms
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below is my program Access.java which resides in c:\java.
It generates a "NoClassDefFoundError" when I run it. I have No idea why. Also, I've always had to put a package statement
at the top of all my .java files. Otherwise, they will compile, but won't run. To run Access.java, I compile it, then copy
Access.class to c:\com\gfarms\geometry then run it at c:\java
by doing java com.gfarms.geometry.Access
My 2 questions are:
1. Why do I get this "NoClassDefFoundError" when I run Acces.java?
2. What is wrong with my classpath, that requires me to put a package statement in all my .java files?
Anyway, here's my path and classpath statements in c:\autoexec.bat
path=c:\windows;c:\windows\command;c:\jdk1.3.0_02\bin;c:\java\;
set classpath=c:\jdk1.3.0_02\lib;c:\java\;
Finally, here's my c:\java\Access.java program that blows up:
//Access.java
package com.gfarms.geometry;
class Other
{
public void fnc(String b)
{
int y = 10;
System.out.println("string received = " + b);
System.out.println("y = " + y);
}
}
public class Access
{
public static void main(String[] args)
{
Other a = new Other();
a.fnc("Gary Farms");
}
}
Any help to my 2 above questions would be deeply appreciated!
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gary I answered this in beginner. PLEASE do not cross post.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic