• Post Reply Bookmark Topic Watch Topic
  • New Topic

Package access problem: Java Number Cruncher  RSS feed

 
Ellen Zhao
Ranch Hand
Posts: 581
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all thanks to Mr.Ronald Mak, his "Java Number Cruncher" is a great book on numerical algorithm, low profile on mathematics and the codes in this book are the best codes on numerical algorithm I have ever seen. I downloaded the source file and unzipped and installed it exactly following the instruction on the website, unfortunately there was always package access problem when compiling. The environment variable was correctly set, I use SDK 1.4.1, OS is Win2k English/German remixed ( I installed a German win2k first, then reinstalled with an English version-not clean-reinstall- so that my OS is a very strange one, all the windows help files are written in English and menus are Geman/English remixed, dos console is in German ).
Then I put the jar file into sdk1.4.1\jre\lib\ext\, it should work well. Last time when I was doing JavaRanch Cattle Drive, I solved the package access problem this way. But, it still didn�t work. I searched help information and found this thread. My problem is exactly like hers, but the length of my autoexec.bat file is 0, so it cannot be the autoexec.bat�s fault. I tried compiling the files with both JCreator and dos console, both failed to access the package. Could anyone kindly tell me how to make my system recognize the nc.jar package? That would be a great help to me. Thank you very much in advance.

Regards,
Ellen
[ January 11, 2003: Message edited by: Ellen Fu ]
 
Greg Charles
Sheriff
Posts: 3015
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ellen,
If I understand that linked thread, the autoexec.bat was setting a classpath incorrectly. That's not the same problem you are having. Given that your environment is somewhat complex, I'd guess the problem is that the "ext" directory into which you put your Jar is not part of the same JRE that you are actually running. Try putting the Jar (fully qualified with the path) into your CLASSPATH variable, and try again. If that works, then my guess was right. Good luck!
 
Ellen Zhao
Ranch Hand
Posts: 581
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried everything but reinstalling my whole box( that would be awesome for me, I have to backup more than 10G data files), still no luck
Once I installed a jdk 1.4.0, not sure whether my weird system still takes it as the default jdk...but my JCreator tells the recognized jdk is 1.4.1.....how to make sure?
I need to use that package for some numerical caculating, urgent...feel very upset and depressed, anyone tell me what should I do? I would be very obliged.
Regards,
Ellen
 
Greg Charles
Sheriff
Posts: 3015
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, computers suck. I hate them.
Anyway, you talk about JCreator, but can you run simple application that rely on nc.jar from the command line? If so, do this:
1) Copy nc.jar to c:\temp directory.
2) Open up a dos box, and go wherever you need to be to run your application.
3) set CLASSPATH=%CLASSPATH%;c:\temp\nc.jar
4) java package.Application
5) Remember there's more to life than computers. (Especially if it still doesn't work.)
Let me know if that works. I'll be checking back.
 
Ellen Zhao
Ranch Hand
Posts: 581
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Greg,
I tried your advice. Still no luck.

5) Remember there's more to life than computers.
Right to the point. Thank you.

Regards,
Ellen
 
Greg Charles
Sheriff
Posts: 3015
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, this is starting to frustrate me. Yes, that means I've forsaken my own advice, but as I often do that, it is of no great consequence.
I followed your link to the website, found nc.jar.zip, and saw that some of my assumptions were bad. It is Java source and some scripts put into a Jar then zipped up. That's a fairly bizarre thing to do. Anyway, the nc.jar, even after you extract it from the zip file, contains no Java class files. Therefore, putting it in the classpath, or anywhere else, has no affect on running applications. You have to extract everything from the Jar, edit the setjava script to set your "javahome" and "jardest", run setjava, run complibs, then run comprogs, and then run jarlibs. That's a long, error-prone process, but if it works, the results will be, not another nc.jar, but all the following jars:
GraphUtils.jar Matrix.jar PointUtils.jar RandomUtils.jar MathUtils.jar PiUtils.jar PrimeUtils.jar RootUtils.jar
It's those jars that have to go in your "ext" directory, or (preferably) your classpath.
The compile worked for me, and the sample programs did run. I'm not sure what they did, but they definitely did something. It made me nostalgic for the days when I actually understood what the secant method was, and how to use Regula Falsi.
For the record, I set the values in setjava.bat to:
javahome=V:\dev\tools\bea\jdk131_03
jardest=.
 
