Java newbie questions...Setting the classpath in Unix
When you set the classpath, how do you include anything already in the classpath? For instance, if your profile sets your classpath to
"/home/weblogic/:home/weblogic/weblogic.jar, and you want to add MyJar.jar to it, can you enter:
export classpath=~:MyJar.jar
My question really boils down to how do you prefix the existing CLASSPATH environment variable to any new classes or jars you want to add to it. I think it's the tilde, but I'm not sure.
In csh, the CLASSPATH environment variable is modified with the setenv command. The format is:
setenv CLASSPATH path1:path2
In sh, the CLASSPATH environment variable can be modified with these commands:
CLASSPATH = path1:path2:...
export CLASSPATH
====
(From the Sun documentation)
or, in sh,
export CLASSPATH=path1:path2
should work
Similar Messages
-
I am unable to set the classpath from unix shell script
) I am new to java, provide me the solution to my problem, as it is urgent
I am unable to execute shell script on unix machine, the code is given below:
Basically it is not setting the classpath
dbUpload .java is astand alone java program to retrieve the report instance statistics from crystal server
Created a jar file from dbUpload.java as
Jar �cvf dbUpload.jar dbUpload.class
Here is mycode(script.sh)
CLASSPATH=/u01/CrystalList/cecore.jar:${CLASSPATH}:
CLASSPATH=${CLASSPATH}:/u01/CrystalList/cereports.jar:
CLASSPATH=${CLASSPATH}:/u01/CrystalList/dbUpload.jar:
Export CLASSPATH
Echo ${CLASSPATH}
Java dbUploadvenkat123,
if the code you posted is the original code of your script - it has some misspellings. Please try this one - it works for me both on solaris and linux.
#! /bin/bash
CLASSPATH=/u01/CrystalList/cecore.jar:$CLASSPATH
CLASSPATH=$CLASSPATH:/u01/CrystalList/cereports.jar
CLASSPATH=$CLASSPATH:/u01/CrystalList/dbUpload.jar
export CLASSPATH
echo $CLASSPATH
java dbUpload -
How to set the CLASSPATH in Unix Server
Hi, everyone~
Do anyone noe how to set the CLASSPATH in the hp-ux server? I tried the setenv CLASSPATH, but not working.. I think should use export. But my jsp pages still cannot working, dunnoe y?
I wonder is the hp-ux support jsp and servlet or not?
In order to let the jsp and servlet to run properly in the unix server, what kinds of steps should taken ?
Hope somemore who experience with this situation b4 can give me some guidance.. Thanks~~
regards,
tzeyikTomcat ignores any and all CLASSPATH environment variables. Even if you could figure out how to set it, Tomcat wouldn't use it.
Better to learn how Tomcat's CLASSPATH works and how to deploy Web apps properly. - MOD -
How to set the classpath and path from the jsp to call java class function
Hi Exprets,
I have a requirement to call a java class function which returns a hashmap object from the jsp. The java class in present in one jar file and that jar file is location somewhere in unix path. So the requirement is to set the classpath for that jar file and then create the object of the java class and then call the function.
If any one know how to achieve it, please reply as soon as possible.
thanks in advance,
swapna soni.It is never advisable to store large data sets in the session. But it will depend on a lot of factors:
1. How costly is the query retrieving the data from the database?
If it's a complex query with lots of joins and stuff, then it will be better to store it in the session as processing the query each time will take a lot of time and will decrease performance. On the other hand if the query is simple then it's advisable not to store it in the session, and fetch it each time.
2. Are there chances for the data to become stale within a session?
In this case storing the data is session will mean holding the stale data till the user session lasts which is not right.
3. How many data sets does the session already holds?
If there are large no. of data sets already present in the session, then it's strictly not advisable to store the data in the session.
4. Does the server employ some kind of caching mechanism?
Using session cache can definitely improve performance.
You will have to figure out, what is the best way analyzing all the factors and which would be best in the situation. As per my knowledge, session is the only place where session specific data can be stored.
Also, another thing, if the data set retrieved is some kind of data to be displayed in reports, then it would be better to use a pagination query, which will retrieve only the specific no. of rows at a time. A navigation provided in the UI will retrieve the next/previous data set to display.
Thanks,
Shakti -
How can i set the classpath??
CAN ANYONE PLEASE HELP ME HOW TO SET THE CLASSPATH IN WINDOWS ME ,WHAT IS THE RIGHT CODE TO SET THE CLASSPATH I AM USING JDK1.3 VERSION.
THANK YOU VERY MUCH
ERICK LUCCIOTry this way Start->Program->System tools-> System Summary>startup .Try to find the variable classpath,make sure the path is correct.The classpath contain the the *.java & *.class you save. I'm also new in java .This path & classpath question is so trouble to me .Now i'm running jdk1.3.1_2 in WINME ,WINNT AND WIN2000 IN no problem.........
-
Hi
I need to access SDM to deploy the Java patch ( we have X manger enterprise 3)
We try to set the display in UNIX
sb2adm> DISPLAY=10.211.146.141:0.0
sb2adm> export DISPLAY
sb2adm> set |grep DISPLAY
DISPLAY=10.211.146.141:0.0
_=DISPLAY
sb2adm>
sb2adm> xclock
Error: Can't open display: 10.211.146.141:0.0
My questions:
When run the command set |grep DISPLAY it would be show DISPLAY=10.211.146.141:0.0
But in my case it show DISPLAY=10.211.146.141:0.0
_=DISPLAY
Thanks so much for your help!!!!
I would greatly appreciate
Regards
NaveenHi ,
Your shell is ksh (Korn Shell) yout have run export command.
> sb2adm>setenv DISPLAY 10.211.146.141:0.0
> -ksh93:: not found
>
> Note: one of my college who in onshore he can able to access.as per below command
>
> sb2adm> DISPLAY=xxxxxxxxx:0.0
> sb2adm> export DISPLAY=xxxxxxxxx:0.0
> sb2adm> set |grep DISPLAY
> sb2adm > xclock
You can also use same it will work.
OR
sb2adm> DISPLAY=xxxxxxxxx:0
sb2adm> export DISPLAY=xxxxxxxxx:0
sb2adm> set |grep DISPLAY
sb2adm > xclock
Thanks
siva -
Does weblogic.Deployer set the CLASSPATH?
Hi,
I need to deploy an application with the weblogicDeployer utility. Does it automatically
set the CLASSPATH, as is done with the Admin console? Or do I need to set the
CLASSPATH explicitly?
Thanks,
-Amiah. weblogic.Deployer and the console use the same underlying API to
our Deployment subsystem. There shouldn't be any difference in
application behavior (eg classpath).
-- Rob
Ami wrote:
Hi Rob,
When I use the Admin console to deploy a web app, the CLASSPATH for the application
is set automatically. If I use weblogic.Deployer does that also automatically
set the CLASSPATH for the application?
-Ami
Rob Woollen <[email protected]> wrote:
Not sure I understand the question. weblogic.Deployer is a class in
the
weblogic.jar, so weblogic.jar has to be in your classpath to run java
weblogic.Deployer ...
-- Rob -
Help, how to install jvm and set the classpath using a batch file
hello,
i have created my java application and now have to create an installable / batch file which will install the JVM on the users machine and also the java packages such as javamail and the class files that i have created . it also has to set the classpath.
i would like to know if anyone can tell me how to go about iti.e. how can i install the JVM using a batch file and then place the javamial packages etc in the apropriate directory .
or is it advisable to explain it to the user how to go about it in tht user manual.
and would also like to know that if i install the JVM will the path for the java.exe be set
or will i have to set the path explicitly from the "batch file" so that the user can run the application without and problem just by running the java command followed by filename from the command prompt.hi,
I have windows and I use it.
The only problem with the free edition is that you can only create 1 launcher and that during the installation you get 1 popup showing that the installer was created with an unregistered version.
Stijn -
Novice Trying to Set The CLASSPATH Variable
I am trying to compile a file (which can be downloaded at http://java.sun.com/docs/books/tutorial/getStarted/QandE/FirstClass.java). Despite being able to successfully compile several other files, this particular one will not compile. According to my JAVA Tutorial book, the problem may lie in the CLASSPATH variable, but I am having a great deal of trouble trying to set/understand it. My operating system is WINDOWS 2000. PLEASE HELP!!!
in win 2000, the classpath can be set by the following process.
Right Click My Computer icon and click on properties.
(This can be done by going to the Control Panel and Double Clicking the System icon too).
Once you have the properties window of the system click on the 'Advanced' tab.
There is a button called 'Environment variables'.Click on it.
You will have a part called 'System Variables' there.
Here there is an entry called Classpath. Just add the entry of what you want to add to the classpath, separating each entry with a ';' semicolon as mentioned there and click on the Set button.
That should set the classpath.If that does not take effect immediately, restart the system and it will take effect.
Tell me if it worx.
All the best. Bye!
Cheers,
Win! -
Setting the classpath of classes12.zip for Tomcat
Hi
I am using Apache Tomcat webserver and while trying to run a jsp page which intializes oracle.jdbc.driver.OracleDriver it throws an error
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
Please suggest how to set the classpath of classes12.zip in Apache Tomcat
My Code Snippett
<%@ page import="java.util.*,java.sql.*,javax.servlet.*"%>
<body>
<%
Connection con ;
ResultSet rs ;
Statement stmt ;
ResultSetMetaData rsmd ;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
catch(Exception e)
out.println(e);//print the exception on the command prompt
%>The simplest way to do this is to copy classes12.zip to the WEB-INF/lib directory. The JSP should then find this automatically.
As a side note, that is an ancient JDBC driver - you might want to upgrade to something from this millennium. -
How to set the classpath for external .jar files after importing?
Hi techs,
How to set the classpath in WSAD5.1.2 after importing the .jar file to the WEB-INF/lib folder.
urgentI got it.
after importing the jar file to the perspective,we need to right click on project name, go to proprties,
goto java build path,
there we need to include the external jar files. -
How do I set the classpath in runtime?
How can i set the classpath in runtime?
Im downloading my image files in the folder C:/Downloads
I want to set this C:/Downloads as my classpath.
I don want to set it at the initial stage, bcoz I may have to change the downloading directory D:/Selva.
I want to access my */utils/New.gif* image available in the downloading directory by using getResource() method.java.net.URL urldir= new java.net.URL("file://C:/Downloads/");
java.net.URL[] urlarr= new java.net.URL[1];
urlarr[0]=urldir;
java.net.URLClassLoader urlcl= new java.net.URLClassLoader(urlarr); +// Here I get the Error+
url=urlcl.getResource("/lrp/utils/New.gif");
*Error: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader+ -
How to set the classpath in CVM?
Hi everybody,
experimenting with the J2ME Personal Profile Runtime Environment on a Linux PC I wonder how to set the classpath. The command line options only allow me to set the bootclasspath.
My original problems deals with determining the codebase for a class that is contained in a jar.
1) If I put this jar into the bootclasspath, that class is found and can be loaded, but the codebase (retrieved using class.getProtectionDomain().getCodeSource) is NULL.
2) If I put it into the classpath by using the command line option -Djava.class.path=... the class cannot be found by the ClassLoader.
3) If I put the jar into both, the classpath and the bootclasspath, the latter one is applied and result 1) shows up.
Any idea how to work around this?@see http://forum.java.sun.com/thread.jsp?forum=8&thread=410868
-
doing a jsp page which calls for:
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="sun.jdbc.rowset.*" %>
<%@ page import="java.util.*;" %>
at the top of the page , so i downloaded the jar files that i needed and set the classpath to:
C:\jdk1.3.1_01\rowset.jar;C:\jdk1.3.1_01\jdbc2_0-stdext.jar;C:\jdk1.3.1_01\jndi
this is the first time ive set the classpath
but when i run the page i get loads of Error: Could not find package named:
anyone no what im doing wrong?When you say you "set the classpath", does that mean that you changed the system CLASSPATH environment variable, or that you went into the configuration of whatever it is that's running your JSPs and put those jars and directories into the appropriate place?
-
Setting the CLASSPATH from the JVM by a class
Hy experts
I have an application thats searching a jar file and have to access classes from this jar file.
There are two ways to do this:
1.
Loading the jar file byte by byte and create the classes to load them into memory. This is the hard way.
2.
Setting the CLASSPATH variable in the running program! Thats the easy way! May how does it works?
Is there any possiblity to set the classpath in a running application or only in the shell?
Thanks for help
konradthe classpath is readin when you run the JVM ie issue the 'java' command, the environment cant be altered to update a new classpath. However, why not just put the files you wish to load at runtime within the current classpath you've setup. If you use the System.loadLibrary(), you should be able to pick up the classes you wish to readin at run time via this approach.
good luck
rob
Maybe you are looking for
-
My family has always shared an account but I recently got an iPad and MacBook Air for college and we have reached our 5 device limit before I could access my laptop. It seems as if my only option would be to deactivate a device-not ideal, or to crea
-
Bluetooth connection with android
So I've been trying to connect my iPhone 5c with my galaxy s3 to transfer some stuff over but it won't connect. It connects to my car and the speakers I use in my room via Bluetooth but it won't connect to any android phone. Is there a way to fix tha
-
11g preview 4 doesn't recognise JDK
Just downloaded jdevloperbase1111 without JDK, and tried to use it with Java 1.6 update 6. I am prompted to specify the jdk location, but when I do, and click on OK, I get and "Unable to find a Java Virtual Machine" dialog and the following the the c
-
I get this message on my Facebook news feed when someone posts a YouTube video. Don't know why. It's worked fine for years. I am using Safari on my iPad. If I use the Facebook app it works fine. Any thoughts. Thanks, Walid Access Denied You don't hav
-
IPortalComponentRequest.getLocale() does not return country
I am using EP6 SR1. I have specified the langauge & country in the users profile using personalization page. But when I try to get the name of the coutry I do not get anything back. I do get the langauge code. If I change the langauge then the new la