• 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

installing java

 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a JRE 1.4.2 that I'm trying to get to work. It may be some special distribution because it comes with javac.exe. So, I guess that I can compile programs, like this one:

public class Test {
public static void main(String[] args) {
for(int i=0;i<10;i++) System.out.println("This is the number i=" + i);
}
}

When I run "javac Test.java", I don't get any errors, but when I try to run "java Test", I get an error that says:

Exception in thread "main" java.lang.NoClassDefFoundError: Test

What is happening?
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
means java cant find your Test.class file.

This might help you
 
Christopher Arthur
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh yeah...just needed to put the current directory into the classpath. Thanks!
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Christopher.

Check if you are at same directory that this class file (Test.class)

If yes, try to run this command:

java -cp . Test

this work even your environment has a CLASSPATH variable configured to another path.

Regards,

Paulo Lima.
 
No more fooling around. Read this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic