About path and classpath in linux
How to set classpath and path in Linux.
thank you very much!
The class path can be set using either the -classpath option when calling an SDK tool (the preferred method) or by setting the CLASSPATH environment variable. The -classpath option is preferred because you can set it individually for each application without affecting other applications and without other applications modifying its value.
% sdkTool -classpath path1:path2...
-or-
% setenv CLASSPATH path1:path2...
where:
sdkTool
A command-line tool, such as java, javac, or javadoc. For a listing, see SDK Tools.
path1:path2
Paths to the .jar, .zip or .class files. Each path should end with a filename or directory depending on what you are setting the class path to:
For a .jar or .zip file that contains .class files, the path ends with the name of the .zip or .jar file.
For .class files in an unnamed package, the path ends with the directory that contains the .class files.
For .class files in a named package, the path ends with the directory that contains the "root" package (the first package in the full package name).
Multiple path entries are separated by colons.
The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings.
Classpath entries that are not either a directory or an archive (.zip or .jar file) are ignored.
Similar Messages
-
Setting Path and Classpath in Linux environnement
Hello,
I use to develop with JAVA under Windows platform,
now i am using j2sdk under Mandrake 8.0 , i dunno how to set my PATH end Classpath variables, could you show me how?
ThanksPut this in your user's .bashrc file at the end of it.
JAVA_HOME=/path/to/java/install
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATHAnd buy a book on Unix/Linux. -
How to go about Setting PATH and CLASSPATH?
I have problems compling the helloworldwww in the core programming.the error was:
Exception in thread "main"java.lang.NoSuchMethodError:main
my java programs are in c:\program files\java\bin
My path :
PATH=C:\WINNT\system32;C:\WINNT;c:\program files\java\bin
My classpath
set CLASSPATH=C:\WINNT\system32;C:\WINNT;c:\program files\java\bin.jar;.
is there any error in my paths, if yes how to i go about setting the path and classpath??Im running on winXP.j2sdk1.4.1_02.set CLASSPATH=.;c:\program files\java\bin.jar;c:\program files\java\bin
-
Problem in setting path and classpath for java in RedHat linux 9
Hi ,
i am not able to set the PATH and CLASSPATH for j2sdk1.4.2_06
I have tried with export PATH=$PATH:/usr/j2sdk1.4.2_06/bin
and export CLASSPATH=$CLASSPATH:/usr/j2sdk1.4.2_06/lib
in terminal
but i want to configure it as permenant way for the jre and jdk
and we should only type java or javac according to the requirement
regards mihir...type those in .bashrc ... save and exit
then at prompt, type 'source .bashrc'
this is the permanent solution ...
bhalo thakun -
Difference between path and classpath
Difference between path and classpath?
PATH - set of paths there executables will be found.
CLASSPATH - set of paths and archives there class files will be found. -
by using ANT, how can set the JDK path and classpath..
jdk version exists in the : C:\Program Files\Java\jdk1.6.0
This is the build.xml that i need to modify!
-Do i need to have a serperate JAVA_HOME variable?
<?xml version="1.0"?>
<!--
Build file for 'Chat Client'
Version: $Revision: 4.10 $ $Date: 2003/05/28 $
Author: Rajat Gupta
-->
<project name="Chat" default="jar" basedir=".">
<!-- ================================================================== -->
<!-- Initialization of all property settings -->
<!-- ================================================================== -->
<target name="init">
<property name="appname" value="chat" />
<property name="src.dir" value="src" />
<property name="lib.dir" value="lib" />
<property name="build.dir" value="Chat" />
<property name="build.compiler" value="classic" />
</target>
<!-- ================================================================== -->
<!-- Makes sure the needed directory structure is in place -->
<!-- ================================================================== -->
<target name="prepare" depends="init">
<mkdir dir="${lib.dir}" />
<mkdir dir="${lib.dir}/META-INF" />
<mkdir dir="${build.dir}" />
</target>
<!-- ================================================================== -->
<!-- Compilation of the web part of the application -->
<!-- ================================================================== -->
<target name="classes" depends="prepare">
<javac srcdir="${src.dir}/oracle/otnsamples/oc4jjms"
destdir="${lib.dir}"
includes="**" />
</target>
<!-- ================================================================== -->
<!-- Compilation of the complete J2EE application (both web and EJB) -->
<!-- ================================================================== -->
<target name="j2ee-meta-inf" depends="classes, prepare">
<copy file="${src.dir}/META-INF/application-client.xml"
tofile="${lib.dir}/META-INF/application-client.xml" />
<copy file="${src.dir}/images/oralogo.gif"
tofile="${lib.dir}/oralogo.gif" />
</target>
<target name="jar" depends="j2ee-meta-inf">
<jar jarfile="${build.dir}/${appname}.jar"
basedir="${lib.dir}" manifest="${src.dir}/META-INF/MANIFEST.MF"/>
<delete dir="${lib.dir}" />
</target>
</project>Message was edited by:
jugp[url ='http://www.jguru.com/forums/home.jsp?topic=Ant']answer here
-
How do i set path and classpath in java? why it is needed
ramyabaskar wrote:
How do i set path and classpath in java? why it is neededTypically you do not set these in java.
You set the path in the operating system shell.
You set path so you can launch java by just typing java
instead of having to type the full path to "C:\Program Files\Java\jre6\bin\java.exe".
You pass the desired classpath to java when you launch java with the classpath option or set it in the operating system shell using the CLASSPATH env.var. -
Setting PATH and CLASSPATH in Java Applet
Hi,
I have been wondering if there was a way to set the PATH and the CLASSPATH in the HTML file within the <APPLET> tag...
What I would like to do is to read some xml files outside of the directory where my html file is located to run my test application with the configuration on my computer.
(The applet and the html file from which it is called is on my local host.)
Therefore, I have seen that in order to access local files, I have to sign my jar files, which I did.
But the tricky part is that for my test application to work, I need to set the PATH and the CLASSPATH... and I have no idea if this is possible or not...
I have seen that:
*CODEBASE: I specify here the main directory where my jar files are located
*ARCHIVE: I specify here the list of my jar files
In my case:
CODEBASE=../../ (this is the root directory of my whole application)
ARCHIVE=dir/lib/jar1.jar,dir2/jar2.jar,configXML/,etc...I don't know if I can specify the filepath of my xml files (here "configXML") in ARCHIVE (I suspect we can only specify jar files there... right ?)
Maybe I can use ARCHIVE this way to specify my CLASSPATH (and well... not completely the way I would like I suppose), but what about the PATH ?
I have been searching this for soooo long now...
Any help, hint or suggestions (I might doing this all the wrong way...) would be greatly appreciated !
Thanks in advance !You need to use the code attribute to specify the class that contains the main method to start the application.
<applet code="myPackage.myClass.class" codeBase="http://www.someServer/someFolder/" archive="myApplet.jar">
I hope this solves part of your problem at least.
Andrew -
PATH and LD_LIBRARY_PATH on Linux
Hi
I want to run an executable within a java program, since the executable requires certains dirs in its PATH, i need to set the PATH and LD_LIBRARYPATH. I am not sure how to set the LD_LIBRARY_PATH since i dont know what the system property name for the same is in java
StringBuilder commandToExecute = new StringBuilder();
commandToExecute.append(userdir.getAbsolutePath());
commandToExecute.append(File.separator);
commandToExecute.append("apps");
commandToExecute.append(File.separator);
commandToExecute.append("web");
commandToExecute.append(File.separator);
commandToExecute.append("bin");
commandToExecute.append(File.separator);
String path = "//home//rick//server//bin//" + ":" +"//home//rick//web//bin//";
System.setProperty("java.library.path", path);
System.out.println("PATH after modification and before running exe on unix : " + System.getProperty("java.library.path"));
// How to set the LD_LIBRARY_PATH? What is the java system property that corresponds to it?
commandToExecute.append(exe_UNIX_COMMAND);Could you please let me know what java system property represents LD_LIBRARY_PATH?
Thanks a lot.Nish_B wrote:
If there is no java system property for LD_LIBRARY_PATH, then what is the other way to set it via java code?Probably the simplest thing would be to invoke a shell script that sets it.
Otherwise you might be able to invoke a shell, set the env var as part of the shell's invocation, and tell the shell to execute your other program. I'd go with the script approach though.
If you need to know what that var was in the context of the environment where your JVM was spawned (which seems unlikely), you should be able to get it with System.getenv. -
Using javac and classpath with Linux
My classpath is
/usr/java/jdk1.3.1_02/bin (that's the path to jdk1.3.1)
but I get a
/usr/java/jdk1.3.1_02/bin/i386/native_threads/javac: error while loading shared libraries: libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory
error when I try to compile a java file with javac. tried to set the classpath to
/usr/java/jdk1.3.1_02/bin/i386/native_threads/
and I get another error with that
Any help is appreciated, thanks<http://developer.java.sun.com/developer/bugParade/bugs/4405489.html>
Assuming you are using RedHat, if other search at rpmfind.net for your distro (if it's a RPM-based distro):
You need either:
For RedHat 7.1: <http://www.rpmfind.net//linux/RPM/redhat/7.1/i386/compat-libstdc++-6.2-2.9.0.14.i386.html>
For RedHat 7.2:
<http://www.rpmfind.net//linux/RPM/redhat/7.2/i386/compat-libstdc++-6.2-2.9.0.16.i386.html>
The CLASSPATH values have already been specified in many other posts.
Bhav -
How to set the variable of "path" and classpath" in winxp
I down a sdk1.4.2_01 and use it in windows xp system,I can use "javac";
but when I run "java *****"(eg: java abc),it do not work.
The infomation is "Exception in thread "main" java.lang.NoclassfoundError:"
I set my source code "C:\j21".
PATH:
C:\j2sdk1.4.2\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
CLASSPATH:
C:\j2sdk1.4.2\lib\tools.jar;.;c:\jdk1.4\lib\dt.jar;C:\j21;
I am a new user and need your help.
Email: [email protected]http://java.sun.com/j2se/1.4/install-windows.html#Environment
hope this help!!! java tutor style :D -
How to set BO SDK path and classpath in cmd
Hi,
I am new to BO sdk .. I am working on BO XIR2 SDK. I need to run the java program using command prompt. In lib directory of the BO SDK, I have jar files.Could anybody let me know how to set the path, classpath related to BO SDK in command prompt?
Regards,
NishaHi Nisha,
Use like this
set path=%PATH%;C:\Program Files\Java\jdk1.6.0_30\bin
set CLASSPATH=%CLASSPATH%;D:\javaprograms\JAR Files\sqljdbc4.jar
cd C:\Program Files\Java\jdk1.6.0_30\bin
java happy2
In line1 : We are setting the Path
line2 : We are setting Classpath
line3 : Navigating to actual execution directory
line4 : Executing the actual java class file
Hope this helps!
Regards,
Mani -
How do I sett path and classpath in win98
I have downloaded I have tried but it doesn't work...
I just don't know how to do, almost tried everything (not the
right way of course)!
I would really be happy if someone could tell me how to do!The installation instructions are supplied with the JDK download. Otherwise, I found them on this site after 1 minute of searching
http://java.sun.com/j2se/1.4.1/install-windows.html
Work your way through these, and if you are still having troubles, feel free to post back here with details of the specific problem you have. -
this is really frustrating ive been googling for hours trying to find the solution! any help would be greatly appreciated. I have windows 7 and the newest gen ipod nano
For general advice see Troubleshooting issues with iTunes for Windows updates.
The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
tt2 -
Problem with Class and Classpath
Hello ME Windows Users, now before you place a wry smile on your face, I have a problem with path and classpath. Stop it, I can see you smiling!
By visiting the the last 10 pages of the forum and reading Sun installation notes, some tooldocs and by given some answers by some nice people, I have become an expert in turning off my computer, about 10 times/hr. I still am trying to make my first cup of java.
With the ME computer,
I'm unable to right click on the desktop and go to properties, advanced,
I'm unable to go go start, run, sysedit,
I'm unable to change the ms-dos window of autoexec.bat, it just shuts down.
Now before you tell me, I should of bought a different computer, the only place I can find to modify the path and classpath is in the environment which is in system configuration under tools. Here I have placed numerous configurations, like
C:\java>set path=%path%;c:\j2sdk1.4.2\bin
C:\java>set classpath=%classpath%;.;
;java_dir\bin where ;java_bin is c:\j2sdk1.4.2
.; java_dir\bin; %path% where ;java_bin is c:\j2sdk1.4.2 and the list goes on.
But, I know you are still smiling, the % signs comes up in a dialog box, saying too many, and will not convert the text to the environment to be saved when I close down for the tenth time in the last hour.
Can someone help me before I make a real cup of coffee and accidentally drop it on the ME box.
Have a laugh on me Mik.C:\java>set path=%path%;c:\j2sdk1.4.2\binGood
But it is no good because it has to many % and a dialog box appears, saying you have too many parameters.
Are you saying I have to shutdown again to answer your ?
From the HELP menu-
To confirm startup commands line by line
Click Start, and then click Shut down.
Click Restart, click OK, and then press and hold the CTRL key until the Windows Startup Menu appears.
Enter the number for Step-by-step confirmation, and then press ENTER.
For each command you want to run, press Y.
If the command runs successfully, you are prompted with the next command.
If the command does not run successfully, you receive an error message.
To skip a command, press N.
Mik
Maybe you are looking for
-
Airtunes drops out every 15-30 seconds?
Any advice? As of yesterday, my airport express connected to my stereo stops playing music every 15-30 seconds. Very annoying! Did a factory reset and still having the problem. Any hints?
-
Incomplete data or ORA-28528 errors when accesing an Informix Server
We have configured a dblink to an Informix Server. We are using UnixODBC + Informix CSDK on a RHEL 4 x86_64. After running several queries we have seen 3 different situations: A. The result of the query is correct. B. The result is incomplete. The ta
-
Hello, I have a question regarding DESADV idoc. DESADV idoc creates and inbound delivery. We have this problem : we need to create our inbound delivery right after the PO creation. Do you know if the DESADV idoc can update an existing inbound deliver
-
i did everything the help window told me to,reset the iphone,turn it off and back on,turn of my mac,reset the phone ebverything but is not working anybody help me out plz!!! IT WONT RECOGNIZE MY IPHONE 5,I HAVE THE LATEST UPDATE FOR ITUNES FORMY MACM
-
Hi All, What is Activate correlation and Throw Exception(function text possible values) In Control Tab in process Control. Thanks in advance.