Solved

CLASSPATH?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Non-recursive backtracking, using a stack 1 103
java.io.BufferedReader   readLine()  //returns the entire file ? 4 60
xampp tool 12 28
servlet example 17 10
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now