File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Java on the AS400: Help :) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java on the AS400: Help :)" Watch "Java on the AS400: Help :)" New topic

Java on the AS400: Help :)

Ray Marsh
Ranch Hand

Joined: Jan 12, 2000
Posts: 458
Ok I'm thoroughly confused.
I have a Java pgm, that runs fine on my PC in a Jvm 1.2, however, it throws a method not found error on a line that calls the nextInt method in the java.util.Random class, on the AS400 which is running Jvm 1.1.7. So, without looking , I figured, Random.nextInt, was not a method for 1.1
Well, I checked and I figured wrong. Random.nextInt is in 1.1 So what�s the deal? Do I need to compile the class on the AS400? I�ll try that tomorrow, but I thought it was �run anywhere�.
Looking for a little enlightenment.
Thanks, in advance.

Anxiety does not empty tomorrow of its sorrows, but only empties today of its strength. – Charles Spurgeon
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Perhaps you have your classpaths set up differently on the different machines???

"JavaRanch, where the deer and the Certified play" - David O'Meara
Ray Marsh
Ranch Hand

Joined: Jan 12, 2000
Posts: 458
No, I figured it out today.
Sun's class libraries cleared it up. The java.util.Random.nextInt method is different in 1.1 than 1.2
By compiling the class directly on the AS400 I found the problem.
In 1.1 there are no parameters for the method. In 1.2 you can supply an int parameter to limit the random selection.
All I had to do was divide mudulo the random result and flip and negatives to positive and boom, it worked! The software required a positive int 0 to 255.
I agree. Here's the link:
subject: Java on the AS400: Help :)
It's not a secret anymore!