Solved

CLASSPATH?

Posted on 2001-06-11
5
347 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

615 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