• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Java Tool with NSTask?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java Tool with NSTask?


  • Subject: Re: Java Tool with NSTask?
  • From: Mijobe <email@hidden>
  • Date: Sun, 25 Jan 2004 14:51:50 -0500

Considering the ease of interoperating with Java applications unless there's something stopping you I would execute the Java code myself. For instance if the command line tool writes its output to System.out the I would set System.out to an output stream that I could read from. For instance if I remember correctly you can use a PipedOutputStream connected to a PipedInputStream or a ByteArrayOutputStream and read from that. Once you set System.out then simply call the main method on the Java class and have it do its thing. If that doesn't make sense I can provide you some example code.

-
email@hidden
<xinjen/>
On Jan 25, 2004, at 4:15 AM, Sherm Pendley wrote:

On Jan 25, 2004, at 3:30 AM, Fabio Genoese wrote:

I would like to access a Java command line tool from Cocoa (Objective-C app). As you can imagine, I need its output. I know there's NSTask for UNIX command line tools and of course there's NSPureApplication in the Java AppKit for java tools (ONLY for the Java AppKit) but what about using java tools from Objective-C? Any ideas?

Couldn't you simply use NSTask to run /usr/bin/java just like you would any other UNIX tool? All you'd need to do is pass the path to your Java app as an argument, as well as any other relevant arguments you'd use to run the app from a shell.

sherm--
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Java Tool with NSTask? (From: Fabio Genoese <email@hidden>)
 >Re: Java Tool with NSTask? (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: [APP IDEA] Desktop Background Scripting
  • Next by Date: Multiple cell types in the same column?
  • Previous by thread: Re: Java Tool with NSTask?
  • Next by thread: Disappearing main window
  • Index(es):
    • Date
    • Thread