aspose file tools*
The moose likes Beginning Java and the fly likes how to include a new class or package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to include a new class or package" Watch "how to include a new class or package" New topic
Author

how to include a new class or package

alfredo navarra
Greenhorn

Joined: Nov 19, 2001
Posts: 5
Hi,
I'm trying to use MathFP class for allowing my application use float and double.
My problem is: how can I include this new class (or package) in my application.
Do I have to change the settings of my CLASSPATH ?
Do I have to do it by changing the Autoexec.bat ?
Thank you!
bye,
Alfredo
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
What you are doing is getting an extension for the Java Language. You can put the jar file for that extension in
jre/lib/ext
in which case it will be an "installed extension" and the jvm will be able to find it, or you can name the extension jarfiles in the manifest file that is used to invoke your jar file and they will be used as part of the application.

Here is an Overview of Extensions.


"JavaRanch, where the deer and the Certified play" - David O'Meara
alfredo navarra
Greenhorn

Joined: Nov 19, 2001
Posts: 5
Your answer was very useful for me and I thank you but I have another little problem now:
I put my package tree in a jar file.
I placed the jar file in the "lib/ext" directory.
At this point I don't have the compiling problem no more (the 'import net.jscience.math.*;' at the top of the program doesn't cause no problem).
But if I try to use a class inside the package imported or if I import just that class ('import net.jscience.math.MathFP;') I have this run-time problem:
"UNABLE TO LOAD CLASS net.jscience.math.MathFP"
like if that class doesn't exist in the package!
thank you,
bye
Alfredo
ps. Maybe it's useless: I'm working on WinNT, with the J2me Sun ToolKit and with the Zucotto Whiteboard for J2ME.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Can you check if you are spelling the class correctly.
Use
>jar tf jar-file
to view the table of contents for the jar file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to include a new class or package