Hi, everyone~
I met a problem: the defualt java version on the unix sever is 1.4, but I'd like to export the 1.6 version on the sever (the 1.6 java exists on the sever)
I wrote the code like this in perl: - system 'export PATH=/usr/java1.6/bin:$PATH';
It works when I just command "export PATH=/usr/java1.6/bin:$PATH" on the shell, but when I run the code I wrote, the sever reposed me: - sh: PATH=/usr/java1.6/bin:/bin:/usr/bin:/usr/local/bin:/usr/openwin/bin:/usr/bin/X11:/usr/ccs/bin:/opt/SUNWspro/bin:/usr/sbin:/usr/ucb:/usr/sfw/bin:/local/share/bin:.: is not an identifier
Could anyone help me?
Thanks a lot in advance.
10 3782
First please put all code in Code tags,
2nd. try - system('export PATH=/usr/java1.6/bin:$PATH');
or - system(`export PATH=/usr/java1.6/bin:$PATH`);
---------------------------------------------------------------------------------------------------------- - PATH=/usr/java1.6/bin:/bin:/usr/bin:/usr/local/bin:/usr/openwin/bin:/usr/bin/X11:/usr/ccs/bin:/opt/SUNWspro/bin:/usr/sbin:/usr/ucb:/usr/sfw/bin:/local/share/bin:.:
this happens because $PATH is a Perl ENV var, its set for the path of perl & you are processing that var. to cancel that in perl you must use single quotes ' or ` or cancel that $ by \$PATH.
First please put all code in Code tags,
2nd. try - system('export PATH=/usr/java1.6/bin:$PATH');
or - system(`export PATH=/usr/java1.6/bin:$PATH`);
---------------------------------------------------------------------------------------------------------- - PATH=/usr/java1.6/bin:/bin:/usr/bin:/usr/local/bin:/usr/openwin/bin:/usr/bin/X11:/usr/ccs/bin:/opt/SUNWspro/bin:/usr/sbin:/usr/ucb:/usr/sfw/bin:/local/share/bin:.:
this happens because $PATH is a Perl ENV var, its set for the path of perl & you are processing that var. to cancel that in perl you must use single quotes ' or ` or cancel that $ by \$PATH.
Thanks for your reply, but both of your methods dont work. I know $PATH is a perl env var, and I use quotes ' ', if using quotes " ", I have to write code like \$PATH
Thanks for your reply, but both of your methods dont work. I know $PATH is a perl env var, and I use quotes ' ', if using quotes " ", I have to write code like \$PATH
But have you tried using backtick's thats `System command`
example: - system(`export PATH=/usr/java1.6/bin:$PATH`);
also what errors are you getting or what output.
try this: - system(`export PATH=/usr/java1\.6/bin:$PATH`);
But have you tried using backtick's thats `System command`
example: - system(`export PATH=/usr/java1.6/bin:$PATH`);
also what errors are you getting or what output.
try this: - system(`export PATH=/usr/java1\.6/bin:$PATH`);
No, they dont work. I also have another question, if my current directory is /mount/autofs/home_mbc/sniu, and I run code like this:
it will repoonse and print out "/mount/autofs/home_mbc/sniu/myperl", but the directory wont change to /mount/autofs/home_mbc/sniu/myperl, it is still /mount/autofs/home_mbc/sniu
No, they dont work. I also have another question, if my current directory is /mount/autofs/home_mbc/sniu, and I run code like this:
it will repoonse and print out "/mount/autofs/home_mbc/sniu/myperl", but the directory wont change to /mount/autofs/home_mbc/sniu/myperl, it is still /mount/autofs/home_mbc/sniu
also you are using the wrong format for system command its better to use - system(`cd myperl`) || die "$!";
it depends on the user that your running perl on, does it have access to myperl?
also are you running perl via CGI or just in CLI ?
No, they dont work. I also have another question, if my current directory is /mount/autofs/home_mbc/sniu, and I run code like this:
it will repoonse and print out "/mount/autofs/home_mbc/sniu/myperl", but the directory wont change to /mount/autofs/home_mbc/sniu/myperl, it is still /mount/autofs/home_mbc/sniu
that will cd in the shell, not in your perl script. Use the chdir() function.
that will cd in the shell, not in your perl script. Use the chdir() function.
Kevin is right, i'm not awake today,
also what are you trying to do?
this will help us more, i know you want to set the path for java but the second topic
that will cd in the shell, not in your perl script. Use the chdir() function.
I see! Thank you !
Is that also the same reason that I cant export java version? Because the command is for shell, not for perl script?
I see! Thank you !
Is that also the same reason that I cant export java version? Because the command is for shell, not for perl script?
I believe so. You may want to look at the %ENV variables if you need to add something to perls path environment at run time. - $ENV{'PATH'} .= ';/usr/java1.6/bin';
I believe so. You may want to look at the %ENV variables if you need to add something to perls path environment at run time. - $ENV{'PATH'} .= ';/usr/java1.6/bin';
Thanks for your help!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Lionel |
last post by:
Hi all,
I would like having more informations on how we could exchange
informations and/or objects between PERL and JAVA.
We have a Java programs that open, maintain and close telnet...
|
by: John Smith |
last post by:
Hello,
I have a rather odd question. My company is an all java/oracle shop.
We do everything is Java... no matter what it is... parsing of text
files, messaging, gui you name it. My question...
|
by: DrUg13 |
last post by:
In java, this seems so easy. You need a new object
Object test = new Object() gives me exactly what I want.
could someone please help me understand the different ways to do the
same thing in...
|
by: Michael |
last post by:
Running DB2 v7 UDB ("DB2 v7.1.0.93", "n031208" and "WR21333") on Windows XP,
I am unable to find out why the "Build for Debug" option within Stored
Procedure Builder is not enabled on Java stored...
|
by: Jean-François Blais |
last post by:
Many must have asked that question. I intend to write a few programs
which will be CPU intensive. I know a little of Java. Would a language
that yields native code, instead of bytecode perfrom much...
|
by: Anthony Irwin |
last post by:
Hi All,
I am currently trying to decide between using python or java and have
a few quick questions about python that you may be able to help with.
#1 Does python have something like javas...
|
by: Janna |
last post by:
I have the Java JVM installes on my server.
I uncommented
extension=php_java.dll
in php.ini
I uncommented and proerpyl filled out the section in php.ini:
java.class.path...
|
by: aapexclient |
last post by:
I have a problem with Java finding my custom class directory. I have searched the forums and tried everything, but nothing seems to work. The <javapgm>.java compiled cleanly and created...
|
by: r035198x |
last post by:
Setting up.
Getting started
To get started with java, one must download and install a version of Sun's JDK (Java Development Kit).
The newest release at the time of writting this article is...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |