The Artima Developer Community
Sponsored Link

Java Answers Forum
Problems with Classpath, Packages and Imports

18 replies on 2 pages. Most recent reply: Sep 4, 2003 11:21 AM by Ken Sloan

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 18 replies on 2 pages [ « | 1 2 ]
Ken Sloan

Posts: 35
Nickname: sloan
Registered: Sep, 2003

Re: Problems with Classpath, Packages and Imports Posted: Sep 3, 2003 11:28 AM
Reply to this message Reply
Advertisement
I'm not following you. Under Windows 2000, I am going into Control Panel, System, Advanced and then clicking the Environment Variables tab. I then highlight Path under System Variables and click Edit. I make the changes and get out. Then, when I type "path" in at the C:\> prompt in DOS I get:

Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

c:\>path
PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;c:\j2 sdk1.4.2\bin;c:\Prog
ram Files\winzip;C:\packtest;

c:\>

Therefore, I would say the classpath IS set. Am I correct in this assumption, or is there something else I should be doing and looking at?

Here's what I get when I run "set c".

Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

c:\>set c
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=KEN
ComSpec=C:\WINNT\system32\cmd.exe

c:\>

Arun Agarwal

Posts: 5
Nickname: arunrecw
Registered: May, 2003

Re: Problems with Classpath, Packages and Imports Posted: Sep 4, 2003 8:01 AM
Reply to this message Reply
>>> c:\packtest>echo %CLASSPATH%

Seems CLASSPATH is not a System variable in your machine.
I also had this problem once, I kept classpath in System variables and It was available to me..... :O))

Don't know why it happened.

Regards,
Arun Agarwal.

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Problems with Classpath, Packages and Imports Posted: Sep 4, 2003 10:35 AM
Reply to this message Reply
Ah ha. The problem is that you've confused path and classpath. The path is where the OS looks for executable programs (incidentally, class files can be configured as such, but that is another topic), whereas the classpath is where the JVM looks for class files. They are completely separate and different. You don't want that packtest stuff in the path, instead you need to create a new environment variable called classpath. This explains why specifying the classpath on the command line was working for you, also.

Ken Sloan

Posts: 35
Nickname: sloan
Registered: Sep, 2003

Re: Problems with Classpath, Packages and Imports Posted: Sep 4, 2003 11:21 AM
Reply to this message Reply
THAT'S IT!!!

That was the problem. I THOUGHT path and classpath were synonymous terms. As soon as I created a classpath system variable and set it up correctly (and took the other stuff out of the path system variable) everything began working as expected.

Thanks Matt, and to everyone else. I feel like I've gone through a hyper-intensive crash course on packages, system variables and the javac compiler for almost a week now. It's been enormously frustrating, but also enormously educational. I'm now able to begin setting up the much more complex directory and package structures I had originally wanted to do all along.

Thanks again, everyone.

Flat View: This topic has 18 replies on 2 pages [ « | 1  2 ]
Topic: Reading Images from JTextPane Previous Topic   Next Topic Topic: Reading Images from JTextPane

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use