• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Help me please! Can't find class message.

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I installed jsdk 1.4.1 long time ago and everything was working fine. I have Windows 98. Recently I was editing my autoexec.bat file, and today I noticed that after I compile my code with javac, when I try to run it with java Classname command, I get a message "Can't find the class Classname".
I always run my java programs in the current directory(directory where they are located) Please help me to figure out what is wrong!
I researched on-line and thought that I should have set my CLASSPATH variable, but it does not make any sense, since I attempt running java programs in my current directory, which should be a default path anyway.
here are the few last lines of my autoexec file( I don't know what I could possible mess up! ):
set PATH=%PATH%;C:\j2sdk1.4.1\bin;
set PATH=%PATH%;C:\unzipped\masm611;
PATH C:\orawin95\bin;"%PATH%"
set JAVA_HOME=C:\j2sdk1.4.1
set CATALINA_HOME=C:\unzipped\jakarta-tomcat-4.1.29\jakarta-tomcat-4.1.29
I added Java_Home and CATALINA_HOME lines a few days ago.
I would highly appreciate any ideas! Thank you everybody!
Svitlana Dukhovna
 
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest you also post at the Sun Java forums.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Svitlana,
what exactly are you typing to run your class? Is your class
in a package? (i.e. is there a line "package ..." in your source?). What
does following command return: "java -version"? And what is the exact
error message you are becoming? What does the following command return:
"set classpath"?
I don't see anything wrong in your autoexec.bat, just the third line
should be "SET PATH=C:\orawin95\bin;%PATH%" (you forgot the set and the "="
here), but this should have no influence on executing a java program.
Generally, you just have to verify that you are setting the classpath
correctly, either with the envrionment variable CLASSPATH or in the command line. The following command will execute a class which is located in
the current directory, if this class is not in a package:
java -classpath . classname
If the class is in a package, then you should put the classname.java
in the dir mypackage, compile with javac mypackage\classname.java and
then type:
java -classpath . mypackage.classname
to run it.
Hope it helps,
J

Originally posted by Svitlana Dukhovna:
Hello,
I installed jsdk 1.4.1 long time ago and everything was working fine. I have Windows 98. Recently I was editing my autoexec.bat file, and today I noticed that after I compile my code with javac, when I try to run it with java Classname command, I get a message "Can't find the class Classname".
I always run my java programs in the current directory(directory where they are located) Please help me to figure out what is wrong!
I researched on-line and thought that I should have set my CLASSPATH variable, but it does not make any sense, since I attempt running java programs in my current directory, which should be a default path anyway.
here are the few last lines of my autoexec file( I don't know what I could possible mess up! ):
set PATH=%PATH%;C:\j2sdk1.4.1\bin;
set PATH=%PATH%;C:\unzipped\masm611;
PATH C:\orawin95\bin;"%PATH%"
set JAVA_HOME=C:\j2sdk1.4.1
set CATALINA_HOME=C:\unzipped\jakarta-tomcat-4.1.29\jakarta-tomcat-4.1.29
I added Java_Home and CATALINA_HOME lines a few days ago.
I would highly appreciate any ideas! Thank you everybody!
Svitlana Dukhovna

 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic