• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Can't find class

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For some reason I had to uninstall/reinstall java on my P.C. - a Windows 98 operating system. It was working fine before, but I installed a different program and I didn't want the Java to be effected by it. I didn't change any of the paths/classpaths. Now the compiler works, and everything compiles fine but when I try running my application I get the message Can't find class *****. What should I do?
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a few questions:
1. what ver of win98
2. what ver of java
3. what is your CLASSPATH
4. what is your PATH
A guess without the above information would be that you are missing. The CLASSPATH current directory reference of ;.;
We are all here to help...
[ November 21, 2002: Message edited by: Monty Ireland ]
 
Amanda Weber
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have window 98 second edition. I am not sure what version. Java 1.2, the path is set to c:\jdk1\bin\ among other things and the classpath is set to c:\jdk1.2\bin;.;
 
Monty Ireland
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting win2000 and win98 confused.
From a dos prompt. Use the set cmd to verify
you PATH and CLASSPATH settings.
I have a few ideas to try...
1. set your CLASSPATH to only ibnclude"."
2. if that fails set you CLASSPATH to include RT.JAR (depending on what version of java you have)
If the above fail... let me know and i will send
you from home tonight my win98 PATH and CLASSPATH settings.
hope this helps...
 
Amanda Weber
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The path does include the classpath. I am not sure about the JAR file. The classpath includes the current directory "."
[ November 21, 2002: Message edited by: Amanda Weber ]
 
Amanda Weber
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting more and more confused with Java
I did some more testing. I was able to compile and run a simple program that has only a main method that has a System.out.println("test"); and that works fine. When I try and add any of java's Classes from any package I get the message "Can't find class Test".
What am I suppose to do to get this to work?!?!?!?
[ November 21, 2002: Message edited by: Amanda Weber ]
 
Monty Ireland
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry i did not get back to you last night.
for i had to deal with the kids.
i know the problems you are having.
I know exactly how you feel.
please send the following information.
1. version of java - c:\java -version
2. copy and paste you autoexec.bat file
3. from a dos prompt get you PATH and CLASSPATH
please send me the above...
and we shall fix your problem over the weekend
 
Amanda Weber
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the version of java is:
1.1.7.31.o
the autoexec is:
@ECHO OFF
REM [Header]
DOSKEY
REM [CD-ROM Drive]
REM [Miscellaneous]
REM [Display]
REM [Sound, MIDI, or Video Capture Card]
REM [Mouse]
rem PATH=C:\PROGRA~1\THINKPAD\HIBERUTL;%PATH%;
rem PATH C:\PROGRA~1\THINKPAD\UTILIT~1;%PATH%;
REM The following line creates the hibernation file.
rem if not exist C:\save2dsk.bin C:\PROGRA~1\THINKPAD\HIBERUTL\phdisk /c /f rem <C:\PROGRA~1\THINKPAD\HIBERUTL\yes
path = C:\jdk1.2\bin;.;"%PATH%"
set path = C:\jdk1.2\bin;.;"%PATH%"
set path=C:\oraforms\jdk\bin;"C:\ProgramFiles\Oracle\jre\1.1.7\bin";"%path%";
set Path=C:\orawin95\bin;"%Path%"
PATH C:\oraforms\bin;"%PATH%"
set classpath = C:\jdk1.2\bin;.;
a dos prompt set:
PATH=C:\jdk1.2\bin;.;"C:\JDK1.2\BIN;.;C:\WINDOWS;C:\WINDOWS;C:\WINDOWS\COMMAND"
PATH = C:\ORAFORMS\BIN;C:\ORAWIN95\BIN;C:\ORAFORMS\JKD\BIN;C ROGRAMFILES\ORACLE\JRE\1.1.7\BIN;C:\JDK1.2\BIN;.;C:\WINDOWS;C:\WINDOWS;C:\COMMAND;
CLASSPATH=C:\JDK1.2;BIN;.;
Thanx so much!!
[ November 23, 2002: Message edited by: Amanda Weber ]
 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I recommend that you NOT have any CLASSPATH environment variable set in Windows. This is likely the source of your problems. The only adjustments that I make to run Java are as follows:
  • Set the JAVA_HOME variable to point to the directory where your JDK is installed, for example, "C:\j2sdk1.4.1_01"
  • Make sure that the Java bin directory ("%JAVA_HOME%\bin") is listed in your PATH variable.

  • I believe that if a CLASSPATH is explicitly named, then the Java environment will limit itself to only what is listed in that CLASSPATH.
    PCS
    DISCLAIMER:
    I have in the past been wrong, and there is a finite likelihood of this being a recurrance.
    [ November 22, 2002: Message edited by: Philip Shanks ]
     
    Amanda Weber
    Greenhorn
    Posts: 28
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I tried deleting the classpath all together. -- That did not help at all. I tried to set JAVA_HOME to = jdk1.2, I THINK I did that correctly, but it still gives me the same error: Can't find Class Test - this happens with any java file that uses any of Java core classes.
    It is O.K., Philip - I am begining to think that my computer is jinxed!! :roll:
    Does anyone else have any advice for me?!?!?!
     
    Author
    Posts: 201
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    We had some classpath problems with W2k at school. We were still able to get java to compile/work but had to do some "round about" ways to do it.
    At home I have had no problems with the class path. I do not touch my environmental variables. I use the path command at the dos prompt. May not be the best way but it works.
     
    Sheriff
    Posts: 9109
    12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    PATH=C:\jdk1.2\bin;.;"C:\JDK1.2\BIN;.;C:\WINDOWS;C:\WINDOWS;C:\WINDOWS\COMMAND"
    PATH = C:\ORAFORMS\BIN;C:\ORAWIN95\BIN;C:\ORAFORMS\JKD\BIN;C:\PROGRAMFILES\ORACLE\JRE\1.1.7\BIN;C:\JDK1.2\BIN;.;C:\WINDOWS;C:\WINDOWS;C:\COMMAND;
    CLASSPATH=C:\JDK1.2;BIN;.;

    I notice you are mixing jdk1.2 with JRE 1.1.7 -- This may cause you some problems since the JRE 1.1.7 may not be able to read some of the 1.2 compiled stuff (which might give you a ClassNotFoundException). Any way to avoid this?

    Also your classpath should point to the subdirectory containing your compiled *.class files, not the jdk1.2\bin subdir.
    [ November 23, 2002: Message edited by: Marilyn de Queiroz ]
     
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    A couple important things to check:
    if you are compiling from the Windows Command Prompt C:\>, the PATH command must be set so that it includes the directory path that contains your compiler programs. (since you say the compiling works OK, it would seem that this functional.)
    Once you have the compiled abcdef.class files, determine the directory path of their location. Java must know this CLASSPATH so that the JAVA Virtual Machine can locate your .class files.
    Perhaps a simple analogy would help: In my house(aka your PC)we have two systems, my wife and I(aka Windows and Java) We each put our socks in different drawers (aka directories). As long as each system puts its socks consistently in the same place, no problem. If my wife wants to find my socks, she would need to have directions to find them. Likewise with the file system, each individual system (Word, Java, DOS, Excel, Netscape, etc.) needs the proper path to locate its files. (Now I've figured out for myself why the hell I can't find my socks!!My wife never tells me where she puts 'em, (IF she puts them!))
    Hope this wasn't too insultingly simple. I've been there, and I know how utterly nerve wracking it can be. Keep us posted.
     
    Amanda Weber
    Greenhorn
    Posts: 28
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Great News Everyone!
    I had some Divine Help from the One Above and I figured it out. Marilyn, Thank you - that was the basic problem. The program I refered to in the very first post installed it's own version of Java, which caused all the confusion.
    Now everything seems to be working
    Thank You!!
    [ November 23, 2002: Message edited by: Amanda Weber ]
     
    Monty Ireland
    Ranch Hand
    Posts: 161
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    better lat than never...
    i agree....
     
    Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
    Gift giving made easy with the permaculture playing cards
    https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
    reply
      Bookmark Topic Watch Topic
    • New Topic