Sponsored Content
Full Discussion: How to override Classpath?
Top Forums Shell Programming and Scripting How to override Classpath? Post 302778541 by mohtashims on Monday 11th of March 2013 07:25:33 AM
Old 03-11-2013
I did paste the contents but for some reason I dont see my post reflected. Posting the contents again

Code:
######################################

WL_HOME="/tmp/bea103/wlserver_10.3"
export WL_HOME

. "${WL_HOME}/common/bin/commEnv.sh"

# Check that the WebLogic classes are where we expect them to be
if [ ! -f "${WL_HOME}/server/lib/weblogic.jar" ]; then
  echo
  echo "The WebLogic Server wasn't found in directory ${WL_HOME}/server."
  echo "Please edit the startWebLogic.sh script so that the WL_HOME"
  echo "variable points to the WebLogic installation directory."

# Check that java is where we expect it to be
elif [ ! -d "${JAVA_HOME}/bin" ]; then
  echo
  echo "The JDK wasn't found in directory ${JAVA_HOME}."
  echo "Please edit the startWebLogic.sh script so that the JAVA_HOME"
  echo "variable points to the location of your JDK."

else

CLASSPATH="${WEBLOGIC_CLASSPATH}${CLASSPATHSEP}${CLASSPATH}"
export CLASSPATH

# Import extended environment

if [ -f extEnv.sh ]; then
  . extEnv.sh
fi
if [ ! -z "${EXT_PRE_CLASSPATH}" ]; then
  CLASSPATH="${EXT_PRE_CLASSPATH}${CLASSPATHSEP}${CLASSPATH}"
fi
if [ ! -z "${EXT_POST_CLASSPATH}" ]; then
  CLASSPATH="${CLASSPATH}${CLASSPATHSEP}${EXT_POST_CLASSPATH}"
fi

if [ ! -z "${EXT_PRE_PATH}" ]; then
  PATH="${EXT_PRE_PATH}${PATHSEP}${PATH}"
fi
if [ ! -z "${EXT_POST_PATH}" ]; then
  PATH="${PATH}${PATHSEP}${EXT_POST_PATH}"
fi

# Get PRE and POST environment
if [ ! -z "${PRE_CLASSPATH}" ]; then
  CLASSPATH="${PRE_CLASSPATH}${CLASSPATHSEP}${CLASSPATH}"
fi
if [ ! -z "${POST_CLASSPATH}" ]; then
  CLASSPATH="${CLASSPATH}${CLASSPATHSEP}${POST_CLASSPATH}"
fi

if [ ! -z "${PRE_PATH}" ]; then
  PATH="${PRE_PATH}${PATHSEP}${PATH}"
fi
if [ ! -z "${POST_PATH}" ]; then
  PATH="${PATH}${PATHSEP}${POST_PATH}"
fi

echo CLASSPATH=${CLASSPATH}
echo
echo PATH=${PATH}
echo
echo "Your environment has been set."

fi
#####################################################

 

10 More Discussions You Might Find Interesting

1. IP Networking

Override

Hi My computer of late started misbehaving. Whenever I switch it on It say Override and then it takes long to boot. Surprising is that it opens excel automatic. What could be that? (1 Reply)
Discussion started by: Mulo
1 Replies

2. Shell Programming and Scripting

how to set classpath in cron

i have written shell script that script has path to java programwhen irun this script in terminal i get the output but when irun in cron it gives me eror.plz send me code to set classpath #! /bin/bash javac Copy.java /usr/bin/java Copy plz help me out how should i write classpath... (1 Reply)
Discussion started by: sari
1 Replies

3. UNIX for Dummies Questions & Answers

Classpath

This question is realted to UNIX and Java. I sing in to a UNIX server and I want to change my CLASSPATH locally, so it won't affect any other users CLASSPATHS. Is the command 'export PATH=...' the way to do it? Thanks. Duplicate post (0 Replies)
Discussion started by: Rachel Ross
0 Replies

4. Programming

Classpath

This question is realted to UNIX and Java. I sing in to a UNIX server and I want to change my CLASSPATH locally, so it won't affect any other users CLASSPATHS. Is the command 'export PATH=...' the way to do it? Thanks. (4 Replies)
Discussion started by: Rachel Ross
4 Replies

5. Programming

regarding classpath java

Hi, I have a below command.... $JAVA_HOME/bin/java -cp "/usr/orabase/product/10.2.0/lib:/usr/java/javajar/common/sched.jar:/usr/orabase/product/10.2.0/jdbc/lib/ojdbc14_g.jar:/usr/orabase/product/10.2.0/jdbc/lib/classes12.jar" com.abrt.smart.Smart I want to know where the Smart.class is... (1 Reply)
Discussion started by: PRKS
1 Replies

6. Web Development

Servlet CLASSPATH for Apache

Hi All, I'm trying to play around with Java Servlets. I have a apache web server running on Solaris. And I'm trying to understand which file I add the JAVA CLASSPATH too so that when apache starts up it will have access to mysql interface libraries etc. Could some one please tell me? ... (0 Replies)
Discussion started by: fishman2001
0 Replies

7. Programming

set javac classpath

I have several jar files in a specific folder, but I can't get javac to understand it. How do I set the classpath for javac. It is NOT the same classpath as the java command. And it's not enough with one jar file. I have several. (1 Reply)
Discussion started by: locoroco
1 Replies

8. Programming

Classpath of JAVA

Hello, ABC question as I could not get a direct answer: How to locate the default IO class of JAVA? My question was triggered by the row in most java programimport java.io.* as I am very curious where the io class is located in my Mint14 (Ubuntu12.10). I am aware it is similar to use DBI in PERL,... (1 Reply)
Discussion started by: yifangt
1 Replies

9. UNIX for Advanced & Expert Users

Fedora java classpath

What is the proper way to set your java classpath? (0 Replies)
Discussion started by: cokedude
0 Replies

10. Solaris

CLASSPATH Issue in SunOS

Hi Friends I need to add path to CLASSPATH in weblogic start OS is SunOS dcuatapp04 5.11 11.3 sun4v sparc sun4v I follow instructions given in below link. but even startup log shows the new path it does not load the jar file. how can i fix this Oracle WebLogic Server 12.1.3 Developer... (6 Replies)
Discussion started by: ded325
6 Replies
Path(3pm)						User Contributed Perl Documentation						 Path(3pm)

