• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

how to include a new class or package  RSS feed

 
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
 
"The Hood"
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"
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.
 
You've gotta fight it! Don't give in! Read this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!