• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to include a new class or package

 
alfredo navarra
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
alfredo navarra
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic