Jar class path in solaris

Hi
I am new to solaris environment. I have a java file which is dependent on xerces.jar. to compile the file i need to set the classpath. pleas let me know how to set class path for xerces.jar which is in usr/raj/ folder structure of solaris machine.
if there is any on the fly method of setting classpath plz let me know....
thanks a lot
raj

What shell are you using?
csh:  setenv CLASSPATH ${CLASSPATH}:/usr/raj/xerces.jarsh/ksh:  CLASSPATH=${CLASSPATH}:/usr/raj/xerces.jar
  export CLASSPATH

Similar Messages

  • Jar Class-Path attribute configuration problems

    java version 1.5.0_14
    OS: Windows Server 2003
    Problem description: Executable jar file needs to access external jar file resources on the same server that executable jar file resides.
    Scenario: Executable jar file resides in a directory called c:\Java. External jar file resides in a directory called c:\Java\itext1
    I have attempted configuring the Class-Path attribute in the manifest with the following:
    java/itext1/itext1.jar or entering itext1/itext1.jar
    I receive the following error message, from the java command:
    c:\>java -jar /java/MyJar.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: com/lowagie/text/pdf/
    BaseFont
    I even unpacked the jar file, to see if I could access the class using the following command below (The class does not have a main method, so I did not expect it to execute, but I would have thought the class would have been located)
    C:\>java java/itext1/com/lowagie/tools/BaseFont
    Exception in thread "main" java.lang.NoClassDefFoundError: java/itext1/com/lowa
    ie/tools/BaseFont
    I am at my wit's end. Does anyone have any suggestions?

    The -jar flag tells the interpreter that the application is packaged in the JAR file format, and to my knowledge, has nothing to do with the classpath attribute within the manifest
    At any rate, I found my problem. When packaging the jar via Eclipse, I had 2 .classpath resource files within the project, which was causing the jar fiile to be built incorrectly.

  • Jar: Manifest-Attribute "Class-Path"

    I've got a problem with the Class-Path-attribute of the JARs manifest-file. So I've written a real simple application to test where the problems occure... but even this trivial app does not work!
    The execution starts at "Starter.java":
    public class Starter{
          public static void main(String args[]){
                packageOne.Caller.callWriter();
    }The class "Caller" is in a JAR ("Caller.jar") in the same directory as Starter.java.
    Caller.java:
    package packageOne;
    public class Caller{
          public static void callWriter(){
                packageTwo.Writer.write("Write this");
    }The class "Writer" is in a JAR ("Writer.jar") in the same directory as Starter.java and Caller.jar.
    Writer.java:
    package packageTwo;
    public class Writer{
          public static void write(String message){
                System.out.println(message);
    }The file Caller.jar consists of Caller.class and the Manifest.mf. The package-structur/the path seams to be all right.
    The file Writer.jar consists of Writer.class and the Manifest.mf. The package-structur/the path seams to be all right.
    If I invoke the Starter with:
    java Starter -classpath Caller.jar;Writer.jareverything's fine.
    Now, I added the following line to the Manifest.mf of Caller.jar:
    Class-Path: Writer.jar(with one empty line between Manifest-Version: 1.0 and the new line.
    So... shouldn't it be possible now, to invoke the application with:
    java Starter -classpath Caller.jar ???
    It doesn't work. So: what have I misunderstood?
    (The error message is:
    Exception in thread "main" java.lang.NoClassDefFoundError: packageTwo/Writer
          at packageOne.Caller.callWriter(packageOne/Caller.java:5)
          at Starter.main(Starter.java:3)

    Hmmm, I tested it and here are the command I ran and their results. Try doing the same on your computer:aleph% mkdir packageOne
    aleph% mkdir packageTwoThat created the directories.aleph% cat > Starter.java
    public class Starter{
          public static void main(String args[]){
                packageOne.Caller.callWriter();
    aleph% cat > packageOne/Caller.java
    package packageOne;
    public class Caller{
          public static void callWriter(){
                packageTwo.Writer.write("Write this");
    aleph% cat > packageTwo/Writer.java
    package packageTwo;
    public class Writer{
          public static void write(String message){
                System.out.println(message);
    }That created the source files: Starter.java in the current directory, Caller.java under packageOne and Writer.java under packageTwo. Next the compiling and creating the manifest file:aleph% javac Starter.java
    aleph% cat > MF
    Class-Path: Writer.jarThat created additional info to be included in manifest file and put it in a file called MF.
    Then I package "caller.jar" with the manifest and "Writer.jar" without it:aleph% jar -cmf MF caller.jar packageOne
    aleph% jar -cf Writer.jar packageTwoDelete the package* directories so java wont get confused...aleph% rm -r package*And finally run the thing. Remember that the path separator is : in unix but ; in DOS, if that is what you are using.aleph% java -cp .:caller.jar Starter
    Write thisNo problems anywhere. What are the steps you did?

  • Multiple Class-Path: attributes in Jar files

    Hello,
    I'm packaging a set of jar files for distribution with Class-Path: attributes in them. In the documentation I read and in one of the java trails it said that I could have a manifest file like:
    Class-Path: log4j.jar log4j-core.jar
    Class-Path: jsse.jar jcert.jar jnet.jar
    But this doesn't work. It only works when I do this:
    Class-Path: log4j.jar log4j-core.jar jsse.jar jcert.jar jnet.jar
    Here is how I'm running the jar:
    java -jar server.jar
    Is the documentation wrong? Or this is a bug?
    thanks
    charlie

    Certain attributes were only meant to be specified once. Like Main-Class and Class-Path for example. If these were listed two or more times, then the last occurance is the one that gets recognized (basically, each new instance overwrites the previous instance). Some attributes are listed as "per-entry" and are freely duplicated for each entry. For example signed jars could have a number of Name: and xxx-Digest: attributes.
    This link is to the manifest spec:
    http://java.sun.com/products/jdk/1.2/docs/guide/jar/manifest.html
    To answer the original posters question, the doc's are in error. Actually, the error was not in the docs, it was in the tutorial, but none the less its still in error. He could have done this:
    Class-Path: log4j.jar log4j-core.jar
    jsse.jar jcert.jar jnet.jar
    ^-- two spaces before the start of jsse.jar
    because the docs allow for line continuation (although it's not exactly clear if you read the docs). The docs are also apparently in error regarding the max line length of 72 bytes. I have tested this with over 100 char's on a win32 machine and it works fine for me. The limitation must therefore apply to some other operating system, or it could just be in error.
    -Ron

  • Please remove Class-Path from kodo-jdo-runtime.jar manifest

    This is repost. Class-Path should not be in manifest of
    kodo-jdo-runtime.jar
    It causes problems with security manager when using signed jars under
    webstart. It can potentially cause all kind of other problems due to class
    path conflicts
    Seems to be a problem in manifest. It is due to Class-Path in manifest. I
    deleted manifest from kodo-jdo-runtime and signed it seems to be ok.
    I got more meaningful error now - serp.jar is missing
    I would suggest to remove Class-Path from this jar. I've seen some very
    weired behaviour of systems with Class-Path in different jars. I believe it
    should be only in your application jar
    Class-Path: serp.jar jca1.0.jar jca.jar crimson.jar xerces.jar jaxp.jar
    jdo1_0.jar jdo.jar jdbc2_0-stdext.jar jndi.jar jta-spec1_0_1.jar jta.jar
    I would also remove following:
    Main-Class: com.solarmetric.kodo.enhance.JDOEnhancer
    OpenTools-UI: com.solarmetric.modules.integration.jbuilder.KodoTools
    OpenTools-Build: com.solarmetric.modules.integration.jbuilder.KodoBuilder
    because it does not belong to kodo-jdo.runtime.jar
    "Alex Roytman" <[email protected]> wrote in message
    news:ahi05g$veq$[email protected]..
    I am having troubles running kodo 2.3 application under web start.
    I am getting following error:
    Missing signed entry in resource:
    http://ptilx1/usorg/webstart/lib/kodo-jdo-runtime.jar
    I signed kodo-jdo-runtime.jar as usual
    The same deployment worked fine with Kodo 2.2.5

    Alex-
    In article <ahk7vi$cmf$[email protected]>, Alex Roytman wrote:
    This is repost. Class-Path should not be in manifest of
    kodo-jdo-runtime.jar
    It causes problems with security manager when using signed jars under
    webstart. It can potentially cause all kind of other problems due to class
    path conflictsThanks for the feedback. We will remove the entries. In general, it is nice
    to have it in the Class-Path, since they you only need to
    kodo-jdo-runtime.jar in the CLASSPATH variable, but we were not aware of
    it causing any problems.
    Seems to be a problem in manifest. It is due to Class-Path in manifest. I
    deleted manifest from kodo-jdo-runtime and signed it seems to be ok.
    I got more meaningful error now - serp.jar is missing
    I would suggest to remove Class-Path from this jar. I've seen some very
    weired behaviour of systems with Class-Path in different jars. I believe it
    should be only in your application jar
    Class-Path: serp.jar jca1.0.jar jca.jar crimson.jar xerces.jar jaxp.jar
    jdo1_0.jar jdo.jar jdbc2_0-stdext.jar jndi.jar jta-spec1_0_1.jar jta.jar
    I would also remove following:
    Main-Class: com.solarmetric.kodo.enhance.JDOEnhancer
    OpenTools-UI: com.solarmetric.modules.integration.jbuilder.KodoTools
    OpenTools-Build: com.solarmetric.modules.integration.jbuilder.KodoBuilder
    because it does not belong to kodo-jdo.runtime.jarCorrect again: we will remove it in the upcoming release.
    "Alex Roytman" <[email protected]> wrote in message
    news:ahi05g$veq$[email protected]..
    I am having troubles running kodo 2.3 application under web start.
    I am getting following error:
    Missing signed entry in resource:
    http://ptilx1/usorg/webstart/lib/kodo-jdo-runtime.jar
    I signed kodo-jdo-runtime.jar as usual
    The same deployment worked fine with Kodo 2.2.5
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Kodo Java Data Objects Full featured JDO: eliminate the SQL from your code

  • Class path issue

    my jar class path is defined in the metainf file.
    after the installation my jar is placed in the folder:
    client/lib/company libs
    and the run time location is from:
    client/bin
    I need to load a configuration file located in:
    client/conf/file.properties
    I added the path ../conf to the class path and i got an exception when i try to load the file.
    I thought of locating the file according to the jar location and added the path: ../../conf
    to the class oath but still....
    does anyone have an idea why cant i load the file?
    thanks,
    Liat

    If you look in the JavaDoc API under Class the method getResource() shows:
    Finds a resource with a given name. This method returns null if no resource with this name is found. The rules for searching resources associated with a given class are implemented by the * defining class loader of the class.
    This method delegates the call to its class loader, after making these changes to the resource name: if the resource name starts with "/", it is unchanged; otherwise, the package name is prepended to the resource name after converting "." to "/". If this object was loaded by the bootstrap loader, the call is delegated to ClassLoader.getSystemResource.
    What this is saying is that it delegates to the call to the classloader, so its the same as saying getClass().getClassLoader().getResource(). The difference is, this method will append the package name of the class you are calling it from if you do NOT have a '/' character as the first character of the string. Your example shows you do NOT have a '/' character at the start. So whatever package name you have for the class that the code snippet is found in, that package name is being prepended to the string AND the '.' are turned into '/' characters.
    In your example, make sure that you use a / at the start. Remember that it first asks the parent loader to find the resource, if that fails, it tries the classpath of the JVM, and finally if that fails, it uses the classpath of the classloader of the class where the call is made. If you use "/conf/maestro-default-user-config.properties", then it will be looking for this file relative to your applications startup root path.

  • Java 5.0 does not recognize wrapped Class-Path in Manifest.MF of .jar file?

    Java: build 1.5.0_05-b05
    Ant: 1.6.2
    I use Ant <jar> task to create a standalone application in a .jar file. I have a very long "Class-Path" in the Manifest.MF file. The long Class-Path is wrapped at every 70th character by the <jar> task. I cannot run "java -jar <the jar file>", because Java runtime cannot find classes.
    I found the following Q&A from ANT's FAQ page,
    Q: Whenever I use the Ant jar or manifest related tasks, long lines in my manifest are wrapped at 70 characters and the resulting jar does not work in my application server. Why does Ant do this?
    A: Ant implements the Java Jar file specification. Please refer to the notes section where it discusses the maximum allowable length of a line and the concept of continuation characters.
    If a jar file produced by Ant does not work in your appserver, and that failure is due to the wrapped manifest, then you need to consult your appserver provider, as it is a bug in their appserver. Far more likely, however, is a problem in your specification of your classpath. It is not Ant's wrapping of your classpath that is the problem.
    Do not raise a bug about this issue until you have checked to ensure that the problem is not due to your classpath specification.
    Any idea?

    "will be searched ALSO."...
    From: http://java.sun.com/docs/books/tutorial/ext/basics/load.html
    Understanding Extension Class Loading
    The extension framework makes use of the new class-loading mechanism in the JavaTM 1.2 platform. When the runtime environment needs to load a new class for an application, it looks for the class in the following locations, in order:
    1. Bootstrap classes: the runtime classes in rt.jar and internationalization classes in i18n.jar.
    2. Installed extensions: classes in JAR files in the lib/ext directory of the JRE.
    3. The class path: classes, including classes in JAR files, on paths specified by the system property java.class.path. If a JAR file on the class path has a manifest with the Class-Path attribute, JAR files specified by the Class-Path attribute will be searched also.
    [snip]

  • How to run a jar file which needs another jar to be in the class path

    Hi,
    I need to execute a jar, which needs another jar to be in the classpath.
    If I run like
    java -classpath <jar1 name> -jar <main jar>
    It is giving classnotfoundexception, where as the class is available in the <jar1 name>.
    so, currently I am doing like this
    In the manifest file i have given like
    Main-Class: <class name>
    Class-Path: <jar name> <jar name2>
    then it is running fine. But, if I want to change the jar location again I need to changed the manifest file.
    Is there any way to do this? Pls help me.

    How about
    java -cp jar1.jar;jar2.jar com.acme.MainClass
    You won't need to worry about the manifest file after that and you can make a bat files (or .sh file in *nix) for it.                                                                                                                                                                                                                                                                                                                                                                       

  • How do I add the system classpath to Jar Manifest Class-Path

    My application is implemented on win2000 and need to be moved to unix as a executable jar file, the oracle jdbc classes (classes12.zip and classes111.zip) were included in MANIFEST.MF as the following:
    Class-Path: /Oracle/Ora81/jdbc/lib/classes12.zip /Oracle/Ora81/jdbc/lib/classese111.zip
    When I move the jar file to unix, the classpath will be changed, is there a way to make the jar file read the class-path from system CLASSPATH?
    Thank you.
    Y.

    I have the same problem for weeks now, and I can't seem to get it solved. If you found anything please inform me.
    thanks in advance
    Eran

  • Jar's manifest Class-Path option

    Hey, hopefully this is my last question for a while.
    I downloaded a custom look and feel that's packaged in a jar file.
    Here's the directory structure.
    Main-Program\*.class
    Main-Program\MyProgram.jar (the created jar)
    Main-Program\Data\kunststoff.jar (downloaded look&feel jar)
    I can compile the class files like this:
    javac -classpath .;Data\kunststoff.jar MainClass.java
    and run it like this:
    java.exe -classpath .;Data\kunststoff.jar MainClass
    This works fine. But I want my program to be an executable jar.
    So I create the exec. jar like usual
    jar cf0 MyProgram.jar *.class
    jar umf mainclass.txt MyProgram.jar
    When I package the jar using the manifest file I include the Class-Path var:
    Manifest-Version: 1.0
    Main-Class: Database
    Class-Path: .;Data\kunststoff
    Now when I try to execute the jar it gives me the error:
    "Could not find the main class. Program will exit!"
    Any ideas? thanks.

    Manifest-Version: 1.0
    Main-Class: Database
    Class-Path: .;Data\kunststoff>
    Better change that to "Class-Path: Data/kunststoff.jar"
    (http://java.sun.com/docs/books/tutorial/jar/basics/manifest.html)
    And remember to have a line break after it..
    Now when I try to execute the jar it gives me the
    error:
    "Could not find the main class. Program will exit!">
    But the main class should still be found even if the class-path entry was not totally correct, does Database.class show in jar tf MyProgram.jar?

  • Alternate drives in Jar file Class-Path attribute

    Hello, all. I am working on a project that I would like to package into a single jar file for simple execution. At my place of work classes from EJB are stored on a different drive from where I am doing the development. I am having trouble accessing those classes from the Jars I am creating. When I try the following manifest:
    Main-Class: MyPackage.MyClass
    Class-Path: U:\someFolder
    the application will not start, saying that MyPackage.MyClass cannot be found. This is despite MyPackage.MyClass being properly packaged into the Jar file, as verified by a jar t operation. When I leave off the drive letter in the Class-Path attribute:
    Main-Class: MyPackage.MyClass
    Class-Path: someFolder
    the application starts and executes properly right up until a class from someFolder is needed, at which point exceptions begin to be thrown.
    Any ideas will be much appreciated!
    John Todd

    I was eventually able to find the answer to my own question: Jars do not accept absolute paths at all, only relative paths. Thus, the alternate drive approach will not work. Fortunately I was able to find an alternate solution.
    John Todd

  • Jar files and class path

    I have a small swing application which connects to an external database and queries something and creates a small report on the local machine. Running from the command line calling the == java MyClass works good. I would like to deploy this to two other machines. I dont want the use to run from the command line solution. I want to run it from a batch file using the jar file. But I am getting a a classpath issue ( ClassNotFoundException for the jdbc drivers ) . I signed my jar file using jarsigner too. I am not interesed in using the Web Start because there are no other security attached to this app. Only couple of people intends to use it. Running from the command line calling the app file explicitly works. In the batch file I added the setclass path too. Still it gives an exception. I added the jdbc driver jar file to the appication jar file too. Still the problem exists.
    Any ideas ?

    instead of including the JDBC driver inside your application's jar, have the two jars sit in a directory separatly and include both of them on your classpath. Or, you can even specify a manifest.mf Class-Path parameter for your application's jar file so that it automatically includes the driver's jar.

  • WAR meta-inf/manifest Class-Path jars use which classloader ?

    If using an expanded EAR structure, my Web App requires some utility classes. I
    can either put these in my :-
    meta-inf/manifest.mf
    Class-Path : utility.jar
    OR
    web-inf/lib
    can contain the utility.jar
    Is there any difference in terms of which classloader is used to load these classes,
    the EAR/EJB classloader or the Web App child classloader ?
    What is recommended ?

    If have found out the answer myself by testing it :-
    A jar in the meta-inf/manifest.mf e.g. Class-Path : utility.jar
    will be loaded by the EAR/EJB level classloader
    whereas
    web-inf/lib containing utility.jar
    will be loaded by the Web App level child classloader.
    Dimitri Rakitine <[email protected]> wrote:
    I have this question too - it appears that 6.1sp2 attempts to use Class-Path
    in jars in WEB-INF/lib - what this Class-Path: is supposed to do ???
    Pete <[email protected]> wrote:
    If using an expanded EAR structure, my Web App requires some utilityclasses. I
    can either put these in my :-
    meta-inf/manifest.mf
    Class-Path : utility.jar
    OR
    web-inf/lib
    can contain the utility.jar
    Is there any difference in terms of which classloader is used to loadthese classes,
    the EAR/EJB classloader or the Web App child classloader ?
    What is recommended ?--
    Dimitri

  • Who knows about Jar/Manifest: Class-Path-Attribute

    My question is:
    When packaging my classes and ressource files into a jar file, everything works fine as long as I put the manifest-file into the parent directory of the package folders (there's the main class too) and set its Class-Path-Attribut just as . (a dot).
    I'm working with WinXP Prof.
    As soon as I fill in a path with backslashes or slashes as separator, the produced jar-file doesn't work (class loader does'nt find main-class).
    Is the problem the drive-letter (D:) in the path or do you know something else?
    Greetings
    Frank

    Yes, and likely the . is what you need ...saying: I want the packages which begin in the same directory as the jar running this application. Even if your class is in a package hierarchy like tst.test.Support.class, if the directory tst is in the same directory as the application jar, you would use classpath . not tst/test/Support.class. If you put the tst package in a directory under the folder where the jar resides, say called testit ...you would then have a classpath in the mainifest like testit/. The class path always needs to get you to the root of any package you want to use ...but not into the package itself. Java recognizes when it is looking at a package nesting due to the package declaration syntax in the files, the classpath just points to the location of the root of that package and nothing more. Does this make sense?

  • Classloader isolation and jar manifest Class-Path headers

    I have a system where I am loading a set of jars, each with its own URL classloader. So, Jar a is loaded by Loader A, jar b is loaded by Loader B, and so on.
    Each jar has a Manifest Class-Path entry declaring its dependence on other jars. So in the example above, a puts c.jar in its Class-path, and, let's say, b also puts c.jar in its Class-path, unbeknownst to a.
    Let's say there's a class Foo in c.jar. I want--need--it to be the case that (loader of a.jar == Foo.class.getClassLoader()) from the perspective of classes found in a.jar, and (loader of b.jar == Foo.class.getClassLoader()) from the perspective of classes found in b.jar.
    That is, I want a and b to have their own isolated "copies" of c.jar.
    Instead, what I'm finding is that Foo.class is loaded once, and his loader "leaks" over to the other jar's loader, if that makes any sense.
    Is there any way to accomplish what I am talking about here?
    Laird

    As I understand the question - no.Hi; I think you misunderstand the question.
    The classes are being loaded by the system loader.
    Thus there is no way to seperate them.
    If you want them seperate then you must use an
    explicit class loader to load them.I am using explicit loaders to load them. Let me try again, because I don't think I was clear.
    I have an application that has, let's say, nothing at all in its classpath. That is, it was invoked via "java ApplicationMainClass". No classpath.
    Now that application reads, let's say, a properties file containing a list of URLs that point to jars.
    Now the application creates a new URLClassLoader for each such URL. So if the mythical properties file has ten lines, then I create ten classloaders, each of which points to one and only one URL.
    My problem is, even classes loaded by these isolated, separate classloaders are "leaking" across to other loaders. Remember, the parent classloader of all of these classloaders can't see the jars. Its classpath was empty, remember?
    The issue is that the findLoadedClass() method of java.lang.ClassLoader scans the whole VM to see if a given Class was loaded before, and if it was, then by default that Class is simply returned. But I don't want that behavior.
    Now, I also don't want the behavior of having to load the silly things off disk each and every time. So how do I retain this true multiple classloader isolation?
    Thanks,
    Laird

Maybe you are looking for

  • Security Update 2008-008 knocks out router

    Since installing security update 2008-008 on two computers (MacBook Pro and Power Mac G5, both running OS 10.4.11) earlier this week, my router (Belkin Wireless G model F5D7230-4) no longer connects me to the internet. I also found that my Network pr

  • Laserjet Pro 400 color MFP M475dw print in black and white

    Hello, I have a Laserjet Pro 400 color MFP M475dw printer that is contected to a network so that multiple users can print from it. I want to be able to restrict it so that they can only print in black and white and double sided. Is this possible? and

  • Formatting error in table footer in smartform

    hi in the footer of table in smartform currency field vbrp-cmpre and quantity field vbrp-fkimg  are cuming with leading spaces as follows:                     32.000 copies @ Rs.                       7.00= 2.24 this should come as : 32 copies @ Rs.

  • How do I put grid lines on my picture?

    I need to put grid lines on a picture for an art class. The lines have to be visable when I print it out and I have no idea how to do it. Anything will help, thanks

  • Expense Report Template in Payables Migration

    is there a way to migrate expense report templates from one instance to another instance using fndload or any other methods. Please reply. Thanks, -Pbhav