aspose file tools*
The moose likes Beginning Java and the fly likes windows 2000 class path error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "windows 2000 class path error" Watch "windows 2000 class path error" New topic
Author

windows 2000 class path error

Dean Reedy
Ranch Hand

Joined: Sep 10, 2001
Posts: 89
I have the following setup:

java installed to: c:\j2sdk1.4.1_02
I want to be able to run java programs on an e: drive, but I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: TestMail
I can compile a program for example in the e:\startup folder by typing: c:\j2sdk1.4.1_02\bin\javac TestMail.java from the e:startup folder
However when I go to run this program by typing: c:\j2sdk1.4.1_02\bin\javac TestMail , I get the above error.
Now my envirnoment variable setting are:
Path
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program
Files\Symantec\pcAnywhere\;C:\j2sdk1.4.1_02\bin;
CLASSPATH:
%JAVA_HOME%\lib\tools.jar
JAVA_HOME:
c:\j2sdk1.4.1_02

I would like to be able to compile and run java programs from anywhere on my system. How would I set the classpath to allows this?

Listing on the imports on the testmail program:
import java.sql.*;
import java.text.*;
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import java.net.InetAddress;
import java.net.*;
public class TestMail
Any help would be great.
thanks!
Dean
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1824

Originally posted by Dean Reedy:

I would like to be able to compile and run java programs from anywhere on my system. How would I set the classpath to allows this?

Add the current directory ('.') to the CLASSPATH. That way, no matter what directory you're in, you have that directory in your classpath.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
...and note that a semicolon is used to separate locations on Windows. So, you probably want your CLASSPATH environment variable value to be similar to the following.
.;%JAVA_HOME%\lib\tools.jar


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dean Reedy
Ranch Hand

Joined: Sep 10, 2001
Posts: 89
Thankyou every for your responses. I did add the "." to the CLASSPATH variable and this allows me to compile and run from the directory with ease. However my orginal problem of the main not found ended up being that my "jar" files needed for the import were in the "c:\j2sdk1.4.1_02\jre\lib\ext\" and that was fine for compiling, but the run the program my "jars" needed to be in the "c:\program Files\java\j2sdk1.4.1_02\jre\lib\ext\" directory.
thanks again.
Dean
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: windows 2000 class path error