Board index » jbuilder » Need to call a .pkg from Java

Need to call a .pkg from Java


2004-10-28 08:57:44 AM
jbuilder12
Hi all
I Need to call a .pkg from Java
can you do this if so how ?
Thanks for you time
have a good one all
Craig
 
 

Re:Need to call a .pkg from Java

Craig Laird wrote:
Quote
I Need to call a .pkg from Java

can you do this if so how ?
What do mean by "call a .pkg"?
Do you mean that you have to
ask the Installer to install
a certain .pkg file?
If so, I'm guessing you would
use the standard
Runtime.exec("/Applications/Utilities/Installer.app", ...);
or something like that.
--
Paul Furbacher (TeamB)
Save time, search the archives:
www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
 

Re:Need to call a .pkg from Java

"Paul Furbacher [TeamB]" < XXXX@XXXXX.COM >wrote:
Quote
Craig Laird wrote:

>I Need to call a .pkg from Java
>
>can you do this if so how ?

What do mean by "call a .pkg"?
Do you mean that you have to
ask the Installer to install
a certain .pkg file?

If so, I'm guessing you would
use the standard

Runtime.exec("/Applications/Utilities/Installer.app", ...);

or something like that.


--


Paul Furbacher (TeamB)
this is the code that I am using
import java.io.*;
import javax.swing.*;
import java.lang.*;
public class pkg {
public pkg() {
Process process;
package qc;
try {
process = Runtime.getRuntime().exec("/qc.exe");
} catch (IOException ioe) {
JOptionPane.showMessageDialog(null,
"This is from IOException...." +
ioe.getMessage());
System.out.println(ioe.getMessage());
}
}
public static void main(String[] args) {
new pkg();
}
}
but get this error
/qc.pkg: cannot execute
please any insight would be very helpful
Craig
Quote
Save time, search the archives:
www.borland.com/newsgroups/ngsearch.html

Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html

Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
 

{smallsort}

Re:Need to call a .pkg from Java

"Craig Laird" < XXXX@XXXXX.COM >wrote:
Quote

"Paul Furbacher [TeamB]" < XXXX@XXXXX.COM >wrote:
>Craig Laird wrote:
>
>>I Need to call a .pkg from Java
>>
>>can you do this if so how ?
>
>What do mean by "call a .pkg"?
>Do you mean that you have to
>ask the Installer to install
>a certain .pkg file?
>
>If so, I'm guessing you would
>use the standard
>
>Runtime.exec("/Applications/Utilities/Installer.app", ...);
>
>or something like that.
>
>
>--
>
>
>Paul Furbacher (TeamB)
>this is the code that I am using


I had a type in the
process = Runtime.getRuntime().exec("/qc.pkg");
but still the same error
Quote
import java.io.*;
import javax.swing.*;
import java.lang.*;


public class pkg {
public pkg() {
Process process;
package qc;
try {
process = Runtime.getRuntime().exec("/qc.pkg");

} catch (IOException ioe) {
JOptionPane.showMessageDialog(null,
"This is from IOException...." +
ioe.getMessage());
System.out.println(ioe.getMessage());
}

}
public static void main(String[] args) {
new pkg();
}

}


but get this error
/qc.pkg: cannot execute

please any insight would be very helpful

Craig

>Save time, search the archives:
>www.borland.com/newsgroups/ngsearch.html
>
>Is it in Joi Ellis's Faq-O-Matic?
>www.visi.com/~gyles19/fom-serve/cache/1.html
>
>Finally, please send responses to the newsgroup only.
>That means, do not send email directly to me.
>Thank you.
 

Re:Need to call a .pkg from Java

Craig Laird wrote:
Quote
"Craig Laird" < XXXX@XXXXX.COM >wrote:

>"Paul Furbacher [TeamB]" < XXXX@XXXXX.COM >wrote:
[...]
>>Runtime.exec("/Applications/Utilities/Installer.app", ...);
[...]
I had a type in the
process = Runtime.getRuntime().exec("/qc.pkg");
but still the same error

>process = Runtime.getRuntime().exec("/qc.pkg");
>[...]
>
>but get this error
>/qc.pkg: cannot execute
Okay. Try adapting the apple script in
the following to your situation:
lists.apple.com/archives/java-dev/2004/Jan/msg00670.html
--
Paul Furbacher (TeamB)
Save time, search the archives:
www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
 

Re:Need to call a .pkg from Java

Paul Furbacher [TeamB] wrote:
Quote
Craig Laird wrote:

>"Craig Laird" < XXXX@XXXXX.COM >wrote:
>
>>"Paul Furbacher [TeamB]" < XXXX@XXXXX.COM >wrote:
>
>[...]
>
>>>Runtime.exec("/Applications/Utilities/Installer.app", ...);

>[...]

>I had a type in the process = Runtime.getRuntime().exec("/qc.pkg");
>but still the same error
>
>>process = Runtime.getRuntime().exec("/qc.pkg");
>>[...]
>>
>>but get this error
>>/qc.pkg: cannot execute


Okay. Try adapting the apple script in
the following to your situation:

lists.apple.com/archives/java-dev/2004/Jan/msg00670.html
Or better yet, try
try {
Runtime.getRuntime().exec(
new String[] {
"open", "-a", "/Applications/Utilities/Installer.app",
"/Users/<pathtopkg>/your.pkg"
}
);
}
catch (Exception ex) {
System.out.println("error: " + ex);
}
Make the appropriate substitutions for the
actual path and pkg filename. I tested
this and it does work for me.
I had to groups.google to find this since it's not
something I've ever had to do.
Keywords:
"os x" "runtime().exec"
--
Paul Furbacher (TeamB)
Save time, search the archives:
www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
 

Re:Need to call a .pkg from Java

Thank you Paul the worked just the way I need it to
Craig
"Paul Furbacher [TeamB]" < XXXX@XXXXX.COM >wrote:
Quote
Paul Furbacher [TeamB] wrote:
>Craig Laird wrote:
>
>>"Craig Laird" < XXXX@XXXXX.COM >wrote:
>>
>>>"Paul Furbacher [TeamB]" < XXXX@XXXXX.COM >wrote:
>>
>>[...]
>>
>>>>Runtime.exec("/Applications/Utilities/Installer.app", ...);
>
>>[...]
>
>>I had a type in the process = Runtime.getRuntime().exec("/qc.pkg");
>>but still the same error
>>
>>>process = Runtime.getRuntime().exec("/qc.pkg");
>>>[...]
>>>
>>>but get this error
>>>/qc.pkg: cannot execute
>
>
>Okay. Try adapting the apple script in
>the following to your situation:
>
>lists.apple.com/archives/java-dev/2004/Jan/msg00670.html

Or better yet, try

try {
Runtime.getRuntime().exec(
new String[] {
"open", "-a", "/Applications/Utilities/Installer.app",
"/Users/<pathtopkg>/your.pkg"
}
);
}
catch (Exception ex) {
System.out.println("error: " + ex);
}

Make the appropriate substitutions for the
actual path and pkg filename. I tested
this and it does work for me.

I had to groups.google to find this since it's not
something I've ever had to do.

Keywords:

"os x" "runtime().exec"


--


Paul Furbacher (TeamB)

Save time, search the archives:
www.borland.com/newsgroups/ngsearch.html

Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html

Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.