• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help me please! Can't find class message.  RSS feed

 
Svitlana Dukhovna
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
 
Stephen Huey
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.
 
Jay Kipler
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!