Adding jar file in my gerareted jar file using netbean 4.0

Hi,
I write an application de process XML file using JDOM. I add the JDom package jar file to my project and everything work fine. But when I generate, my project jar file using netbean 4.0, my generated jar, is not working with the XML files anymore. Everything seems like it didn't include the JDOM jar file?
Thanks for any help to fix the problem.

I find that you can not use command-line such as java -classpath add classpath
it can not work, I use netBeans4.0 i don't whether because of netbeans or java itself.
you can add classpath in jar's Manifest.mf file
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.5.0_01-b08 (Sun Microsystems Inc.)
Main-Class: chat.Main
// add this line
Class-Path: dir\*.jar //(jar file name)
X-COMMENT: Main-Class will be added automatically by build

Similar Messages

  • How to call a java application in a jar which is in a war file of a ear ?

    So sorry to cross post, but no response in other topics.....
    Please help!
    I have a Ear file which contains a war file.
    xx.ear/META-INF
    xx.ear/YY.war
    and the YY.war has the following structure:
    YY.war/META-INF
    YY.war/WEB-INF
    YY.war/WEB-INF/classes
    YY.war/WEB-INF/classes/com/
    YY.war/WEB-INF/classes/com/mycompany/
    YY.war/WEB-INF/classes/com/mycompany/MyClass.class
    MyClass.class is a java application which has a main method.
    how can I call this MyClass applicaiton from the xx.ear??
    java -???? com.mycompany.MyClass ??
    Please help because I have a Unix cron job need to access this class externally outside AppServer. Thx!!

    an ear file is a standard jar with a different extension. You may
    be able to get away with just adding a manifest file to it that
    specifies the main class (make it an executable jar with a different
    extension).
    I don't know if this will handle the nested war file though. It may.
    matfud

  • Problem accessing Application Ejb Jar files from Apache Axis jars

    I have deployed an EAR application, with a structure as shown below,
    MyApp.ear
    |____ MyApp_Ejb.jar
    |____ axis.war
    |_____ WEB-INF
    |_____ lib (This contains all axis specific jars)
    The application deploys just fine. But when i goto happyaxis.jsp and try to view all the web services that have been deployed. I get an exception "No provider type matches QName '{http://xml.apache.org/axis/wsdd/providers/java}SDL".
    Here SDL is a custom provider that i have written and all the required files for the provider are available in MyApp_Ejb.jar.
    I do not get as to why the axis.jar is not able to find classes in MyApp_Ejb.ear, when both these are in the same ear.
    Now i know i can add a utility jar to a war files classpath by adding a classpath line in the War file MANIFEST.MF. But since MyApp_Ejb.jar is defined as a Web Module this solution too doesnt help.
    Separating the provider related files from MyApp_Ejb.jar is not possible since there is too much dependance of other files within that jar.
    So i am looking for a solution where in i can continue to have MyApp_Ejb.jar as my ejb module as well as the axis related jars can find the required classes within MyApp_Ejb.jar. some way of sharing the ejb jar across to axis jars.
    Thanks in advance.
    Vicky

    I have deployed an EAR application, with a structure as shown below,
    MyApp.ear
    |____ MyApp_Ejb.jar
    |____ axis.war
    |_____ WEB-INF
    |_____ lib (This contains all axis specific jars)
    The application deploys just fine. But when i goto happyaxis.jsp and try to view all the web services that have been deployed. I get an exception "No provider type matches QName '{http://xml.apache.org/axis/wsdd/providers/java}SDL".
    Here SDL is a custom provider that i have written and all the required files for the provider are available in MyApp_Ejb.jar.
    I do not get as to why the axis.jar is not able to find classes in MyApp_Ejb.ear, when both these are in the same ear.
    Now i know i can add a utility jar to a war files classpath by adding a classpath line in the War file MANIFEST.MF. But since MyApp_Ejb.jar is defined as a Web Module this solution too doesnt help.
    Separating the provider related files from MyApp_Ejb.jar is not possible since there is too much dependance of other files within that jar.
    So i am looking for a solution where in i can continue to have MyApp_Ejb.jar as my ejb module as well as the axis related jars can find the required classes within MyApp_Ejb.jar. some way of sharing the ejb jar across to axis jars.
    Thanks in advance.
    Vicky

  • Building a jar in an ant build.xml file

    Hi,
    i previously used netbeans to create a jar that you could doubleclick to have it automatically started (win 2000).
    The jar also included other jars like log4j, jdom and so.
    In Netbeans, i first made my project and those jars available via the filesystem. Then i just made a new jar, added my project and the startpoints of the other jars. For instance for the jdom.jar, i selected the org and everything beneath.
    Then i generated a standard manifest file and added this line:
    Main-Class: <package>/<mainclass>
    This worked ok fine.
    Now, for my question: i'm trying out ant and want to achieve the same as above. Building my project is not a problem. I specified the dependies on other jars like this:
      <target name="compile" depends="init" description="compile">
        <!-- Compile the java code from ${src} into ${build} -->
        <javac srcdir="${src}" destdir="${build}">
          <classpath>
            <pathelement location="lib/jdom.jar"/>
            <pathelement location="lib/log4j-1.2.7.jar"/>
          </classpath>
        </javac>
      </target>Compiling doesn't produce an error.
    However i can't seem to figure out how to build a jar where the root of each jar is included in the content of my own jar so i don't have to distribute the jars seperately.
    This is what i had so far for my jar:
      <target name="dist" depends="compile" description="generate" >
        <!-- Create the distribution directory -->
        <mkdir dir="${dist}/lib"/>
        <!-- Put everything in ${build} into customer-${DSTAMP}.jar file -->
        <jar jarfile="${dist}/lib/customer-${DSTAMP}.jar"
             basedir="${build}" manifest="${conf}/manifest.mf"/>
      </target>My manifest file:
    Manifest-Version: 1.0
    Main-Class: customer/clientAny idea of how to add the content of another jar to my own jar?
    Thanks

    Hhhm. stupid me, i found a sollution to this and it was on this very forum!
    This is the relevant thread:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=281090

  • Security restrictions , how to read access a txt file supplied in a jar

    I had written a simple application which uses file handling to display random line from a file on a swing window
    but I do not know how to give my web application permission to access a file
    when I set security permission to all, then error says the application cannot load because the code require unrestricted acess to system resources and is unsigned, I don't know how to get that certificate and I am only doing it for learning purposes.
    when I remove security permissions then it says
    access denied java.io.FilePermissions geekjoskes.txt readPlease help
    I locally signed the jar file, and give my jnlp fiel all permissions, worked fine in my system but when I access same file from local lan it sho errors ,
    please help, I have my txt file stored in my jar file with main class
    the whole jnlp file is
    <?xml version="1.0" encoding="utf-8"?>
    <!-- JNLP File for geek jokes -->     
    <jnlp spec="1.0+"
           codebase="http://localhost/javasoft/webstart/"
          href="geekjokes.jnlp">
       <information>
          <title>Geek Jokes</title>
          <vendor>Vaibhav Mishra</vendor>
          <description>Geeky jokes</description>
          <homepage href="http://scjpbeginner.blogspot.com"/>
          <description kind="short">shows random jokes</description>
          <offline-allowed/>
       </information>
       <resources>    
            <jar href="GeekJokes0.1.jar"/>  
         <j2se version="1.6+"
               href="http://java.sun.com/products/autodl/j2se"/>
         <icon href="geekjokes.gif"/>
       <icon kind="splash" href = "geekjokes.gif"/>
       </resources>
       <security>
          <all-permissions/>
       </security>
       <offline-allowed/>  
       <application-desc main-class="GeekJokes"/>
    </jnlp>Edited by: 76jsr on Aug 7, 2008 3:45 PM
    Edited by: 76jsr on Aug 7, 2008 3:49 PM

    >
    I am extremely thankful to you and finally my first little app is working thanks to you,
    here is it's link
    [http://profile.iiita.ac.in/IIT2006117/javasoft/webstart/geekjokes/geekjokes.jnlp|http://profile.iiita.ac.in/IIT2006117/javasoft/webstart/geekjokes/geekjokes.jnlp] >
    I am glad you got it working! But that launch file is still slightly invalid.
    Here is a corrected, and slightly optimized (you can leave the prefix off the href, if it is the same as the codebase), version of it.
    <?xml version="1.0" encoding="utf-8"?>
    <!-- JNLP File for GeekJokes 0.3 app -->
    <jnlp spec="1.0+"
          codebase="http://profile.iiita.ac.in/IIT2006117/javasoft/webstart/geekjokes"
          href="geekjokes.jnlp">
       <information>
          <title>GeekJokes App</title>
          <vendor>Vaibhav Mishra</vendor>
          <homepage href="http://scjpbeginner.blogspot.com"/>
          <description>Geeky Jokes</description>
          <description kind="short">Cshows random jokes</description>
          <offline-allowed/>
       </information>
       <resources>
           <j2se version="1.6+"
               href="http://java.sun.com/products/autodl/j2se"/>
           <jar href="GeekJokes0.3.jar"/>
       </resources>
       <application-desc main-class="Process"/>
    </jnlp>Very 'Geeky', BTW. ;-)
    Another few things I noted when I looked at it.
    1) There is a stray thread going after the JOptionPane is dismissed. The VM does not end, and the console (if you have it configured to pop-up for JWS apps.) stays on-screen.
    2) If all the jokes are prefixed by '* ' I would recommend removing it from every line of the source file and either re-adding it at runtime, or (preferably) not adding it at all (since it is redundant).
    3) Reconfigure the app. into a loop, and offer the user a JOptionPane with "Another Joke"/"End" instead of "OK".
    4) You can always remove that debugging line I inserted in the code to show the path to the Jar - it was just intended as a 'sanity check' during testing.
    5) Why is it Java 1.6+? JOptionPane was introduced in Java 1.2 with the first Swing implementations, and the I/O is compatible with Java 1.1.
    >
    Thanks again!!!!>Thanks are best expressed (to me) in the notation of a helpful/correct answer (which you have done), and the assignation of (the remaining) dukes*. ;-)
    * After all - checks the title - we have gotten entirely around those 'security restrictions' in a sandboxed application. The reason being that File objects are rarely the correct choice, for applets or JWS apps.

  • JAR file which needs other JAR files

    Hi,
    I try to run a jar file, which imports some external classes. These classes are in the library "reader.jar", which is added to the classpath. But if I start it with ...
         D:\TestProject>java -cp ./reader.jar -jar viewer.jar
    ... I get an error: java.lang.NoClassDefFoundError: de/readers/TestReader
    If I copy the file "reader.jar" to "... j2sdk1.4.2/jre/lib/ext", I can start
    "viewer.jar" successfull with ...
         D:\TestProject>java -jar viewer.jar
    Why can't I add "reader.jar" to the classpath or why is it not used by Java?

    When you run JAR's, you can not use the classpath defined at the command prompt (well, you can use it, it is just ignored). The JAR has its own class path defined in its manifest file. Add:
    CLASS-PATH: reader.jar
    to the manifest file of the viewer.jar and it should work.

  • Creating jar file including 2 another jar files

    hi
    My project has java files, properties files,batch files as well as two jar files,mail.jar & activation.jar(for importing packages).
    I have to include these jar files while setting environment variables.
    Now i want to make "MyPrj.jar" file for myproject ,can anyone pls help me how to include these all files into a single jar file. and how to make setup file
    I have tried to extract out .class files of mail.jar & activation.jar & i ve created MyPrj.jar by including all class files(including class files of mail.jar & activation.jar) but manifest file(headers) are not added to MyPrj.jar.
    i have also tried to give mail.jar & activation.jar in Class-Path of menifest file, but it is also not working.
    Pls Help
    Thanks a lot

    [http://sourceforge.net/projects/one-jar]
    "One-JAR(TM) is a simple solution to a vexing problem in Java: how to distribute an application as a single jar-file, when it depends on multiple other jar-files. One-JAR uses a custom classloader to discover library jar files inside the main jar. "

  • .jar file is not working properly :developed in NETBEANS

    Hi Gurus,
    i am using NETBEANS IDE 7.2.
    i am developing a project that interacts with databases 10g and COM ports of machine , these all processes are performed by .bat file which i am trying to run from jFramform , code works perfectly .bat file is also called perfectly when i run the project using F6 from the NETBEANS, for testing i placed some dialogue boxes on the form to test it ,
    but when i run executable .jar  file , form run successfully and dialogue box works perfectly but .bat file is not called by executable .jar file.
    this is how i call the .bat file...
      String filePath = "D:/pms/Libraries/portlib.bat";  
            try { 
              Process p = Runtime.getRuntime().exec(filePath); 
            } catch (Exception e) { 
                e.printStackTrace(); 
    and below is the contents of portlib.bat file
    java -jar "D:\SMS\SMS\dist\SMS.jar" 
    you must probably ask why i am calling a .jar file using .bat file .
    reason is that this .jar project sends message using GSM mobile , System.exit(); is compulsory to complete a job and then do the next one ,
    if i use the same file to execute this job it makes exit to entire the application (hope you can understand my logic).
    that's why i use extra .jar file in .bat file , when single job is completed .bat exits itself and new command is given.
    Problem is that code is working perfectly in NETBEANS when i run the project but when i run .jar then .bat file is not working  ,
    thanks.

    Thanks Sir ,
    You need to first test an example that works like the one in the article.
    There are plenty of other examples on the web - find one you like:
    http://javapapers.com/core-java/os-processes-using-java-processbuilder/
    I tried this one.
      try {
                ProcessBuilder dirProcess = new ProcessBuilder("D:/SMS/SMS/Send_message.bat");
                 File commands = new File("D:/SMS/SMS/Send_message.bat");
                 File dirOut = new File("C:/process/out.txt");
                 File dirErr = new File("C:/process/err.txt");
               dirProcess.redirectInput(commands);
                 dirProcess.redirectOutput(dirOut);
               dirProcess.redirectError(dirErr);
                 dirProcess.start();
            } catch (IOException ex) {
                Logger.getLogger(mainform.class.getName()).log(Level.SEVERE, null, ex);
    as instructed in the article i compiled  both the projects at same version or sources and libraries which is 1.7
    here is my version details
    C:\>javac -version
    javac 1.7.0_07
    C:\>java -version
    java version "1.7.0_07"
    Java(TM) SE Runtime Environment (build 1.7.0_07-b11)
    Java HotSpot(TM) Client VM (build 23.3-b01, mixed mode, sharing)
    inside the NETBEANS IDE c:\process\err.txt  remains empty and code works perfectly , but when I run executable .jar file( by double clicking on that file in dist directry) then c:\process\err.txt becomes full with this error text and there is no response from calling D:\SMS\SMS\send_message.bat
    here is the error text
    java.lang.UnsupportedClassVersionError: sms/SMSMAIN (Unsupported major.minor version 51.0)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Exception in thread "main"
    here is /SMS/SMS
    unknown source ?

  • File Not Found inside jar

    Hi All,
    Im using applet to access a wav file which is located in the jar file, 1st of all im compiling the applet class, making a jar file(which has the welcome.jar in it) and signing the jar file and then archiving the jar file in the HTML code. following is the code used in the java applet file.
                    URL pathShell = null;
         Object dummy = new Object(){
                                 public String toString() { return super.toString(); }
         ClassLoader cl = dummy.getClass().getClassLoader();
         pathShell  = cl.getResource("welcome.wav");
         String wavFile = pathShell.toString();
         System.out.println("path  --- "+pathShell);
         System.out.println("String -- "+wavFile);
         RandomAccessFile rcs = new RandomAccessFile(wavFile,"rw");Exception messages is as follows,
                   path  --- jar:http://localhost/slider.jar!/welcome.wav
                   String -- jar:http://localhost/slider.jar!/welcome.wav
                    java.io.FileNotFoundException: jar:http:\localhost\slider.jar!\welcome.wav (The filename, directory name, or volume label syntax is incorrect)
         at java.io.RandomAccessFile.open(Native Method)
         at java.io.RandomAccessFile.<init>(Unknown Source)
         at java.io.RandomAccessFile.<init>(Unknown Source)
         at AudioPlay.<init>(AudioPlay.java:40)
         at SliderDemo.startAudio(SliderDemo.java:231)
         at SliderDemo.access$000(SliderDemo.java:17)
         at SliderDemo$5.actionPerformed(SliderDemo.java:144)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

    b.m.kraju wrote:
    Hi All,
    Im using applet to access a wav file which is located in the jar file, 1st of all im compiling the applet class, making a jar file(which has the welcome.jar in it) and signing the jar file and then archiving the jar file in the HTML code. following is the code used in the java applet file.You can't open a resource inside a jar file as a RandomAccessFile or any other form of File.

  • Problem deploying connector: META-INF/ejb-jar.xml not found in jar file

              Has anyone seen this problem:
              I built Sun's Blackbox implementation and packaged
              it identical to the BlackBoxNoTx.rar included with
              Weblogic's 'jconnector' sample (even using the same
              ra.xml and weblogic-ra.xml). When I try to deploy
              it, the server reports:
              java.io.FileNotFoundException:
              META-INF/ejb-jar.xml not found in jar file
              I have no idea why the server thinks my connector
              is an EJB. If I deploy the BlackBoxNoTx.rar included
              with the sample, everything works without a hitch.
              The only variable that I'm changing in my BlackBoxNoTx.rar
              is that I build the Blackbox classes myself--otherwise,
              the RAR packagings are identical. Any assistance is
              greatly appreciated since I'm banging my head against
              a wall...
              Thanks,
              -jason
              

              I was finally able to resolve this one. On the odd chance that someone else encounters
              the same problem, here's what went wrong:
              My RAR file had two directories: 'META-INF' and 'meta-inf'. The first was created
              by the jar tool and contained the manifest.mf file. The second I created manually
              and it contained my ra.xml and weblogic-ra.xml. When I examined the RAR using
              any tools or I extracted the contents, it looked like it only contained one directory:
              META-INF (because NT is case-insensitive).
              "Jason L" <[email protected]> wrote:
              >
              >Has anyone seen this problem:
              >
              >I built Sun's Blackbox implementation and packaged
              >it identical to the BlackBoxNoTx.rar included with
              >Weblogic's 'jconnector' sample (even using the same
              >ra.xml and weblogic-ra.xml). When I try to deploy
              >it, the server reports:
              >
              >java.io.FileNotFoundException:
              >META-INF/ejb-jar.xml not found in jar file
              >
              >I have no idea why the server thinks my connector
              >is an EJB. If I deploy the BlackBoxNoTx.rar included
              >with the sample, everything works without a hitch.
              >The only variable that I'm changing in my BlackBoxNoTx.rar
              >is that I build the Blackbox classes myself--otherwise,
              >the RAR packagings are identical. Any assistance is
              >greatly appreciated since I'm banging my head against
              >a wall...
              >
              >Thanks,
              >
              >-jason
              

  • How to execute a jar file which has an applet, without using a html file ?

    I have a jar file which contains a set of class files. iam able to execute the jar file by using this html code
    <html>
    <applet code="file.class" archive="file.jar" width="500" height="300">
    <param name="name" value="value">
    </applet>
    </html>
    I want to know how to execute this class file without using the html tags.
    pls help me out in this.
    Anki

    Hi,
    You can make an executable jar file such that when you double click on that it starts running. Just follow the steps.
    1. Open a notepad and write the following
    Main-Class: XXXXXXXX
    XXXXXXX means Your Main Class name. Don't forget to press Enter after you write your class name.
    2. Save the file as Mani.mf
    3. In the commant prompt ( your directory ) type following lines.
    jar cmf Mani.mf Demo.jar *.*
    4. This will make a jar file which is executable jar file
    Hope this will help you.
    Deepak

  • How to make an applet to read the Text file present inside a jar

    Hi All,
    I have writen one applet named ReadFile.java which reads a text file present in the same directory and does some manipulation of text file contents.
    The applet code runs successfully when i run the applet in command prompt like
    {color:#ff0000}*java ReadFile*{color}
    And i am getting the needed results.
    Then i made a jar file with the applet code and text file as
    {color:#ff0000}*jar cvf rf.jar ReadFile.class File1.txt*{color}
    Then i have inlcuded this applet inside a html file as
    {color:#ff0000}*<applet code= "ReadFile.class" width= "500" height= "300" archive = "rf.jar" ></applet>*{color}
    after this when i load the html file, the applet code is not executed fully. Its throwing FileNotFoundException: File1.txt.
    Applet is not recognizing trhe text file present inside the jar file.
    Can any body explain me how to overcome this problem. Any setting needs to be done for making the applet indicate the presence of Text file inside the jar file.

    what code in your applet gets the text file and reads it? are you using getResource or something similar?

  • How to get the entries in a jar/zip file contained within a jar/zip file?

    If I want to list the jar/zip entries in a jar/zip file contained within a jar/zip file how can I do that?
    In order to get to the entry enumeration I need a Zip/JarFile:
    ZipFile zip = new ZipFile("C:/java_dev/Java_dl/java_jdk_commander_v36d.zip");
    // Process the zip file. Close it when the block is exited.
    try {
    // Loop through the zip entries and print the name of each one.
    for (Enumeration list =zip.entries(); list.hasMoreElements(); ) {
    ZipEntry entry = (ZipEntry) list.nextElement();
    System.out.println(entry.getName());
    finally {
    zip.close();
    Zip file "java_jdk_commander_v36d.zip" contains two zip entries:
    1) UsersGuide.zip
    2) JDKcommander.exe
    How to list the entries in "jar:file:/C:/java_dev/Java_dl/java_jdk_commander_v36d.zip!/UsersGuide.zip"?
    The following code:
    URL url = new URL("jar:file:/C:/java_dev/Java_dl/java_jdk_commander_v36d.zip!/UsersGuide.zip");
    JarURLConnection jarConnection = (JarURLConnection)url.openConnection();
    zipFile = (ZipFile)jarConnection.getJarFile();
    would point to "jar:file:/C:/java_dev/Java_dl/java_jdk_commander_v36d.zip", which is no help at all and Class JarURLConnection does not have an enumeration method.
    How can I do this?
    Thanks.
    Andre

    I'm not sure I understand the problem. The difference between a zip and jar file is the manifest file; JarFile is extended from ZipFile and is able to read the manifest, other than that they are the same. Your code
    for (Enumeration list =zip.entries(); list.hasMoreElements(); ) {
    ZipEntry entry = (ZipEntry) list.nextElement();
    System.out.println(entry.getName());
    }is close to what I've use for a jar, below. Why not use the same approach? I don't understand what you're trying to do by using JarURLConnection - it's usually used to read the jar contents.
    String jarName = "";
    JarFile jar = null;
    try
        jar = new JarFile(jarName);
    catch (IOException ex)
        System.out.println("Unable to open jarfile" + jarName);
        ex.printStackTrace();
    for ( Enumeration en = jar.entries() ;  en.hasMoreElements() ;)
        System.out.println(en.nextElement());
    }

  • Jar files required to read excel file in SAP PI 7.3.1 sp09 dualstack

    Hi experts,
    I need to read excel file (.xls) using SAP PI and process it to target system. I have read blogs
    and found that there are 2 ways to read an excel file in PI using file adapter.
    1) Developing a custom adapter module
    2) Using XSLT code.
    So in order to develop a custom adapter module, i have followed the following blogs
    **************** - XI - Step-by-step guide to develop Adapter Module to read Excel file
    and
    Excel Files - How to handle them in SAP XI/PI (The Alternatives)
    and
    http://wiki.scn.sap.com/wiki/display/ABAP/Adapter+Module+To+Read+Excel+File+with+Multiple+Rows+and+Multiple+Columns
    I am unable to find the jar files in SAP PI at OS level as per the first blog(think they were obsolete).
    Please let me know
    1) What are the required jar files needed to read excel file and their location
    2) Even if i use the old jar files as mentioned in the first blog can i achieve my requirement
    3) Following this blog Convert incoming XML to Excel or Excel XML – Part 1 - XSLT Way if i apply the same logic at sender side, will it work? Because through case studies i came to know that we cannot read a .xls file using XSLT code. Correct me if i am wrong.
    Looking for your valuable suggestions.
    Regards
    Shilpa

    Hi Shilpa
    Welcome to SCN!
    The blog you refered to might be for previous versions of PI. You can refer to the following two wikis to find out what are the relevant JAR files for PI 7.3 and also how to get them.
    XI libraries for development - Process Integration - SCN Wiki
    Where to get the libraries for XI development - Process Integration - SCN Wiki
    It also looks like for newer versions, you might not need to manually get and add those JAR files into your NWDS project - please refer to the first comment on the blog below. I have not tried it personally as I'm not using the latest NWDS, but you can try that first, and if it does not work, then go get them manually.
    PI 7.4 - Adapter Module Creation using EJB 3.0
    Do note that you should be using the JAR files that is corresponding to your PI server version.
    As for your third question, that does not apply to you. XLS is the older non-XML format, and therefore cannot be read by XLST since it is in binary format.
    Rgds
    Eng Swee

  • How to use schema files stored in a jar file

    I am in a great trouble in accessing the schema files in the jar file. I have to validate my xml files against those schema files while parsing the xml file. I am unable to get the path of the schema files.
    I am getting the path as
    E:/ConfigUtility/schemas.jar!/Schema.xsd
    which is not a valid path name for windows. Plese help me and send me some code how to access a schema file that is in the jar file.
    thanks and regards,
    Krishna.

    Run the program from command line, this way you will see the errors, if any.
    example.: java -jar theJarfile.jar
    I was successful in creating a comm application. I placed the win32com.dll in the same directory of my application jar file and all worked.
    I also extracted the comm.jar , and jar'd my app with the extracted comm files to make one jar.
    I also had a fileWriter() to get the clients jre path and my app would write the javax.properties file to the correct place.
    It took me severel weeks and late nights to accomplish this, but it was all necessary to be able to install only my app, and not a bunch of api's that were needed.

Maybe you are looking for