• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

my java file is not running

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I in stalled jdk1.3.0_02 on my win98.and my file is in c:\jdk1.3.0_02\bin;
I set the path as c:\jdk1.3.0_02\bin
and the classpath as c:\jdk1.3.0_02
and it's compiling fine.but when i try to run it iam getting
Exception in thread "main" java.lang.NoClassDefFoundError: Hello1 (wrong name: h
ello1)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:11
1)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)

what might be the problem?Do i need to install jre separately.
so,
how to solve this problem?
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try setting up your classpath like this:
classpath = c:\jdk1.3.0_02\lib;.
Notice the inclusion of the lib directory before the semicolon. Also, the period '.' after the semicolon means the current directory that your in. You could just as well type in the current directory instead of using the period, but both will work for DOS and UNIX.
You could also set the classpath from the command prompt when you run the java program, like this:
java -classpath c:\jdk1.3.0_02\lib;. Hello1
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is cAsE sEnSiTiVe
You are running Hello1, but your class file is actually hello1
I've never run across that before. I didn't think about Windows' case-insensitivity fouling up the java command. I would have thought it would error out before main(). That is, it would immediately say something like class not found, and not have such a large stack trace.

Learn something new all the time!
 
krishna akula
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did set the classpath as
classpath = c:\jdk1.3.0_02\lib;.
and also as
java -classpath c:\jdk1.3.0_02\lib;. Hello1
but still same result.
what is the solution
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look........................................................................\/..........................\/
Exception in thread "main" java.lang.NoClassDefFoundError:Hello1 (wrong name: hello1)
< insert grumble about variable-width fonts >
[This message has been edited by Mike Curwen (edited March 30, 2001).]
[This message has been edited by Mike Curwen (edited March 30, 2001).]
 
krishna akula
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
o.k. i got it.let us go to the next problem.
iam trying to compile other Hello12 program in the same directory bin.but while compiling it's showing
cannot read :Hello12.java.
i don't know what is happening.the file is getting stored as a textfile and not as a java file.
 
Ranch Hand
Posts: 782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to save your files like this:
"Hello12.java"
You need the quotes or else windows will automatically convert it to a txt file.
 
krishna akula
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic