1000 Java Tips ebook
Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java
programming articles and tips. Please take your copy here.
Take your copy of free "Java Technology Screensaver"!.
Easy Learn Java: Programming Articles, Examples and Tips - Page 36
1060 Stories (530 Pages, 2 Per Page)
How can I check CLASSPATH variable on my OS?
Question: How can I check CLASSPATH
variable on my OS?
Answer: The CLASSPATH environment
variable tells the Java Virtual Machine and other Java applications where to
find all the class libraries.
User-defined class libraries also defined by the CLASSPATH variable.
Open Command prompt in Windows
and type: echo %CLASSPATH%
In Linux, Unix or MAC OSX in any shell: echo $CLASSPATH
Default class path
If the CLASSPATH environment varialbe is not set, the following default
class path will be used:
All the entries in this line are ":" separated...
represents the current directory. The symbol
[bin] stands for the
absolute path to the
jdk1.1.x/bin directory. Therefore, if you keep
lib directories at the same directory
level, the Java executables will find the JDK classes (contained in the
classes.zip file). Note that the default class path also includes a path
classes directory on the same directory level as
lib. You can put your own (unzipped) class files in a
classes directory that you create, and the Java executables will be able
to find them with the default CLASSPATH.
Setting your CLASSPATH: fast receipt here!
You need to set the CLASSPATH if you move the JDK's
file or if you want to load a class library that's not in a location specified
by the default CLASSPATH. To set CLASSPATH, use the setenv command.
And you unset your CLASSPATH in just one short command like this:
You need unset if your CLASSPATH environment variable has been set to a value that is not correct, or if your startup file or script is setting an incorrect path.
This command unsets only CLASSPATH's current value. You should also delete or
modify the lines in your startup file that may be setting an incorrect
19 comments | | Score: 5
Posted by jalex on Wednesday, March 26, 2003 (00:00:00) (24397 reads)
Properties class inherited from Hashtable... Does it mean that I can use ''non-s
Question: Properties class inherited from
Hashtable... Does it mean that I can use "non-string" keys and values?
Answer: Not really. Why?
I think best answer for this question can be found in API:
"The Properties class represents a persistent set of properties. The Properties
can be saved to a stream or loaded from a stream. Each key and its corresponding
value in the property list is a string.
A property list can contain another property list as its "defaults"; this second
property list is searched if the property key is not found in the original
Because Properties inherits from Hashtable, the put and putAll methods can be
applied to a Properties object. Their use is strongly discouraged as they allow
the caller to insert entries whose keys or values are not Strings. The
setProperty method should be used instead. If the store or save method is called
on a "compromised" Properties object that contains a non-String key or value,
the call will fail.
When saving properties to a stream or loading them from a stream, the ISO 8859-1
character encoding is used. For characters that cannot be directly represented
in this encoding, Unicode escapes are used; however, only a single 'u' character
is allowed in an escape sequence. The native2ascii tool can be used to convert
property files to and from other character encodings."
Our older tips: March 22, 2001 - October 21, 2002
All published and not published on site tips you can find
8 comments | | Score: 0
Posted by jalex on Tuesday, March 25, 2003 (00:00:00) (4576 reads)