Ellen Zhao
Ranch Hand
Posts: 581
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Greg,
I�m so sorry to have brought frustration to you. And thank you so much for paying attention to my silly question.
Here�s what I want to do with the package: First I am taking a Numerical Algorithm course in the university, once I wrote some stupid classes which are longer than 300 lines( without any comments ) for just a single purpose, say, LU decomposition and then solve the equations-all in one class--after I read the code from Mr.Mak I knew how stupid my code were. The abstract classes and interfaces are so well organized and elegantly written! I am trying to extend his Integration and Interpolation package. Second, I am working on a thesis strongly related to 3D transformation, the applet demonstrating the mathematical detail of matrix manipulation in 3D graphics perfectly matches what I am representing with equations in the thesis. I want to make the applet run on my own computer, but since my java compiler could never find what the classes are importing, I never made it(but I tried that from his homepage, it works well).
Here I extract some import statement from a class:
import numbercruncher.mathutils.Function;
import numbercruncher.mathutils.Integrator;
import numbercruncher.mathutils.TrapezoidalIntegrator;
import numbercruncher.mathutils.SimpsonsIntegrator;
import numbercruncher.mathutils.Epsilon;
import numbercruncher.mathutils.AlignRight;
Greg you are right, seems I cannot simply put the nc.jar into ext. I tried making a numbercruncher.jar file and put it there, compiling still failed.
Okay, let�s forget it, Greg. Anyway the source files are there, at least I can always make new packages with them. Thank you again.
Remember there�s more to life than computers.


Cheer up!
Ellen
PS: Although I was very much frustrated by this package access problem, numerical computing do fascinates me. Here�s the preface from the book:

From the preface:
The last time I looked, the Java programming language still had +, -, *, /, and % operators to do operations with numbers. It may be hard to believe today, but programming is not only about Web pages, graphics, enterprise software, database systems, and computer games.
I wrote this book to remind today's programmers, especially Java programmers, that computers really are quite good at numerical computing, affectionately known as "number crunching." In fact, some numerical computing underlies most programs -- for example, not too many graphics applications or interactive computer games would get very far without crunching at least a few numbers. Of course, scientific, mathematical, statistical, and financial programs rely heavily on numerical computing.
So it behooves the typical Java programmer, besides knowing the standard API alphabet soup -- JFC, RMI, JSP, EJB, JDBC, and so on -- to know something about how to do good numerical computing. You'll never know when a roundoff error will bite you, or why that "correct" formula you copied right out of your favorite physics textbook into your program somehow computes the wrong answer.
Another reason I wrote this book is that I'm fascinated by the dichotomies of pure mathematics and computer science. On one hand, you have mathematics, a rigorous, abstract world where it is possible to prove, absolutely, that a computation is correct. On the other hand, you have computers, where computations are, well, they're fast. And yet, mathematicians and computer scientists can work together to devise some very clever ways to enable computers to do mathematics and, in the great majority of cases, to compute the right answer.
This book is an introduction to numerical computing. It is not a textbook on numerical methods or numerical analysis, although it certainly shows how to program many key numerical algorithms in Java. We'll examine these algorithms, enough to get a feel for how they work and why they're useful, without formally proving why they work. Because Java is ideal for doing so, we'll also demonstrate many of the algorithms with interactive, graphical programs. After seeing how we can dodge some of the pitfalls of floating-point and integer computations, we'll explore programs that solve equations for x, do interpolation and integration, solve differential equations and systems of linear equations, and more.
Numerical computing is not all work, either. This book also contains several chapters on lighter (but not necessarily less useful) topics, including computing thousands of digits of pi, using different ways to generate random numbers, looking for patterns in the prime numbers, and creating the intricately beautiful fractal images.
I tried hard to keep the math in this book at the freshman calculus level or below -- knowledge of high school algebra should be enough for most of it. All the interactive programs in this book can run either as applets or as standalone programs. My friends and I have tested them with the Netscape 4.7 browser running on Windows, Linux, and Solaris, with Microsoft Internet Explorer 6.0 running on the PC, and Microsoft Internet Explorer 5.1 running on the Macintosh. I've tested the standalone programs on my Windows 98 PC with JDK 1.2, 1.3, and 1.4. Of course, there's no guarantee they'll all work perfectly for you, but the source code for all the programs, along with instructions on how to compile and run them, are available for downloading.
I wrote all the programs strictly as illustrative examples for this book. You're free to use the source code anyway you like, but bear in mind that this is not fully tested, commercial-quality code. Neither Prentice-Hall nor I can be responsible for anything bad that may happen if you use these programs. I had a lot of fun writing this book and its programs, and I hope that comes through in the text. If you're inspired to learn more about any of the topics, then I will be very happy.

I especially like this:

Numerical computing is dynamic!
Algorithms are stable or unstable.
They may converge or diverge.
And from their computed values,
Patterns may emerge!

What a small poetry
[ January 15, 2003: Message edited by: Ellen Fu ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!