• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java on the AS400: Help :)

 
Ray Marsh
Ranch Hand
Posts: 458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps you have your classpaths set up differently on the different machines???
 
Ray Marsh
Ranch Hand
Posts: 458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic