Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMK MAKE

 
Tina Pinnock
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I recently downloaded JMK MAKE to use with "Thinking in Java." It organizes files. If anyone is using it I'd appreciate hearing from you. One of the sample programs from the book won't run.
When I compiled the program Assignment.java from
> chapter three (c03) of Thinking In Java, a new folder
> is automatically created in the directory and named
> c03. In this folder is the Assignment.class. This is
> the command I use:
> c:\j2sdk1.4.0_01\MySourceCode>javac -d
> /j2sdk1.4.0_01/MyByteCode Assignment.java
>
>
> When I try to run the program with the command
> c:\j2sdk1.4.0_01\MyByteCode>java Assignment, I get the
> following error:
>
> Exception in thread "main"
> java.lang.NoClassDefFoundError: Assignment
>
> or within the folder c03
>
> c:\j2sdk1.4.0_01\MyByteCode\c03>java Assignment
>
> Exception in thread "main"
> java.lang.NoClassDefFoundError: Assignment (wrong
> name c03/Assignment)
>
> Do you have any idea why the program cannot find
> Assignment.class? Could the JMK MAKE file be
> affecting this?
>
>
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tina_synergy,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe you imported some stuff and you need to set the classpath for the VM. Or you defined your code
in a package, so it is important to call it like this:
java com.test.MyApplication
 
Tina Pinnock
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I'm trying that but still getting an "Exception in thread "main" java.lang. NoClassDefFoundError: com/test/Assignment"
The system replaces the dots with those forward slashes.
P.S. Just returned from a week-long road trip thoughout eastern U.S.A. that's why I'm reply just now.
 
Marilyn de Queiroz
Sheriff
Posts: 9065
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

> c:\j2sdk1.4.0_01\MyByteCode\c03>java Assignment
>
> Exception in thread "main"
> java.lang.NoClassDefFoundError: Assignment (wrong name c03/Assignment)

I see no package or import statements in this code.

Usually when I get an error like this it is because I have the class file in more than one directory. Make sure that the only "Assignment.class" file you have is in the c:\j2sdk1.4.0_01\MyByteCode\c03 directory. Then go to the c:\j2sdk1.4.0_01\MyByteCode\c03 directory and type "java Assignment"
 
Tina Pinnock
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your combined assistance.
I modified the code to include the following:
//: c03:Assignment.java
package c03;
Then I called it with this command statement:
C:\j2sdk1.4.0_01\MyByteCode>java c03.Assignment
It worked.
Appreciate your help. Tina
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic