• 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

JMK MAKE

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
>
>
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
LOOK! OVER THERE! (yoink) your tiny ad is now my tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic