Hi guys, my computer needed to be reinstalled and then i downloaded jdk1.2.2 .I saved the file Say.java in c:\java .when i try to compile i'm getting the following error: error:can't read: Say.java could it be something with setting the PATH and CLASSPATH ? Any help will be appreciated. Thanks, Elizabeth.
The error msg: error:can't read: Say.java when compiling is most likely caused because your PATH is not correct. You should check both the PATH and CLASSPATH and make sure they have the same dir names for your JDK1.2 and where you keep your source. - error:can't read: SomeClass.java (is usually a PATH problem). - Exception in thread "main" java.lang.NoClassDefFoundError: Someclass/java (is usually a CLASSPATH problem). The above assumes you typed the class's name correctly to begin with. Also it would help everyone if you would tell them what OS you are using. Hope this helps
posted 19 years ago
Thanks to both of you. i'm working on windows 95.i set the CLASSPATH as c:\java & did'nt know what to do with the PATH variable.could you pl tell me how to set those two variables thru the DOS prompt. Thanks, Elizabeth.
posted 19 years ago
In your autoexec.bat use: SET PATH==%PATH%;C:\your_jdk_version;C:\your_jdk_version\bin;c:\where_your_java_sources_is SET CLASSPATH=c:\where_your_java_sources_is\;.; where your_jdk_version = what ever the directory name is for your jdk. Note: I have found that if you use the default dir when installing the JDK for jdk1.1+ it makes life easier when dealing with the classpath because you only have to put where you keep you source and tell it to look in the local dir, that's the ;.; part. For example my path and classpath are as follows: SET PATH=%PATH%;C:\jdk1.3;C:\jdk1.3\bin;D:\my_java SET CLASSPATH=D:\My_Java\;.; You can see your current setting by entering: c:>set This will show you all your current settings. After you have updated your autexec.bat you will need to reboot for the new setting. Good luck. [This message has been edited by Richard Boren (edited June 05, 2001).]