Unable to load classes from jar files inside APP-INF/lib in EAR.

Weblogic version: 10.3.3
Platform: Linux x86-64 bit
We deployed an ear packaged with all the common library jars inside APP-INF/lib. Deployment was successful.
for some reason, it is always giving ClassNotFoundException for the classes inside the jars. This does not happen
in 10.3.2 version of weblogic.
We tried to add them to domain/lib directory (instead of APP-INF/lib) but still it is not able to resolve the classes.
Any pointers would be appreciated.

try using prefer-web-inf-classes in the weblogic.xml file in your WAR file
or using prefer-application-packages in the weblogic-application.xml file in your EAR.

Similar Messages

  • How to load class from jar file dynamically?

    After I run my Java applicatoin, I need configuring the classpath of jvm to load some classess inside a jar file into the same jvm.How can I achive that?
    I mean, when I run my Java application, I don't know where the jar file is, what the jar file name is. All depends on the user to tell the jvm the details through some UI. I've tried to write: System.setProperty("java.class.path", "c:\myClass.jar");Class.forName("MyClass"); but failed.
    Can you tell my why and how?
    Thx

    After I run my Java applicatoin, I need configuring
    the classpath of jvm to load some classess inside a
    jar file into the same jvm.How can I achive that?
    I mean, when I run my Java application, I don't know
    where the jar file is, what the jar file name is. All
    depends on the user to tell the jvm the details
    through some UI. I've tried to write:
    System.setProperty("java.class.path",
    "c:\myClass.jar");Class.forName("MyClass"); but
    failed.That won't work. By the time it gets to your code it already has a copy of the original. You can't change it (short of modifying the JVM.)
    Can you tell my why and how?The usual way is to use a custom classloader.
    You can start by looking at java.net.URLClassLoader.

  • Loading library from jar file

    Hi all,
    My question is can we load library from jar file using System.load() method.
    ex:
    myJar.jar
    |
    |----com.test.common.Util
    which conatins a method to load library from jar file itself, before that i used to load from File
    |---libraries/MozillaParser/......
    Iam able load from Local system,
    File parserLibraryFile = new File("libraries/MozillaParser" + EnviromentController.getSharedLibraryExtension());
    File mozillaDistBinDirectory = new File("libraries/mozilla.dist.bin."+EnviromentController.getOperatingSystemName());
    MozillaParser.init(parserLibraryFile.getAbsolutePath() , mozillaDistBinDirectory.getAbsolutePath());
    but i am unable to load from jar file
    URL url = ClassLoader.getSystemClassLoader().getResource("libraries/MozillaParser" + EnviromentController.getSharedLibraryExtension());
    URL url1 = ClassLoader.getSystemClassLoader().getResource("libraries/mozilla.dist.bin."+EnviromentController.getOperatingSystemName());
    MozillaParser.init(url.toString(), url1.toString());
    Thanks in advance.

    That's a really confusing post.
    The easiest way to make sure you can use the classes in a jar file is to copy the jar file to the "/jre/lib/ext" subfolder of your JDK. These classes will be visible to all applications.

  • Problem loading image from jar file referenced by jar file

    First, I searched this one and no, I didn't find an answer. Loading images from jar files has been pretty much done to death but my problem is different. Please read on.
    I have my application, a straight up executable running from Eclipse. It uses a jar file, call it JarA. JarA launches a GUI that is located in another jar file. Call it JarB. To recap:
    My application calls JarA -> JarA loads classes from JarB -> JarB looks for images to place in a GUI it wants to show on the screen
    When JarB goes to load an image the following happens:
    java.lang.NullPointerException
         at sun.misc.URLClassPath$3.run(URLClassPath.java:316)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:313)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:290)
         at sun.misc.URLClassPath.findResource(URLClassPath.java:141)
         at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
         at java.lang.ClassLoader.getResource(ClassLoader.java:977)
         at org.cubrc.gmshell.gui.MainWin.preInit(MainWin.java:152)
         at org.cubrc.gmshell.gui.MainWin.<init>(MainWin.java:135)
    The code from JarB that loads the image looks like this:
              URL[] oSearch = {Main.class.getResource("images/")};
              URLClassLoader oLoader = new URLClassLoader(oSearch);
              imgIcon = new ImageIcon(oLoader.getResource("icon.gif"));
              imgMatchRunning = new ImageIcon(oLoader.getResource("gears.gif"));
              imgMatchStill = new ImageIcon(oLoader.getResource("gears-still.gif"));
              imgMagnify = new ImageIcon(oLoader.getResource("magnify.gif"));This looks right to me and JarB certainly has an images directory with those files. But I'm in hell right now because I don't know where to place the images to make this work or if you can even attempt to load images with a dependency chain like this.
    Any help very appreciated!

    Have you tried to move your image-files out of the jar file and place them in the sam folder as the jar-file? I think that would help.
    When you try to load the image-file you get the NullPointerException because the program tries to read a file it can't find. Remember that a jar file IS a file and not a directory.
    If you want to read somthing inside the jar-file you need to encode it first.
    Have you tried to read the jar-file with winRar. It makes it easy to add and remove files in your jar-file.

  • Re: Recognizing JAR files in WEB-INF/lib

    Steven Vetzal wrote:
    I am attempting to open existing web projects in NitroX and am beingplagued with:
    The class "com.someone.Class" is not in the application class path
    The classes are contained in JAR files in WEB-INF/lib.
    I have been looking for a way to add these JAR files to the classpath.
    There is no builder registered, so I'm not sure I can even get there
    from here :)
    Don't you love it when people answer their own questions?
    Here's what I did:
    Add the following sections to the .project file-
    Under BuildSpec:
    <buildCommand>
    <name>org.eclipse.jdt.core.javabuilder</name>
    <arguments>
    </arguments>
    </buildCommand>
    Under natures:
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>com.m7.nitrox.webProjectNature</nature>
    This fixed up all my classpath issues - after I modified the Java
    classpath of course... For example, my .classpath file looks like:
    <classpathentry kind="src" path="WEB-INF/classes"/>
    <classpathentry kind="lib" path="WEB-INF/lib/cms-bindings-3.0.2.jar"/>
    <classpathentry kind="con" path="J2ee.runtime.m7"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="lib" path="WEB-INF/lib/cms-ejb-2.4.0.jar"/>
    <classpathentry kind="lib" path="WEB-INF/lib/jstl.jar"/>
    <classpathentry kind="lib" path="WEB-INF/lib/standard.jar"/>
    <classpathentry kind="output" path="WEB-INF/classes"/>
    I found that by examining these files from other projects (like from the
    web project wizard) it was easy to find out what my broken project was
    missing.
    Hopefully this will help someone else one day :)
    Steve

    Hi Steven,
    Sorry for the late response, next time you can do this in a more simple way
    by launching Properties window (right click on project) and select Java
    Build Path, click on Libraries tab.
    Thanks
    M7 Support
    "Steven Vetzal" <[email protected]> wrote in message
    news:[email protected]..
    Steven Vetzal wrote:I am attempting to open existing web projects in NitroX and am being
    plagued with:
    The class "com.someone.Class" is not in the application class path
    The classes are contained in JAR files in WEB-INF/lib.
    I have been looking for a way to add these JAR files to the classpath.
    There is no builder registered, so I'm not sure I can even get there from
    here :)
    Don't you love it when people answer their own questions?
    Here's what I did:
    Add the following sections to the .project file-
    Under BuildSpec:
    buildCommand
    name>org.eclipse.jdt.core.javabuilder</name
    arguments
    /arguments
    /buildCommand
    Under natures:
    nature>org.eclipse.jdt.core.javanature</nature
    nature>com.m7.nitrox.webProjectNature</nature
    This fixed up all my classpath issues - after I modified the Java
    classpath of course... For example, my .classpath file looks like:
    classpathentry kind="src" path="WEB-INF/classes"/
    classpathentry kind="lib" path="WEB-INF/lib/cms-bindings-3.0.2.jar"/
    classpathentry kind="con" path="J2ee.runtime.m7"/
    classpathentry kind="con"
    path="org.eclipse.jdt.launching.JRE_CONTAINER"/
    classpathentry kind="lib" path="WEB-INF/lib/cms-ejb-2.4.0.jar"/
    classpathentry kind="lib" path="WEB-INF/lib/jstl.jar"/
    classpathentry kind="lib" path="WEB-INF/lib/standard.jar"/
    classpathentry kind="output" path="WEB-INF/classes"/
    I found that by examining these files from other projects (like from the
    web project wizard) it was easy to find out what my broken project was
    missing.
    Hopefully this will help someone else one day :)
    Steve

  • Unable to load class from JSTL

    Hello. I am using JSTL 1.06 from Jakarta with Tomcat 4.1 on a MacOS X 10.3.9 server. I have a jsp that contains the following:
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <jsp:useBean id="validate" class="mypackage.ValidationBean" scope="request">
            <jsp:setProperty name="validate" property="*" />
    </jsp:useBean>
    <c:if test="${validate.valid == false}">
    The input is not valid.
    </c:if>In case it matters, my web.xml file starts out like this:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">I have placed jstl.jar and standard.jar in my webapp's WEB-INF/lib directory. However, when I try to load the page, I get this error message:
    org.apache.jasper.JasperException: /myjsp.jsp(60,0) Unable to load class if
    I know that many people have asked similar questions, but in each case, the response was to put jstl.jar and standard.jar in WEB-INF/lib and make sure that you're using the proper URI for the taglib, and I think I have done those things correctly. Any help would be greatly appreciated!

    Thanks for your response! In answer to your questions:
    The JRE is 1.4.2_09. I can't use 1.5 (5.0) without upgrading the OS.
    I haven't tried it on a PC. I might be able to, but it would take me some time to set everything up.
    What follows is taken from Tomcat/logs/localhost_log.2006-10-24.txt. If there is another log file I should be looking in, please let me know. Here is the full stack trace from the log:
    2006-10-24 16:58:40 Could not load TagLibraryValidator class org.apache.taglibs.standard.tlv.JstlCoreTLV: EXCEPTION: org.apache.taglibs.standard.tlv.JstlCoreTLV
    2006-10-24 16:58:40 Could not load TagExtraInfo class org.apache.taglibs.standard.tei.ImportTEI: org.apache.taglibs.standard.tei.ImportTEI
    2006-10-24 16:58:40 Could not load TagExtraInfo class org.apache.taglibs.standard.tei.ForEachTEI: org.apache.taglibs.standard.tei.ForEachTEI
    2006-10-24 16:58:40 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: /myjsp.jsp(59,0) Unable to load class if
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:428)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:219)
    at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:712)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:804)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:227)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:553)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
    at java.lang.Thread.run(Thread.java:552)

  • Problem loading Applets from Jar files on 64 bit machine

    I am developing an applet (extends Applet but uses swing components) using JDK 1.6 (Though these problems still happen in JDK 1.7) and I am unable to get the applet to load on a 64 bit machine in most cases. The web server(s) are running on localhost and I am connecting on the same machine using a local network ip address (such as 192.168.*.*)
    Below are all of my test results. Can someone provide a suggestion for repairing this? The Windows Server machine is a clients computer I access to it via remote desktop but I can't do much with it though I do have administrator rights. The Windows 7 machine is my development platform so I have been able to do extensive testing on it.
    This problem is presenting in the following environments when trying to load an applet from JAR files in a HTML document using the Applet or Object tag.
    Windows Server 2008 (Intel Chipset)
    Tested Browsers:
    Internet Explorer 9 (32 bit) - Shows it is blocked by default then simply shows an x when loaded from a web page, same result when loading from local drive.
    Windows 7 Home Premium (AMD Chipset)
    Tested Browsers:
    Firefox 6.0.1 (32 bit) - Java logo shows with spinner, after a few minutes there is finally an error that a class in the jar was not found
    Internet Explorer 9 (32 bit) - Java logo shows with spinner, after a few minutes there is finally an error that a class in the jar was not found
    Internet Explorer 9 (64 bit) - Java logo shows with spinner and most of the windows desktop manager freezes, keyboard is the only thing that responds so you can alt-tab to another app to regain control of the desktop.
    Chrome (32 bit) - Java logo shows with spinner, after a few minutes there is finally an error that a class in the jar was not found
    The only way I have been able to get a Java applet to run on a 64 bit machine are the following ways.
    Firefox 9 nightly (64 bit) works perfectly! Go Firefox!
    Internet Explorer 9 (32 bit) loading directly from drive (c:\...)
    Chrome (32 bit) loading directly from drive (c:\...)
    Firefox 6.0.1 (32 bit) loading directly from drive (c:\....)
    Can someone please help! I've been fighting with this bug for over a week and I can't find anything that will solve it, I have noticed that in some cases if my jar has very little code in it than it will run on the server, but the minute I start adding things to it the jar won't load anymore.

    jschell wrote:
    rritoch wrote:
    I am developing an applet (extends Applet but uses swing components) using JDK 1.6 (Though these problems still happen in JDK 1.7) and I am unable to get the applet to load on a 64 bit machine in most cases.
    To clarify...
    1. You have tried it on 32 bit machine? Exactly which OS?I tested this on Windows Vista Business which is in 32 bit mode and the applets run without any problems
    >
    2. Your only 64 bit tests have involved 2008/Win7?
    If so then I would suspect something with windows not java. Probably permissions.
    The web server(s) are running on localhost and I am connecting on the same machine using a local network ip address (such as 192.168.*.*)
    Yes, I haven't tried running the jars on other operating systems.
    >
    I don't understand that. If you are running on localhost then you should connect to localhost. If running on an IP then you should connect to that. Perhaps you meant that you have tested using both of those?I'm testing using the lan ip address but I'm connecting from the same machine. I've tried localhost and that didn't work so I tried lan ip since that will likely have a different java security context than localhost. At first I was blaming the IIS server but I downloaded the jar directly and using HTTP fox was able to verify that the jar is being sent with the correct mime-type and that the server can upload the jar file without a problem. This leaves me to believe the problem is with Java.

  • Load library from JAR file

    Could I ask you guys a stupid question, please?
    I have a library as an JAR file. I build my application as another JAR file, which includes that library file.
    My manifest file is:
    Manifest-Version: 0.1.0
    Class-Path: lib/mysql-connector-java-3.0.17-ga-bin.jar
    Main-Class: com.myappand the build command:
    jar cvfm hello.jar mymanifest -c com  -c libThe result hello.jar file built OK. But when I run it, I have to copy library file to the same folder to the app file.
    Could you tell me how to load the lib file from hello.jar, instead of the lib file?
    Thanks in advance!
    Best regards,
    Lehoanq

    am I right in thinking you've put the mysql jar inside your application jar? jars don't work like that, I'm afraid. it is possible to write a classloader that will load classes from within a jar-inside-a-jar, but it gets rather complicated and messy and isn't worth the hassle to be honest, anyway. we go to some lengths to keep our software modular and separate. imagine, for instance, that a bug is exposed in the mysql driver you're using, and a new release is needed to fix it. the dependency is rooted inside your application, so the whole shebang has to be re-packaged and re-deployed, whereas if your dependencies were inside a lib folder, all that would be needed is to drop the new version of the mysql driver into the lib directory. think "don't put all your eggs in one basket"
    what you want to do is possible, and there are tools around to do it for you, too, but IMHO it's not worth the effort

  • Instantiate class from jar file

    Need a quick hand...little bit of a rush here.
    How do I go about instantiating a class from a jar file?
    If my jar file resides at c:/MyApp/MyJar.jar
    The contents of the jar file are:
    meta-inf/MANIFEST.MF
    A.java
    How do I go about creating an instance of A? I see people saying to use the URLClassLoader, but I can't find any good sample code to clarify how it's done. Assuming I already know the name of the class I'm instantiating, could someone show me how the URLClassLoader is used please? Also, please note that the jar file is NOT in my classpath, and I am not able to put it there....because it needs to be dynamically loaded as a plugin. I'm not sure if that matters or not with regards to the instantiation.

    Thanks so much for that..I think it's just about what I need. However, I'm still running into a bit of a snag. After executing the code and trying to run a method to print something out from the object I just loaded, it instead prints a memory location. So I don't think it is quite working as intended. Here's the code I'm working with at the moment....
    String jarPath = baseDir + "myApp/plugins/" + fileName;
    Manifest mf = jar.getManifest();
    Attributes att = mf.getMainAttributes();
    String className = att.getValue("Main-Class");
    //System.out.println(className);
    File file = new File(jarPath);
    URL[] urls = new URL[] {file.toURL()};
    ClassLoader loader = URLClassLoader.newInstance(urls);
    Class dynmicallyLoadedClass = Class.forName(className, true, loader);
    PlugIn plugin = (PlugIn) dynmicallyLoadedClass.newInstance();
    System.out.println(plugin.toString());  //This prints out "TMGImporter@1ce50a9" instead of what it's supposed to....Also, I am using Java 1.4.2_08 so I can't use generics. There are no error messages, just the wrong output. The jar this is using actually contains two files, besides the manifest. The TMGImporter (which Im trying to instantiate) and a TMGImporter$1 anonymous inner class. There is no package declaration on the class.
    Any thoughts?

  • Cannot load component from JAR file.

    I got the message : cannot load component ... from JAR file. The class must be compiled and must be on the classpath of the project...
    I just add a javabean from a JAR file from Palette manager, then drag and drop it, then got this message.
    Can anyone tell me what i was wrong ? Thank you.

    Hi,
    You should paste your error log here to easy for other to help you.
    For your scenario, it is a big chance you didn't include the jar file into your classpath, please check.
    Thanks.

  • Importing classes from Jar files..?

    I've run into a problem that I am having some difficulty solving. I currently trying to port a two part Java UI project from Solaris to Windows. The first is a package of core classes out of which I (successfully) create a jar file. The second is a product-specific package that imports the core classes from the package created in the first. The problem is that the second package fails to build because javac says the package from part one does not exist. Here's what I know:
    - This UI (built via a Makefile) builds successfully under Solaris
    - The jar file that I created in the first part exists in the appropriate directory.
    - When I view the contents of that jar it appears as though everything is there.
    - The jar file is appropriately included in the classpath of the second build.
    Any suggestions you could provide, or resources you could point me to would be greatly appreciated

    jh.jar is a static, 3rd party component. Doesn't seem to be giving me any grief, at least not yet.
    Correct on your second point.
    This is interesting. When I open my "CoreConsole.jar"
    file, I DO NOT see any reference to the
    com.emc.avalon.core.server package, only a list of
    class files that make up that package. You should see the .class files on the left and the relative path on the right.
    Also, all of the class file listings have absolute paths according
    to the location on my machine they were built, for example:
    m:/xpe/CoreConsole/classes/com/emc/avalon/core/server/MessageLogUtility.class
    Is this a problem..?Yes, that should be a relative path, with the first entry being the first name in the package statement. So you should see an entry MessageLogUtility.class, and the path should be com.emc.avalong.core.server.
    If you can't see the class that's missing, that would explain why the class loader can't find it, either.

  • Loading icons from jar file

    Hello,
    i am trying to load ALL imagefiles from my jar file. i do the following:
    Class clazz = Class.forName("com.xxx.IconSelectionDialog");
    String me = clazz.getName().replace(".", "/") + ".class";
    dirURL = clazz.getClassLoader().getResource(me);
    if (dirURL.getProtocol().equals("jar")) {
    String jarPath = dirURL.getPath().substring(6, dirURL.getPath().indexOf("!")); //strip out only the JAR file
    JarFile jar = new JarFile(jarPath );
    Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar
    while (entries.hasMoreElements()) {
    JarEntry nextEntry = entries.nextElement();
    String jarEntryName = nextEntry.getName();
    this works fine with my debug local jws installation. when i try to run it online starting i get an error:
    java.io.FileNotFoundException: xentis.jar (Das System kann die angegebene Datei nicht finden)
         at java.util.zip.ZipFile.open(Native Method)
         at java.util.zip.ZipFile.<init>(ZipFile.java:114)
         at java.util.jar.JarFile.<init>(JarFile.java:133)
         at java.util.jar.JarFile.<init>(JarFile.java:70)
    how can i load ALL icons from a jar (without knowing the filename) ?
    is there a generic way to iterate over all entries of a jarfile ?
    thank you
    michael

    Look at "Loading Images Using getResource" on this page
    http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html
    It should provide some ideas.

  • PJC - Loading Images from JAR Files

    I'm developing a PJC class that involves loading images. I would like to be able to find and use an image contained in a JAR file just like the built-in Forms items do; not the JAR file where my class is contained but any external ones defined in the server archive settings.
    I have seen the loadImage method in the demo RolloverButton class but this only loads images from the class's JAR and not any others.
    Is there a VButton method or an Oracle loader class for finding image resources from the defined JAR archives? If not, could someone supply some code for achieving this.
    Thank you.

    Hi,
    the jar file name the images are in shouldn't matter for the code as long as the package name is preserved. If you want to see it with your own eyes, do the following
    1. Back up demo90.jar
    2. Create a copy of it and call it demo90img.jar
    3. Open demo90.jar in winzip and remove all images
    4. Open demo90img.jar and remove all Java classes
    5. add ,/forms90demo/jars/demo90img.jar to the archive_jini tag of a demo you want to test this on
    6. Run the application and see the images despite the fact they are now in a separate jar file. Note in the Jinitiator console that the new jar files are downloaded and replace the existing, cached, jars
    7. Run an application that doesn't have demo90img.jar configured to see that the images are missing.
    Frank

  • Problem While Loading mp3 From Jar File?

    Hello There
    I've Made a jar File That Contains mp3 file That Should be Played When the jar is opened
    but the file doesn't play?
    and my code snippet to load from the jar
    URL url=getClass().getResource("/file.mp3");
    MediaLocator ml=new MediaLocator(url);
    final Player player = Manager.createRealizedPlayer(url);
    I don't Know where's The Error
    Could any one Help?

    First_knight wrote:
    Hello
    -Yes I Use NetBeans 6.1 To create The Jar With The Following Steps:
    First I've Add The Sound File To a Package In NetBeans 6.1
    And Then Called The Sound From The Package And The Program Runs Okay Then I Made The jar
    and after making the jar now i have to call the sound file from the jar by the code mentioned above
    i used it and run the program it run okay but when i try to open the jar i hear no sound????????????
    I Don't know whyyyyyyyyy This seems to indicate that your app is finding the mp3 file. You would probably get a null pointer exception if the file wasn't found. Something else seems to be going on.
    -How are you launching the jar outside of NetBeans?...By Double Click On It
    I suggest trying to launch the jar using the command promptjava   -cp   YourJarFile.jar  YourMainClassAnd if that works, try java   -jar   YourJarFile.jarAnd if that works, your computer's file association is not set up correctly.

  • Problem loading URL from .jar file

    I encounter problems while loading a MsAccess DB contains within a .jar file. This is the following codes I used,
    try
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        java.net.URL url=getClass().getResource("MSAccessDB\\SavingApp DB.mdb");
        DBURL+=url.getFile();
    catch(Exception e)
    { System.err.println(e.toString()); }

    Could I ask that, if I stored the MsAccess or any other DBs, will the DB able to do basic operations (Create Update Retrieve Display)?
    As the DB is not like a normal Text file.
    What I did is that, I didn't include the MsAccess into the .jar file. I just put it beside. The disadvantage is that user ables to open the DB and might do some changes. ;-(

Maybe you are looking for

  • Installing IDES 6.07 disp+work.exe error. Parallels windows 7, SQL Server 2012

    Hi Experts, I am trying to install sap IDES ECC 6 EhP 7 from scratch. Everything was doing well but I got an error on starting instance. SAPMMC Console Process disp+work.EXE do not change from status: "Server in State STARTING" (Yellow). I have been

  • How can I simply create a text frame with perfect rounded ends?

    I'm recreating a new edition of a book that was originally created in Quark. It uses round-ended text frames. When using the simplest method of corner options, the ends aren't proper semicircles, even though the radius is set to half the height of th

  • Performance Tuning in LSMW

    Hi Can Anyone explain me how can we increase the performance of the LSMW when created with the recording. Thanks a lot

  • Can't save as HTML in Photoshop

    I am trying to create a website using photoshop so I can then upload it into Dreamweaver. I am trying to save it as HTML & Images and went to the "Save for Web & Devices" tab. This is what pops up. I can't find anywhere that allows me to save it as H

  • Check flat file column list and column types

    Hi guys! Is there any "easy" way to check if the source flat file column names and column types correspond to target datastore column name and types ? Regards, PsmakR