Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #20764 > unrolled thread
| Started by | zyng <xsli2@yahoo.com> |
|---|---|
| First post | 2012-12-28 09:07 -0800 |
| Last post | 2012-12-30 22:11 +0000 |
| Articles | 15 — 6 participants |
Back to article view | Back to comp.lang.java.programmer
a java classpath question zyng <xsli2@yahoo.com> - 2012-12-28 09:07 -0800
Re: a java classpath question Arne Vajhøj <arne@vajhoej.dk> - 2012-12-28 13:05 -0500
Re: a java classpath question zyng <xsli2@yahoo.com> - 2012-12-28 10:44 -0800
Re: a java classpath question zyng <xsli2@yahoo.com> - 2012-12-28 10:48 -0800
Re: a java classpath question Arne Vajhøj <arne@vajhoej.dk> - 2012-12-28 13:51 -0500
Re: a java classpath question Lew <lewbloch@gmail.com> - 2012-12-28 13:16 -0800
Re: a java classpath question Arne Vajhøj <arne@vajhoej.dk> - 2012-12-28 13:48 -0500
Re: a java classpath question Roedy Green <see_website@mindprod.com.invalid> - 2012-12-29 09:52 -0800
Re: a java classpath question Roedy Green <see_website@mindprod.com.invalid> - 2012-12-30 07:53 -0800
Re: a java classpath question Arne Vajhøj <arne@vajhoej.dk> - 2012-12-30 15:40 -0500
Re: a java classpath question "John L." <johnlarew@sbcglobal.net> - 2012-12-30 11:50 -0800
Re: a java classpath question Arne Vajhøj <arne@vajhoej.dk> - 2012-12-30 15:35 -0500
Re: a java classpath question Martin Gregorie <martin@address-in-sig.invalid> - 2012-12-30 20:49 +0000
Re: a java classpath question Arne Vajhøj <arne@vajhoej.dk> - 2012-12-30 16:10 -0500
Re: a java classpath question Martin Gregorie <martin@address-in-sig.invalid> - 2012-12-30 22:11 +0000
| From | zyng <xsli2@yahoo.com> |
|---|---|
| Date | 2012-12-28 09:07 -0800 |
| Subject | a java classpath question |
| Message-ID | <5e66740e-0d85-44b9-806d-d0056b27e928@googlegroups.com> |
Hi: My Java program is started by using somebody's shell script. Inside his script: java -classpath his_lib/'*' Main However, I also wish to set Java's classpath for my code to work and I am not allowed to change his script.(He: actually is a company. My program is running inside this company's main frame). So when JVM starts, the true classpath is my_lib/'*';his_lib/'*'. Is that possible to do? Thank you.
[toc] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-12-28 13:05 -0500 |
| Message-ID | <50dddf5e$0$284$14726298@news.sunsite.dk> |
| In reply to | #20764 |
On 12/28/2012 12:07 PM, zyng wrote: > My Java program is started by using somebody's shell script. Inside > his script: > > java -classpath his_lib/'*' Main > > However, I also wish to set Java's classpath for my code to work and > I am not allowed to change his script.(He: actually is a company. My > program is running inside this company's main frame). > > So when JVM starts, the true classpath is my_lib/'*';his_lib/'*'. Is > that possible to do? No. For that to be possible his shell script should have used a variable that you could have set. I would copy his shell script and modify it. Arne
[toc] | [prev] | [next] | [standalone]
| From | zyng <xsli2@yahoo.com> |
|---|---|
| Date | 2012-12-28 10:44 -0800 |
| Message-ID | <0366a83e-4841-493c-b3af-649a5b108631@googlegroups.com> |
| In reply to | #20768 |
OK. Thanks. But I can not make it work. In the script: his_lib=/a/b my_lib=/c/d java -classpath $his_lib/'*' Main //old script and it works java -classpath $his_lib/'*';$my_lib/'*' Main //not working, saying /c/d/*: No such file or directory Confused.
[toc] | [prev] | [next] | [standalone]
| From | zyng <xsli2@yahoo.com> |
|---|---|
| Date | 2012-12-28 10:48 -0800 |
| Message-ID | <4ea86227-83e9-4025-8dc0-b52598ede40d@googlegroups.com> |
| In reply to | #20769 |
On Friday, December 28, 2012 1:44:13 PM UTC-5, zyng wrote: > OK. Thanks. But I can not make it work. In the script: > > > > his_lib=/a/b > > my_lib=/c/d > > > > java -classpath $his_lib/'*' Main //old script and it works > > > > java -classpath $his_lib/'*';$my_lib/'*' Main //not working, saying /c/d/*: No such file or directory > > > > Confused. Wow, this is working: java -classpath $his_lib/'*':$my_lib/'*' Main //using ":" not ";" to separate (Obviously, I am on Linux.) But, this document is using ";", not ":" http://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-12-28 13:51 -0500 |
| Message-ID | <50ddea26$0$281$14726298@news.sunsite.dk> |
| In reply to | #20770 |
On 12/28/2012 1:48 PM, zyng wrote:
> On Friday, December 28, 2012 1:44:13 PM UTC-5, zyng wrote:
>> OK. Thanks. But I can not make it work. In the script:
>> his_lib=/a/b
>> my_lib=/c/d
>>
>> java -classpath $his_lib/'*' Main //old script and it works
>>
>> java -classpath $his_lib/'*';$my_lib/'*' Main //not working, saying /c/d/*: No such file or directory
>>
>> Confused.
>
> Wow, this is working:
> java -classpath $his_lib/'*':$my_lib/'*' Main //using ":" not ";" to separate
>
> (Obviously, I am on Linux.)
>
> But, this document is using ";", not ":"
> http://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html
^^^^^^^
It says Windows.
You want:
http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/classpath.html
Arne
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2012-12-28 13:16 -0800 |
| Message-ID | <d1bd1dc0-5f4e-45bc-88c4-d3d80ec33176@googlegroups.com> |
| In reply to | #20770 |
zyng wrote: > zyng wrote: >> OK. Thanks. But I can not make it work. In the script: > > his_lib=/a/b Forward slash hints you might be using a *nix style system. >> my_lib=/c/d > >> java -classpath $his_lib/'*' Main //old script and it works "works": Meaning it picks up all JARs in that directory, yes? > >> java -classpath $his_lib/'*';$my_lib/'*' Main >> //not working, saying /c/d/*: No such file or directory >> Confused. > > Wow, this is working: > > java -classpath $his_lib/'*':$my_lib/'*' Main //using ":" not ";" to separate > > (Obviously, I am on Linux.) Obvious to whom? > But, this document is using ";", not ":" > > http://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html What was that URL again? ... windows/ ... -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-12-28 13:48 -0500 |
| Message-ID | <50dde98c$0$281$14726298@news.sunsite.dk> |
| In reply to | #20769 |
On 12/28/2012 1:44 PM, zyng wrote: > OK. Thanks. But I can not make it work. In the script: > > his_lib=/a/b > my_lib=/c/d > > java -classpath $his_lib/'*' Main //old script and it works > > java -classpath $his_lib/'*';$my_lib/'*' Main //not working, saying /c/d/*: No such file or directory > > Confused. On *nix I think classpath elements is separated by : not ;. Arne
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2012-12-29 09:52 -0800 |
| Message-ID | <5fbud89d1563p351ot67sgbh841ucpk7j4@4ax.com> |
| In reply to | #20764 |
On Fri, 28 Dec 2012 09:07:39 -0800 (PST), zyng <xsli2@yahoo.com> wrote, quoted or indirectly quoted someone who said : >However, I also wish to set Java's classpath for > my code to work and I am not allowed to change his script. >(He: actually is a company. My program is running inside this company's main frame). Things to try: 1. classpath set in jar manifest. 2. custom classloader 3. setting system property (I have not tried this). -- Roedy Green Canadian Mind Products http://mindprod.com Students who hire or con others to do their homework are as foolish as couch potatoes who hire others to go to the gym for them.
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2012-12-30 07:53 -0800 |
| Message-ID | <kro0e8dvp1rlh8ba54tfas5tu2oa0ne5e0@4ax.com> |
| In reply to | #20764 |
On Fri, 28 Dec 2012 09:07:39 -0800 (PST), zyng <xsli2@yahoo.com> wrote, quoted or indirectly quoted someone who said : >My Java program is started by using somebody's shell script. Inside his script: > >java -classpath his_lib/'*' Main you could write a dummy java program that execs your real program. -- Roedy Green Canadian Mind Products http://mindprod.com Students who hire or con others to do their homework are as foolish as couch potatoes who hire others to go to the gym for them.
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-12-30 15:40 -0500 |
| Message-ID | <50e0a6cb$0$295$14726298@news.sunsite.dk> |
| In reply to | #20819 |
On 12/30/2012 10:53 AM, Roedy Green wrote: > On Fri, 28 Dec 2012 09:07:39 -0800 (PST), zyng <xsli2@yahoo.com> > wrote, quoted or indirectly quoted someone who said : >> My Java program is started by using somebody's shell script. Inside his script: >> >> java -classpath his_lib/'*' Main > > you could write a dummy java program that execs your real program. OP could do that. But if is not an option to change the shell script, then it does not help. If it is an option to change the shell script, then the dummy program is not needed. Arne
[toc] | [prev] | [next] | [standalone]
| From | "John L." <johnlarew@sbcglobal.net> |
|---|---|
| Date | 2012-12-30 11:50 -0800 |
| Message-ID | <2dad5750-78a5-444a-812f-fdadb4d58278@googlegroups.com> |
| In reply to | #20764 |
On Friday, December 28, 2012 12:07:39 PM UTC-5, zyng wrote: > Hi: My Java program is started by using somebody's shell script. Inside his script: java -classpath his_lib/'*' Main However, I also wish to set Java's classpath for my code to work and I am not allowed to change his script.(He: actually is a company. My program is running inside this company's main frame). So when JVM starts, the true classpath is my_lib/'*';his_lib/'*'. Is that possible to do? Thank you. At the risk of stating the obvious, perhaps set the %CLASSPATH% environment variable (or its Unix equivalent) prior to invoking your colleague's script.
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-12-30 15:35 -0500 |
| Message-ID | <50e0a57e$0$295$14726298@news.sunsite.dk> |
| In reply to | #20825 |
On 12/30/2012 2:50 PM, John L. wrote: > On Friday, December 28, 2012 12:07:39 PM UTC-5, zyng wrote: >> Hi: My Java program is started by using somebody's shell script. >>Inside his script: java -classpath his_lib/'*' Main However, I also wish >>to set Java's classpath for my code to work and I am not allowed to >>change his script.(He: actually is a company. My program is running >>inside this company's main frame). So when JVM starts, the true >>classpath is my_lib/'*';his_lib/'*'. Is that possible to do? Thank you. > > At the risk of stating the obvious, perhaps set the %CLASSPATH% > environment variable (or its Unix equivalent) prior to invoking your > colleague's script. The -cp argument override CLASSPATH env - it does not supplement it. Arne
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2012-12-30 20:49 +0000 |
| Message-ID | <kbq9ck$980$1@localhost.localdomain> |
| In reply to | #20825 |
On Sun, 30 Dec 2012 11:50:48 -0800, John L. wrote: > On Friday, December 28, 2012 12:07:39 PM UTC-5, zyng wrote: >> Hi: My Java program is started by using somebody's shell script. Inside >> his script: java -classpath his_lib/'*' Main However, I also wish to >> set Java's classpath for my code to work and I am not allowed to change >> his script.(He: actually is a company. My program is running inside >> this company's main frame). So when JVM starts, the true classpath is >> my_lib/'*';his_lib/'*'. Is that possible to do? Thank you. > > At the risk of stating the obvious, perhaps set the %CLASSPATH% > environment variable (or its Unix equivalent) prior to invoking your > colleague's script. At the brisk of stating another obvious point, whats wrong with this summary of the situation? 1) the owner of the computer wants your program to be run on it. 2) an existing script must be changed for your program to run 3) the computer's sysadmins won't let anybody else change scripts on production systems. (a fairly common situation). However this leaves the obvious outstanding question: why won't the sysadmins, i.e. 'the company', make the changes needed for your program to run? -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-12-30 16:10 -0500 |
| Message-ID | <50e0adbe$0$290$14726298@news.sunsite.dk> |
| In reply to | #20829 |
On 12/30/2012 3:49 PM, Martin Gregorie wrote: > On Sun, 30 Dec 2012 11:50:48 -0800, John L. wrote: > >> On Friday, December 28, 2012 12:07:39 PM UTC-5, zyng wrote: >>> Hi: My Java program is started by using somebody's shell script. Inside >>> his script: java -classpath his_lib/'*' Main However, I also wish to >>> set Java's classpath for my code to work and I am not allowed to change >>> his script.(He: actually is a company. My program is running inside >>> this company's main frame). So when JVM starts, the true classpath is >>> my_lib/'*';his_lib/'*'. Is that possible to do? Thank you. >> >> At the risk of stating the obvious, perhaps set the %CLASSPATH% >> environment variable (or its Unix equivalent) prior to invoking your >> colleague's script. > > At the brisk of stating another obvious point, whats wrong with this > summary of the situation? > > 1) the owner of the computer wants your program to be run on it. > 2) an existing script must be changed for your program to run > 3) the computer's sysadmins won't let anybody else change scripts > on production systems. (a fairly common situation). > > However this leaves the obvious outstanding question: why won't the > sysadmins, i.e. 'the company', make the changes needed for your program > to run? Do you read Dilbert? :-) Arne
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2012-12-30 22:11 +0000 |
| Message-ID | <kbqe5t$als$1@localhost.localdomain> |
| In reply to | #20830 |
On Sun, 30 Dec 2012 16:10:23 -0500, Arne Vajhøj wrote: > On 12/30/2012 3:49 PM, Martin Gregorie wrote: >> On Sun, 30 Dec 2012 11:50:48 -0800, John L. wrote: >> >>> On Friday, December 28, 2012 12:07:39 PM UTC-5, zyng wrote: >>>> Hi: My Java program is started by using somebody's shell script. >>>> Inside his script: java -classpath his_lib/'*' Main However, I also >>>> wish to set Java's classpath for my code to work and I am not allowed >>>> to change his script.(He: actually is a company. My program is >>>> running inside this company's main frame). So when JVM starts, the >>>> true classpath is my_lib/'*';his_lib/'*'. Is that possible to do? >>>> Thank you. >>> >>> At the risk of stating the obvious, perhaps set the %CLASSPATH% >>> environment variable (or its Unix equivalent) prior to invoking your >>> colleague's script. >> >> At the brisk of stating another obvious point, whats wrong with this >> summary of the situation? >> >> 1) the owner of the computer wants your program to be run on it. >> 2) an existing script must be changed for your program to run 3) the >> computer's sysadmins won't let anybody else change scripts >> on production systems. (a fairly common situation). >> >> However this leaves the obvious outstanding question: why won't the >> sysadmins, i.e. 'the company', make the changes needed for your program >> to run? > > Do you read Dilbert? > > :-) > Not usually, though I know the strip - of course. BOFH is more my style. However, I am genuinely puzzled why nobody seems to be authorized to make what seems to be a simple change. For all I know the problem *is* a PHB. There are far too many of them around thanks to the Peter Principle and MBA schools. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web