I'm not a Linux guru but I'd probably try something roughly the same.
Make a shell script to execute the app (with everything properly
exported) and let Java call that shell script from rt.exec().
- John
Michael Saunders wrote:
>
> It sounds like your LD_LIBRARY_PATH environment variable is not set to
> point to the directory containing app's shared objects. Asking your java
> application to load the libraries for you won't work because rt.exec
> will occur in it's own shell. You probably need to create a app.sh
> script that sets up the LD_LIBRARY_PATH and then executes the app
> executable. Then change your rt.exec call to run the app.sh instead of app.
>
> As an alternative, just setup your LD_LIBRARY_PATH environement variable
> to point to the directory containing app's shared libraries before
> starting your java application (don't forget to export it). That should
> probably work also.
>
> Michael
>
> Jack Gundrum wrote:
>
> > John,
> >
> > It is a C++ program that you would normally just execute with ./app.
> > It does use shared object libs which are in /usr/local/lib. It may
> > be that this is the problem although they should be system wide.
> >
> > I tried to load the above libs.so with
> > rt.loadLibrary and rt.load and System.load and System.loadLibrary,
> > but nothing worked. Any clues would be helpfull
> >
> >
> >
> >
> > At 09:28 AM 3/19/2003 -0600, you wrote:
> >
> >> Jack,
> >>
> >> Is "/home/jsg3/app" an executable shell script? (did you give it execute
> >> permissions?) Or is it the C++ program itself? Does it run from a
> >> Linux command prompt?
> >>
> >> - John
> >>
> >> Jack Gundrum wrote:
> >> >
> >> > Thanks for the pointer, it was very easy with windows but not so
> >> easy with
> >> > linux.
> >> >
> >> > The following worked with windows
> >> > try
> >> > {
> >> > Runtime rt = Runtime.getRuntime();
> >> > Process proc = rt.exec("app.exe");
> >> > } catch (Throwable t)
> >> > {
> >> > t.printStackTrace();
> >> > }
> >> >
> >> > This would not work with linux
> >> > try
> >> > {
> >> > Runtime rt = Runtime.getRuntime();
> >> > Process proc =
> >> rt.exec("/home/jsg3/app");
> >> > } catch (Throwable t)
> >> > {
> >> > t.printStackTrace();
> >> > }
> >> >
> >> > The permissions are set to allow Java to execute the file but it
> >> doesnt?
> >> > Even as root Java would not run the file?
> >> >
> >> > At 12:14 PM 3/17/2003 -0300, you wrote:
> >> > >Hi.
> >> > >Not quite easy.
> >> > >Take a look for a good example of runtime.exec at
> >> > >www.javaworld.com
> >> > >direct link here:
> >> > >http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
> >> > >
> >> > >I lose some hair until I found above article some months ago...
> >> > >
> >> > >Alessandro
> >> > >
> >> > >
> >> > >----- Original Message -----
> >> > >From: "John Wright" <[EMAIL PROTECTED]>
> >> > >To: <[EMAIL PROTECTED]>
> >> > >Sent: Monday, March 17, 2003 12:01 PM
> >> > >Subject: Re: [JAVA3D] Java and C++
> >> > >
> >> > >
> >> > > > Jack,
> >> > > >
> >> > > > You want runtime.exec(name);
> >> > > >
> >> > > > - John Wright
> >> > > > Starfire Research
> >> > > >
> >> > > > Jack Gundrum wrote:
> >> > > > >
> >> > > > > Does anyone know how to launch a C++ executable file from a
> >> Java3D app?
> >> > > > > I am using Linux and would like to pass a arg and then launch
> >> the C++
> >> > >exe
> >> > > > > from my Java3D app. I found Runtime.getRuntime().load(name)?
> >> > > > >
> >> > > > > ********************
> >> > > > > Jack S. Gundrum
> >> > > > > Visualization Group
> >> > > > > Research Support
> >> > > > > Academic Services and Emerging Technology Systems
> >> > > > > Information Technology Services
> >> > > > > Penn State University
> >> > > > >
> >> > > > >
> >> >
> >> >=======================================================================
> >> ====
> >> > > > > To unsubscribe, send email to [EMAIL PROTECTED] and
> >> include in the
> >> > >body
> >> > > > > of the message "signoff JAVA3D-INTEREST". For general help,
> >> send email
> >> > >to
> >> > > > > [EMAIL PROTECTED] and include in the body of the message
> >> "help".
> >> > > >
> >> > > >
> >> >
> >> >=======================================================================
> >> ====
> >> > > > To unsubscribe, send email to [EMAIL PROTECTED] and include
> >> in the
> >> > >body
> >> > > > of the message "signoff JAVA3D-INTEREST". For general help,
> >> send email to
> >> > > > [EMAIL PROTECTED] and include in the body of the message
> >> "help".
> >> > >
> >> >
> >> >_______________________________________________________________________
> >> > >Busca Yahoo!
> >> > >O servi�o de busca mais completo da Internet. O que voc� pensar o
> >> Yahoo!
> >> > >encontra.
> >> > >http://br.busca.yahoo.com/
> >> > >
> >> >
> >> >=======================================================================
> >> ====
> >> > >To unsubscribe, send email to [EMAIL PROTECTED] and include in
> >> the body
> >> > >of the message "signoff JAVA3D-INTEREST". For general help, send
> >> email to
> >> > >[EMAIL PROTECTED] and include in the body of the message "help".
> >> >
> >> > ********************
> >> > Jack S. Gundrum
> >> > Visualization Group
> >> > Research Support
> >> > Academic Services and Emerging Technology Systems
> >> > Information Technology Services
> >> > Penn State University
> >> >
> >> >
> >> ===========================================================================
> >> > To unsubscribe, send email to [EMAIL PROTECTED] and include in
> >> the body
> >> > of the message "signoff JAVA3D-INTEREST". For general help, send
> >> email to
> >> > [EMAIL PROTECTED] and include in the body of the message "help".
> >>
> >> ===========================================================================
> >> To unsubscribe, send email to [EMAIL PROTECTED] and include in
> >> the body
> >> of the message "signoff JAVA3D-INTEREST". For general help, send
> >> email to
> >> [EMAIL PROTECTED] and include in the body of the message "help".
> >
> >
> > ********************
> > Jack S. Gundrum
> > Visualization Group
> > Research Support
> > Academic Services and Emerging Technology Systems
> > Information Technology Services
> > Penn State University
> >
> > =========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > body
> > of the message "signoff JAVA3D-INTEREST". For general help, send
> > email to
> > [EMAIL PROTECTED] and include in the body of the message "help"
> > .
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".