• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to pass Java value from program

 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I thought i'd be able to use the System.exit(calcval) to pass a final value of the a Java program and into a kshell variable ie:

#!bin/ksh

java jpgm1
passvar=$?

but it looks like the .exit method only passes numeric values up to a certain value, ie under 500 looks like.

Is there another Java method i could use to accomplish this same feat?

I could write it to a file of course, but then i would need to figure a way to get it from the file to the $passvar!

Thanks for any suggestions!
bc
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bob,
I'm not familiar with the limits of System.exit(), but I do know how to read in a file in UNIX:
passvar=`cat fileName`

(Note that the example has backquotes, not regular quotes)
 
bob connolly
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks alot Jeanne!

bc
 
reply
    Bookmark Topic Watch Topic
  • New Topic