This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
My class path is "C:\j2sdk1.4.0\bin;C:\Oracle\Ora81\bin;C:\Program Files\Oracle\jre\1.1.7\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Oracle\Ora81\orb\bin " I can compile *.java successfully, but cant run it.
hello,Dirk I tried your method,but unfortunatelly it failed,the current full path is ".;C:\j2sdk1.4.0\bin;C:\Oracle\Ora81\bin;C:\Program files\Oracle\jre\1.1.7\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Oracle\Ora81\orb\bin " any other idea? I need it urgently for my assignment. thanks for your help
Sometimes, when you have PATH and CLASSPATH problems it's better to "simplify your life". That is, delete the definitions and redefine them carefully considering what you do and not need in the paths. For example, I do not see why you need bin type directories in your CLASSPATH. On most systems I have seen the CLASSPATH consists of lib directories and/or directories holding classes, and/or specific jar files. The current working directory "." may also be needed. The PATH variable is the one normally containing bin directories. Maybe you meant to have C:\j2sdk1.4.0\bin in the PATH (not CLASSPATH)? To repeat: My suggestion is to "start-over", remove CLASSPATH, and carefully analyse what classes and jar files your application needs to function. Sometimes an empty CLASSPATH has fixed problems like yours. [ March 12, 2003: Message edited by: Barry Gaunt ]
Sorry, I cant understand what you mean. What I did was just following up the installation instructions from the Sun website. Here it is: Update the PATH variable You can run the Java 2 SDK without setting the PATH variable, or you can optionally set it as a convenience. Should I set the PATH variable? Set the PATH variable if you want to be able to conveniently run the Java 2 SDK executables (javac.exe, java.exe, javadoc.exe, etc.) from any directory without having to type the full path of the command. If you don't set the PATH variable, you need to specify the full path to the executable every time you run it, such as: C:> \j2sdk1.4.1_<version number>\bin\javac MyClass.java It's useful to set the PATH permanently so it will persist after rebooting. How do I set the PATH permanently? To set the PATH permanently, add the full path of the j2sdk1.4.1_<version number>\bin directory to the PATH variable. Typically this full path looks something like C:\j2sdk1.4.1_<version number>\bin. Set the PATH as follows, according to whether you are on Microsoft Windows NT or 98/2000/ME. Microsoft Windows NT, 2000, and XP - To set the PATH permanently:
Choose Start, Settings, Control Panel, and double-click System. On Microsoft Windows NT, select the Environment tab; on Microsoft Windows 2000 select the Advanced tab and then Environment Variables. Look for "Path" in the User Variables and System Variables. If you're not sure where to add the path, add it to the right end of the "Path" in the User Variables. A typical value for PATH is: C:\j2sdk1.4.1_<version number>\bin Capitalization doesn't matter. Click "Set", "OK" or "Apply". The PATH can be a series of directories separated by semi-colons ( . Microsoft Windows looks for programs in the PATH directories in order, from left to right. You should only have one bin directory for a Java SDK in the path at a time (those following the first are ignored), so if one is already present, you can update it to j2sdk1.4.1_<version number>\bin.
The new path takes effect in each new Command Prompt window you open after setting the PATH variable. [ March 13, 2003: Message edited by: weiliu lili ]
Joined: Aug 03, 2002
Originally posted by weiliu lili: My class path is "C:\j2sdk1.4.0\bin;C:\Oracle\Ora81\bin;C:\Program Files\Oracle\jre\1.1.7\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Oracle\Ora81\orb\bin " I can compile *.java successfully, but cant run it.
You say "class path" here. But it looks like the setting for PATH not CLASSPATH. You say "can't run it": what error do you get?
Joined: Apr 11, 2002
Sorry ,mate. Yes,actually it is the path variable I set in Win 2k. and the error message is No ClassDef found error
hi the PATH variable is the one you need so the system finds the executables (java.exe, javac.exe or whatever) The CLASSPATH is the one java needs to locate the classes. so you probably need to set up your CLASSPATH to point to the JDK classes and to your classes. here is what it looks on my machine: CLASSPATH=.;c:\apps\j2sdk1.4.1_01\jre\lib\rt.jar perhaps this helps. k
Joined: Aug 03, 2002
OK. So what do you have for CLASSPATH ? CLASSPATH is going to be used to search for any class files and jar files containing classes. echo %CLASSPATH% should tell you. And while you are at it where is the class containing the main method you are trying to run? which directory?
Joined: Dec 10, 2001
If it weren't yet clear, the error you're receiving is because Java cannot locate a specified class in the CLASSPATH setting, which has nothing to do with the PATH setting.