Solved

CLASSPATH?

Posted on 2001-06-11
5
339 Views
Last Modified: 2013-11-23
Hi.
I am new in Java.My question is how can I edit CLASSPATH
environment variable. On my computer I have JBuilder4 together with JDK1.3 installed. Now when I create classes in my own packages and then try to import from other projects it says that it cannot open directory with the name of the package, since since directory where my package is, not included into CLASSPATH, so I need to edit CLASSPATH every time I create my own packages, but I don't know how to do it with JBuilder installed.
Thanks.
0
Comment
Question by:alex108
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Expert Comment

by:superschlonz
ID: 6178794
Go to the Project Menu and press Project Properties.
In tabsheet Paths you have a tabsheet Requred Libraries
The click Add and a windo opens with title
'Select one or more libraries'
There you can click 'new' and enter the path or jar file where
your classes are.
0
 

Expert Comment

by:Sparrow1
ID: 6178971
I think the easiest way to add a classpath is to add a "global" path. In this way, your classpath variable will point to both the jar files anywhere specified AND the currently active directory (ie: where the user-created files are).

To do this, I just edit my autoexec.bat and add/change the line:
Set classpath = c:\thatOtherJarFile\FILENAME.jar;

to

Set classpath= c:\ThatOtherJarFiles\FILENAME.jar;.;

by adding "." as the location of the classpaths you are adding the "current directory" no matter where that happens to be.

Note: The ";" is a seperator between paths.
0
 

Author Comment

by:alex108
ID: 6180194
When I tried to do through Project Properties after I clicked Add and selected the path it writes "No new source, documantation or classpath were found" and it doesn't add.
0
 
LVL 3

Accepted Solution

by:
dnoelpp earned 70 total points
ID: 6182019
Did you use packages in your source? (Do you have a package ....; line at the top of the java files?) Then maybe you have a problem messing up with the path and the package path and the classpath...

EXAMPLE:

1. You hava a class Alpha in the empty package (without package statement in the file Alpha.java) and put it in the directory C:\myclasses.

2. You have a classpath 'C:\myclasses'

==> Java will find the class Alpha.

Let's continue!

3. You hava a class Beta in the package 'mypackage' (first statement in the file Beta.java is: package mypackage;) and put it in the same directory.

==> Java won't find the class Beta.

Why?

Because packages make subdirectories! Put it in C:\myclasses\mypackage, and voila! Java is successful again.

If the package is: mycompany.mypackage, then you have to store the class in C:\myclasses\mycompany\mypackage.
0
 

Author Comment

by:alex108
ID: 6183115
Thank you, I succeeded.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jsp login check 12 67
difference between sorce folder and folder in eclipise 3 65
swing controls 2 37
Session in java desktop 5 38
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question