NAME
Env::Path - Advanced operations on path variables SYNOPSIS
use Env::Path; # basic usage my $manpath = Env::Path->MANPATH; $manpath->Append('/opt/samba/man'); for ($manpath->List) { print $_, " " }; # similar to above using the "implicit object" shorthand Env::Path->MANPATH; MANPATH->Append('/opt/samba/man'); for (MANPATH->List) { print $_, " " }; # one-shot use Env::Path->PATH->Append('/usr/sbin'); # change instances of /usr/local/bin to an architecture-specific dir Env::Path->PATH->Replace('/usr/local/bin', "/usr/local/$ENV{PLATFORM}/bin"); # more complex use (different names for same semantics) my $libpath; if ($^O =~ /aix/) { $libpath = Env::Path->LIBPATH; } else { $libpath = Env::Path->LD_LIBRARY_PATH; } $libpath->Assign(qw(/usr/lib /usr/openwin/lib)); $libpath->Prepend('/usr/ucblib') unless $libpath->Contains('/usr/ucblib'); $libpath->InsertAfter('/usr/ucblib', '/xx/yy/zz'); $libpath->Uniqify; $libpath->DeleteNonexistent; $libpath->Remove('/usr/local/lib'); print $libpath->Name, ":"; for ($libpath->List) { print " $_" }; print " "; # simplest usage: bless all existing EV's as Env::Path objects use Env::Path ':all'; my @cats = PATH->Whence('cat*'); print "@cats "; DESCRIPTION
Env::Path presents an object-oriented interface to path variables, defined as that subclass of environment variables which name an ordered list of filesystem elements separated by a platform-standard separator (typically ':' on UNIX and ';' on Windows). Of course, core Perl constructs such $ENV{PATH} .= ":/usr/local/bin"; will suffice for most uses. Env::Path is for the others; cases where you need to insert or remove interior path entries, strip redundancies, operate on a pathvar without having to know whether the current platform uses ":" or ";", operate on a pathvar which may have a different name on different platforms, etc. The OO interface is slightly unusual in that the environment variable is itself the object and the constructor is Env::Path->AUTOLOAD(); thus Env::Path->MANPATH; will bless $ENV{MANPATH} into its package while leaving it otherwise unmodified (with the exception of possible autovivification). Unlike most objects, this is a scalar and thus can have only one attribute; its value. In other words, Env::Path simply defines a set of methods a path variable may call on itself without changing the variable's value or other semantics. Also, while the object reference may be assigned and used in the normal style my $path = Env::Path->CLASSPATH; $path->Append('/opt/foo/classes.jar'); a shorthand is also available: Env::Path->CLASSPATH; CLASSPATH->Append('/opt/foo/classes.jar'); I.e. the name of the path variable may be used as a proxy for its object reference. This may be done at 'use' time too: use Env::Path qw(PATH CLASSPATH); # or qw(:all) to bless all EV's CLASSPATH->Append('/opt/foo/classes.jar'); The design is intended to make use of this module as lightweight as possible. Rather than creating a new object to manage an environment variable, the environment variable is provided a set of methods for self-modification but is otherwise left undisturbed and can be used in all normal ways. CLASS METHODS o <CONSTRUCTOR> The constructor may have any name; it's assumed to name a path variable as defined above. Returns the object reference. o PathSeparator Returns or sets the platform-specific path separator character, by default : on open platforms and ; on monopolistic ones. INSTANCE METHODS Unless otherwise indicated these methods return the object reference, allowing method calls to be strung together. All methods which take lists join them together using the value of "Env::Path->PathSeparator". o Name Returns the name of the pathvar. o Contains Returns true iff the specified entry is present in the pathvar. o Assign Takes a list and sets the pathvar to that value, separated by the current PathSeparator. o List Returns the current path in list format. o Prepend For each entry in the supplied list, removes it from the pathvar if present and prepends it, thus ensuring that it's present exactly once and at the front. o Append Analogous to Prepend. o InsertBefore Takes a <dirname> and a list, inserts the list just before the first instance of the <dirname>. If dirname is not found, works just like Prepend. As with Prepend, duplicates of the supplied entries are removed. o InsertAfter Analogous to InsertBefore o Remove Removes the specified entries from the path. o Replace Takes a /pattern/ and a list. Traverses the path and replaces all entries which match the pattern with the concatenated list entries. o ListNonexistent Returns a list of all entries which do not exist as filesystem entities. o DeleteNonexistent Removes from the path all entries which do not exist as filesystem entities. o Uniqify Removes redundant entries (the 2nd through nth instances of each entry). o Whence Takes a pattern and returns an ordered list of all filenames found along the path which match it and are executable. o Shell Returns a string suitable for passing to a shell which would set and export the pathvar to its current value within the shell context. NOTES
o No provision is made for path variables which are not also environment variables, a situation which is technically possible but quite rare. o Except where necessary no assumption is made that path entries should be directories, because pathvars like CLASSPATH may contain "virtual dirs" such as zip/jar files. For instance the DeleteNonexistent method does not remove entries which are files. In Perl terms the test applied is "-e", not "-d". o The shorthand notation for pathvar FOO is implemented by hacking @FOO::ISA, so there's a slight risk of namespace collision if your code also creates packages with all-upper-case names. No packages are created unless the shorthand notation is employed. o There's some cute code in the Env module by Gregor N. Purdy for splitting pathvars into arrays using ties. I'd love to be able to take advantage of that, and it pains me to do the same thing (and not as well) here rather than using Env. Unfortunately it's a newish feature (5.6.0? 5.005? 5.6.1?) in Env and I don't want Env::Path to be "tied" to the very latest Perls. WORKS ON
UNIX and Windows. AUTHOR
David Boyce <dsbperl AT boyski.com> COPYRIGHT
Copyright (c) 2000-2001 David Boyce. All rights reserved. This Perl program is free software; you may redistribute and/or modify it under the same terms as Perl itself. SEE ALSO
perl(1), perlobj(1), Env::Array(3) perl v5.10.1 2006-11-09 Path(3pm)
All times are GMT -4. The time now is 01:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy