Accessing resources in a jar

im working on a msn clone in jbuilder 9(enternprise), and im having a really hard time organizing my resources. i have a few icons and i grouped them into a folder name 'icons'. at first, the images can only be loaded when i place them in the class directory, which is fine until i compiled the project into a executable jar. the jar has trouble loading the images, i opened up the jar with winzip and found all the images are included. i also played around with the source for a while but with no luck. im just wondering if this have ever happened to you and how u dealt with it, thank you

package gui;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.ImageIcon;
import java.awt.Component;
import javax.swing.tree.DefaultMutableTreeNode;
import dataobjects.UserStruc;
import javax.swing.JTree;
import java.net.URL;
class IconBuilder
extends DefaultTreeCellRenderer {
ImageIcon online;
ImageIcon offline;
ImageIcon away;
ImageIcon phone;
ImageIcon lunch;
ImageIcon busy;
ImageIcon brb;
ImageIcon idle;
URL onlineURL;
public IconBuilder() {
System.out.println("Creating icons");
onlineURL = gui.IconBuilder.class.getResource("images/online.jpg");//this worked in jbuilder but not in the jar
online = new ImageIcon(onlineURL);
//online = new ImageIcon("images/online.jpg");
offline = new ImageIcon("images/offline.jpg");
away = new ImageIcon("images/away.jpg");
phone = new ImageIcon("images/busy.jpg");
lunch = new ImageIcon("images/away.jpg");
busy = new ImageIcon("images/busy.jpg");
brb = new ImageIcon("images/away.jpg");
idle = new ImageIcon("images/away.jpg");
public Component getTreeCellRendererComponent(
JTree tree,
Object value,
boolean sel,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
super.getTreeCellRendererComponent(
tree, value, sel,
expanded, leaf, row,
hasFocus);
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
UserStruc user = (UserStruc) (node.getUserObject());
if (user.getStatus().compareTo("NLN") == 0) {
setIcon(online);
setToolTipText(user.getUsername() + " (Online)");
else if (user.getStatus().compareTo("FLN") == 0) {
setIcon(offline);
setToolTipText(user.getUsername() + " (Offline)");
else if (user.getStatus().compareTo("BRB") == 0) {
setIcon(brb);
setToolTipText(user.getUsername() + " (BeRightBack)");
else if (user.getStatus().compareTo("AWY") == 0) {
setIcon(away);
setToolTipText(user.getUsername() + " (Away)");
else if (user.getStatus().compareTo("LUN") == 0) {
setIcon(lunch);
setToolTipText(user.getUsername() + " (Out To Lunch)");
else if (user.getStatus().compareTo("PHN") == 0) {
setIcon(phone);
setToolTipText(user.getUsername() + " (On the Phone)");
else if (user.getStatus().compareTo("BSY") == 0) {
setIcon(busy);
setToolTipText(user.getUsername() + " (Busy)");
else if (user.getStatus().compareTo("IDL") == 0) {
setIcon(idle);
setToolTipText(user.getUsername() + " (Idle)");
return this;

Similar Messages

  • Packaging and accessing resources in a JAR

    I'm working on an application and I would like to package my resources (icons, about dialog images, splash screen images, release version text, etc.) in the jar file I'm going to distribute for deployment.  I would like to access these resources from the JAR file in my deployed code.  But I would also like them accessible when I'm running the code in my Eclipse IDE.  Is there a way to do this using only one code base?
    My Eclipse project structure is src (folder) which contains my source code, bin (folder) which contains my class files and res (folder) which contains my resource files.
    I am using the javapackager utility to create my deployment JAR and build a self-contained deployment .exe for deploying to Windows.
    Is there a way to have the javapackager build a single JAR file from multiple sources (i.e. my bin and res folders)?  What do I have to do in my code so that the same code can be used to load resources when I'm running in Eclipse and the self-contained deployment?
    Thanks,
    Mike

    The Java Tutorials has several trails for loading resources.
    Retrieving Resources (The Java™ Tutorials >                    Deployment > Java Web Start)
    Use the getResource method to read resources from a JAR file. For example, the following code retrieves images from a JAR file.
    // Get current classloader
    ClassLoader cl = this.getClass().getClassLoader();
    // Create icons
    Icon saveIcon  = new ImageIcon(cl.getResource("images/save.gif"));
    Icon cutIcon   = new ImageIcon(cl.getResource("images/cut.gif"));
    The example assumes that the following entries exist in the application's JAR file:
    •images/save.gif
    •images/cut.gif
    See that last sentence?
    You put what you need in the jar file and then use the 'getResource' methods to load them.

  • Accessing resource files inside Jar using Fat Jar Eclipse plugin

    Hi,
    I want to develop single JAR file that uses a set of other JAR libraries. I am using Fat Jar Eclipse plugin. It works fine. However, I have problem to access resources files (i.e. rdf file) using relative path from my classes. Is there any idea how can I pack, set classpath and use relative path in order to make it works.
    Thanks
    Zoran

    I have solved this problem. The problem was in a way how I have trying to access it. It should be like:
    URL fileURL = this.getClass().getResource("resource/myFile.rdf");
    Zoran

  • Missing version field in response from server when accessing resource

    HY
    I have a problem to use the version option of the webstart. All files are included into a war file (created with jar cvf xx.war *). This file is in the webapps folder of the Tomcat 5. The jar files from the dev. kit (jnlp-servlet.jar, jaxp.jar, parser.jar are in the WEB-INF/lib folder).
    Every time I get the same message:
    Category: Download Error
    Missing version field in response from server when accessing resource: (http://localhost:8080/version/ademo.jar, 1.1)
    Do I need a aditional file or must Iwrite a servlet???
    Whats wrong
    my JNLP file
    <?xml version="1.0" encoding="utf-8"?>
    <!-- JNLP File fuer HJP3 WebStart Demo-Applikation -->
    <jnlp codebase="http://localhost:8080/version/" href="wstest.jnlp">
    <information>
    <title>HJP3 WebStart Demo Application</title>
    <vendor>Guido Krueger</vendor>
    <homepage href="http://www.javabuch.de"/>
    <description>HJP3 WebStart Demo Application</description>
    <icon href="wstest.gif"/>
    <offline-allowed/>
    </information>
    <information locale="de">
    <description>HJP3 WebStart Demo-Applikation</description>
    <offline-allowed/>
    </information>
    <security>
    <!-- <all-permissions/> //-->
    </security>
    <resources>
    <j2se version="1.4+"/>
    <jar href="ademo.jar" version="1.1"/>
    </resources>
    <application-desc main-class="Listing3813"/>
    </jnlp>
    my version.xml file
    <jnlp-versions>
    <resource>
    <pattern>
    <name>ademo.jar</name>
    <version-id>1.1</version-id>
    </pattern>
    <file>application.jar</file>
    </resource>
    </jnlp-versions>
    my web.xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
         <servlet>
              <servlet-name>JnlpDownloadServlet</servlet-name>
              <servlet-class>com.sun.javaws.servlet.JnlpDownloadServlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>JnlpDownloadServlet</servlet-name>
              <url-pattern>*.jnlp</url-pattern>
         </servlet-mapping>
    </web-app>

    The log file (jnlpdownloadservlet.log) would show the calls for the jar files if the servlet is called for the jar files (did you correct the url mapping ?). Here are a few lines from a log file
    JnlpDownloadServlet(4): Initializing
    JnlpDownloadServlet(3): Request: /maportal/wfe/wfeguiv.jnlp
    JnlpDownloadServlet(3): User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8
    JnlpDownloadServlet(4): DownloadRequest[path=/wfe/wfeguiv.jnlp isPlatformRequest=false]
    JnlpDownloadServlet(4): Basic Protocol lookup
    JnlpDownloadServlet(4): JnlpResource: JnlpResource[WAR Path: /wfe/wfeguiv.jnlp lastModified=Tue Mar 23 17:06:56 CET 2004]]
    JnlpDownloadServlet(3): Resource returned: /wfe/wfeguiv.jnlp
    JnlpDownloadServlet(4): lastModified: 1080058016000 Tue Mar 23 17:06:56 CET 2004
    JnlpDownloadServlet(3): Request: /maportal/wfe/wfegui.gif
    JnlpDownloadServlet(3): User-Agent: JNLP/1.0.1 javaws/1.4.2_03 (b02) J2SE/1.4.2_03
    JnlpDownloadServlet(4): DownloadRequest[path=/wfe/wfegui.gif isPlatformRequest=false]
    JnlpDownloadServlet(3): Request: /maportal/wfe/wfegui.jar
    JnlpDownloadServlet(3): User-Agent: JNLP/1.0.1 javaws/1.4.2_03 (b02) J2SE/1.4.2_03
    JnlpDownloadServlet(4): DownloadRequest[path=/wfe/wfegui.jar isPlatformRequest=false]
    JnlpDownloadServlet(4): Basic Protocol lookup
    JnlpDownloadServlet(4): JnlpResource: JnlpResource[WAR Path: /wfe/wfegui.jar lastModified=Tue Mar 23 17:06:30 CET 2004]]
    JnlpDownloadServlet(3): Resource returned: /wfe/wfegui.jarYou should see all the resources (including jar files) being requested, and whether a specific version was requested or not (in above sample, not).
    I put my problems down to my application server (Orion) as other people seem to have this working. The deployment in Orion keeps the original timestamps of the jars, so I explicitly set the timestamps in my build so that the unchanged jars do not have to be downloaded all the time. This is not really a good solution, so maybe someone else can give further advice.
    Brendan

  • Access denied while loading jar files from client

    I am creating a platform
    that can be started by JWS
    and then load plug-ins from client drive.
    I've signed my platform (packaged as a jar file),
    and set up the security tag in my jnlp,
    so that it can access client files.
    The plug-ins are packaged as jar files.
    And in one of the plug-ins, there is a class that has a JFileChooser field.
    While initializing this field, the AccessControlException is thrown.
    I can't figure out what is wrong,
    So I tried to sign the plug-in, but the problem stands still.
    PS. I have made my own ClassLoader,
    and this platform works well without JWS.
    Please help me, thanks.
    Below is the error message:
    Java Web Start 1.4.2 &#20027;&#25511;&#21488;,&#24050;&#21855;&#21205; Fri Jul 02 01:31:17 CST 2004
    Java 2 Runtime Environment:&#29256;&#26412; 1.4.2,&#20316;&#32773;:Sun Microsystems Inc.
    /*my own log message*/
    2004/7/2 &#19978;&#21320; 01:31:23 pluginmanager.Activater activate /*this is my own classloader*/
    &#37197;&#32622;: activate jar=\Plugins\Common.jar /*load plug-in Common.jar*/
    2004/7/2 &#19978;&#21320; 01:31:23 pluginmanager.Activater activate
    &#32048;&#32251;: collect resources /*collect other jar files needed by Common.jar*/
    2004/7/2 &#19978;&#21320; 01:31:23 pluginmanager.Activater activate
    &#32048;&#32251;: load plugin=\Plugins\Common.jar
    2004/7/2 &#19978;&#21320; 01:31:23 pluginmanager.Activater activate
    &#32048;&#32251;: activating class name=filemanager.FileManager /*instantiate plug-in component*/
    java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at java.io.Win32FileSystem.getUserPath(Unknown Source)
         ... /*cut*/
         at javax.swing.JFileChooser.<init>(Unknown Source)
         at filemanager.Open.<init>(Open.java:20)
         at filemanager.FileManager.<init>(FileManager.java:38)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         ... /*cut*/
         at java.lang.Class.newInstance(Unknown Source)
         at pluginmanager.Activater.activate(Activater.java:120)
         at pluginmanager.PluginManager$ActivateAction.actionPerformed(PluginManager.java:53)

    When running under Java Web Start, a security manager is installed.
    Since you have created your own classloader, you are responsible for assigning permissions to the classes you load.
    You can change you class loader to extend SecureClassLoader, then override getPermissions:
    protected PermissionCollection getPermissions(CodeSource codesource) {
    PermissionCollection perms = super.getPermissions(codesource);
    /* add whatever permissions you want your code to hance*/
    perms.add( ... );
    /* or just add all-permissions */
    perms.add(new AllPermission());
    or - you can just remove the Security Manager:
    System.setSecurityManager(null);
    /Dietz

  • Missing version filed in response from server when accessing resource

    Hello all,
    I am getting the following error when trying to do jar version download in webstart.
    Missing version field in response from server when accessing resource(http://lo alhost:8080/jdc/jnlp/new/SimpleGUI.jar,1.0)
    I am using Tomcat 5.5.
    My web.xml looks like this,
    <web-app>
    <display-name>Tomcat Examples</display-name>
    <description>
    Tomcat Example servlets and JSP pages.
    </description>
    <servlet>
    <servlet-name>
    JnlpDownloadServlet
    </servlet-name>
    <servlet-class>
    jnlp.sample.servlet.JnlpDownloadServlet
    </servlet-class>
    <init-param>
    <param-name>
    logLevel
    </param-name>
    <param-value>
    DEBUG
    </param-value>
    </init-param>
    <init-param>
    <param-name>
    logPath
    </param-name>
    <param-value>
    c:\logs\jnlpdownloadservlet.log
    </param-value>
    </init-param>
    </servlet>
    <servlet-mapping>
    <servlet-name>JnlpDownloadServlet</servlet-name>
    <url-pattern>/jdc/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>JnlpDownloadServlet</servlet-name>
    <url-pattern>*.jnlp</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>JnlpDownloadServlet</servlet-name>
    <url-pattern>*.jar</url-pattern>
    </servlet-mapping>
    </web-app>
    My version.xml file.
    <jnlp-versions>
    <resource>
    <pattern>
    <name>SimpleGUI_v1.0.jar</name>
    <version-id>1.0</version-id>
    <locale>en_US</locale>
    <locale>en</locale>
    </pattern>
    <file>SimpleGUI_v1.0.jar</file>
    </resource>
    <resource>
    <pattern>
    <name>SimpleGUI_v2.0.jar</name>
    <version-id>2.0</version-id>
    <locale>en_US</locale>
    <locale>en</locale>
    </pattern>
    <file>SimpleGUI_v2.0.jar</file>
    </resource>
    </jnlp-versions>
    My jnlp file is as follows,
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/jdc/jnlp/new" href="SimpleGUI.jnlp">
    <information>
    <title>SimpleGUI</title>
    <vendor>Java Developer Connection</vendor>
    <homepage href="/jdc/jnlp/new/index.html" />
    <description>Demonstration of JNLP</description>
    </information>
    <offline-allowed/>
    <resources>
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.5+ " />
    <jar href="SimpleGUI_v1.0.jar" version="1.0"/>
    <jar href="AddLogic_v1.0.jar"/>
    <jar href="SimpleGUI_v2.0.jar" version="2.0"/>
    <jar href="AddLogic_v2.0.jar"/>
    </resources>
    <application-desc main-class="com.logic.SimpleGUI" />
    </jnlp>
    For the codebase if I use $$codebase then it reports an error showing,
    The field <jnlp> codebase has an invalid value:$$codebase
    I think the JnlpDpwnloadServlet is not getting invoked. I cant figure out my mistake. I am tired searching in forums and there is no proper answer to this problem. Any help is appreciated.
    Thanks in advance.
    Regards,
    robi

    Thanks for including all your code. I've ran into version download problems before also. In the jar reference don't include the actual __V.jar file name, just include all pre __V.jar. <jar href="AddLogic_v1.0.jar"/> would become <jar href="AddLogic.jar"/>. Now I haven't done it with the version.xml before I just did it with making file named *__V.jar.
    I just re-read all that you did, if you title your files with the __V.jar notation you don't need a version.xml file.
    <jar href="SimpleGUI_v1.0.jar" version="1.0"/>
    Should become
    <jar href="SimpleGUI.jar" version="1.0"/>
    And you would have SimpleGUI_v1.0.jar on your server. Also might need it to be a capital "V" not sure.
    Message was edited by:
    javaunixsolaris

  • How to Read all files inside resource Folder inside Jar?

    I have a Jar file,,,, The program reads for resource files in the resource folder inside the Jar. I want my program to read all files inside this folder without knowing the names or the number of files in the folder.
    I am using this to make an Applet easy to be updated with spicific files. I just want to add a file inside the resource folder and Jar the program and automatically the program reads what ever is in there!!
    I used the File class to get all file names inside the resource folder. it works fine before Jarring the program. After I jar I recieve a URI not Herarichy Exception!!
    File fold=new java.io.File(getClass().getResource(folder).toURI());
    String[] files=fold.list();
    I hope the question is clear!!

    How to get the directory and jar file that you class resides in:
    // returns path and jarfile (ex: /home/mydir/my.jar)
    public String getJarfileName()
            // Get the location of the jar file and the jar file name
            java.net.URL outputURL = YourClass.class.getProtectionDomain().getCodeSource().getLocation();
            String outputString = outputURL.toString();
            String[] parseString;
            int index1 = outputString.indexOf(":");
            int index2 = outputString.lastIndexOf(":");
            if (index1!=index2) // Windows/DOS uses C: naming convention
               parseString = outputString.split("file:/");
            else
               parseString = outputString.split("file:");
            String jarFilename = parseString[1];
           return jarFilename;
    }If your my.jar was in /home/mydir, it will store "/home/mydir/my.jar" in jarFilename.
    note: getLocation returns "file:/C:/home/mydir/my.jar" for Windows/DOS and "file:/home/mydir/my.jar" for windows, thus why I look for the first and last index of the colon so I can correctly split the string.
    If you want to grab a file in the jar file and get an InputStream, do the following:
    import java.io.*;
    import java.util.Enumeration;
    // jar stuff
    import java.util.jar.*;
    import java.util.zip.ZipEntry;
    public class Jaris
       private JarFile jf;
       public Jaris(String jarFilename) throws Exception
           try
                           jf = new JarFile(jarFilename);
           catch (Exception e)
                jf=null;
                throw(e);
       public InputStream getInputStream(String matchString) throws Exception
           ZipEntry ze=null;
           try
              Enumeration resources = jf.entries();
              while ( resources.hasMoreElements() )
                 JarEntry je = (JarEntry) resources.nextElement();
                 // find a file that matches this string from anywhere in my jar file
                 if ( je.getName().matches(".*\\"+matchString) )
                    String filename=je.getName();
                    ze=jf.getEntry(filename);
          catch (Exception e)
             throw(e);
          InputStream is = jf.getInputStream(ze);
          return is;
       // for testing the Jaris methods
       public static void main(String[] args)
          try
               String jarFilename=getJarfileName();
               Jaris jis = new Jaris(jarFilename); // this is the string we got from the other method listed above
               InputStream is=jis.getInputStream("myfile.txt"); // can be used for xml, xsl, etc
          catch (Exception e)
             // this is just a test, so we'll ignore the exception
    }Happy coding! :)
    Doc

  • Unable to Access Resource Error in AE CS6

    Hello,
    I'm running After Effects CS6 11.0 on MAC OSX  and everytime I attempt to apply text, either by creating a new text layer from the drop down menu or dragging open a text box I get
    "Unable to Access Resource    P_TextSmallCaps_Sm_N_D (type png)"
    Is this a png file missing from the program, a fixable bug or what?
    Any help at all would be greatly appreciated. Thank you.

    Run the Creative Cloud Cleaner Tool, reinstall the program. Something is damaged.
    Mylenium

  • How to raplace resource files in jar file by other files?

    Can I replace resource files (ex: some jpeg file which is in the jar file) when midlet execute on the phone. Is it possible?
    Usualy, we use getResourceAsStream(filename) to get resource data as stream.
    Is there some API function like 'setResource(filenmae,stream)' ??
    Assume that I have a javaME application which displays some image in the jar file.
    It is different from general image viewr program because it can display only
    image file in the jar file (it means image file is resource file of java applcation).
    In other words, when application executes, It shows always same image at first.
    but I want that user can change image displayed if user wnat to do. I want to embed
    authoring function into application. So user can replace resource file by other image files on the phone.
    How to do that?

    I already told you, you CAN'T replace resources in a jar file.
    [http://forums.sun.com/thread.jspa?threadID=5334325]
    Look into using rms to save content on a mobile device.
    Now do you have anything else you want to ask?
    db
    edit And it's also rude to repost the question here without posting a response on the other topic you started.
    Edited by: Darryl.Burke

  • Listing resources in a .jar

    How can you list the resources in a jar file, and step through all the different directories.
    I want to be able to find out all the images in the /image directory
    and load them into memory. The image directory may also include sub directories containing more images.

    Have you tried JarFile?
    There are examples on the web.
    http://www.google.co.uk/search?num=20&hl=en&ie=UTF-8&c2coff=1&q=java.util.jar.JarFile+example&btnG=Search&meta=

  • Project Online - offline project plan prompts for date range to be entered when accessing Resource Usage view

    When I save a project plan to my local computer from Project Online and open it up in an offline mode and access Resource Usage view I get prompted with Date Range dialog boxes with the first one saying "Show resources/assignments that start or finish
    after:" and the second one with "And before:".
    I don't have any filters that are setup in Project Online that are not available in offline mode to trigger these prompts.
    Please let me know what could be causing the date range prompts. Thanks.

    Hi,
    You probably retrieve an enterprise filter into your local file. Just open the organizer from MS Project, go to the filter tab (be sure to have your project selected in the drop down menu at the top left of right of the organizer) and delete the date range
    filter.
    Hope this helps,
    Guillaume Rouyre, MBA, MCP, MCTS |

  • How to remove admin permissions AD DS when admin from one forests access resources in another forest?

    Hello Community
        A  forestA and 
    a forestB exists on the network.
        In forestA, active directory has an administrator.
        In forestB, activre directory also has an administrator.
        There is a trust reletionship between the 2 forests.
        When the administrator for forestA  accesses resources
    in forestB,  how can I make sure that the administrator in
    forestA does not have administrative permissions in foresB?
        Thank you
        Shabeaut

    They do not have access by default unless if you delegate that to them. For high secure environments, you might consider implementing a Selective Authentication: http://technet.microsoft.com/en-us/library/cc755844(v=ws.10).aspx
    This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.
    Get Active Directory User Last Logon
    Create an Active Directory test domain similar to the production one
    Management of test accounts in an Active Directory production domain - Part I
    Management of test accounts in an Active Directory production domain - Part II
    Management of test accounts in an Active Directory production domain - Part III
    Reset Active Directory user password

  • Accessing Video File within .Jar

    Ok, I am creating a project where I am using JMF to display several pre-created videos. The finished project is going to be placed on a cd and submitted in a contest. Because of this, I am compiling the finished project into an executable .jar file. From my previous experiences, I have found that accessing files inside a jar is much more complex than accessing just any old file. The only way I have found to successfully access files inside a jar is through InputStreams (opposed to URLs). This is where my issues begin.
    I have been searching throughout the internet for the past 2 days trying to find any way to create a Player using a type of InputStream. This doesnt seem to be possible the way it is set up. My obsticle here seems to be getting the Manager to realize the File. Here is what I've tried and the errors I got:
    File -- NoPlayerException -- Expected. When creating a file, it doesnt know to look inside the jar for the file, but to the location of the jar instead. Perhaps there is a way to tell URL to look for the file inside the jar. If so, please tell me how.
    File movie = new File("video1.mpeg");
    JOptionPane.showMessageDialog(null, "File: " + movie + "\n URL: " + movie.toURL() + "\n URI: " + movie.toURI() + "\n URL Parsed URI: " + movie.toURI().toURL(), "Error", JOptionPane.ERROR_MESSAGE); //JOptionPane used to display background information while program is running after compiled in .jar
    MediaPanel mediaPanel = new MediaPanel(movie.getURL());
    InputStream -- Compiling Error -- So my primary method of getting Files inside jars are out the window since there is no way to get the URL of InputStreams.
    InputStream movie = getClass().getResourceAsStream("video1.mpeg");
    MediaPanel mediaPanel = new MediaPanel(movie);
    Creating MediaLocator to file location -- java.net.MalformedURLException: no protocol: video1.mpeg -- I assume that basically means I'm screwed.
    MediaLocator movie = new MediaLocator("video1.mpeg");
    JOptionPane.showMessageDialog(null, "File: " + movie + "\n URL: " + movie.getURL(), "Error", JOptionPane.ERROR_MESSAGE);
    MediaPanel mediaPanel = new MediaPanel(movie.getURL());
    Using URL to get into .jar -- NoPlayerException -- No clue about this one. Just tried this a minute ago.
    URL movie = HannibalProject.class.getResource("video1.mpeg");
    JOptionPane.showMessageDialog(null, "URL: " + movie, "Error", JOptionPane.ERROR_MESSAGE); // Displays "URL: jar:file:/G:/Latin/HannibalProject.jar!/video1.mpeg" I do not know if this is correct or not, perhaps someone could tell me.
    MediaPanel mediaPanel = new MediaPanel(movie);If anyone can help me with this, I will be GREATLY appreciative. If anyone needs more information, additional code snippets, ect. please ask and I'll provide what is needed to help me.
    Edited by: Aussiemcgr on Jan 10, 2010 7:03 PM

    And there arises the pain-in-the-ass that is not yet clear to me. For this particular thing, it needs to be an application, not an applet. Which means I have to make it an executable (alternative might be a .bat, havent played with those for anything other than scripts) instead of something embedded. For whatever reasons, this is the efficiency of the school system or whatever the hell it is.
    The simple fact in all of this is that I have no information about the computer this is going to be ran on. Effectively, I am doing this all in the dark right now because I have been given NO guarantee that the computer(s) I attempt to run this on will even have the Java Virtual Environment on it. And, unfortunately, I have no way of finding any of this out because the Computer Program category of these things are not yet been taken seriously so preparation for judging is a last-minute thing.
    Basically, I am wanting to do this with the least amount of possibilities for Murphy's Law (which means I probably shouldnt be using JMF to begin with, but I hate that incomplete feeling) to happen. For the dark abyss I am traveling into, I'm wanting to leave as little external dependencies as possible. For applets, I have to assume that the computer has some sort of browser (sounds stupid, but it is the school system). Not to mention I've designed it from the ground up to work as an application, instead of an applet (roughly 20 hours of work so far, including text research and coding).
    The contest is Jan 30 so the date is approaching real quick. Quite honestly, the more I am looking at it, the more I am starting to consider getting rid of the videos altogether since I am pretty much done with the project with the exception of that. I would have 9 videos total (made only 1 to make sure it would work before making the other 8). The videos itself would only add an additional flair at best, and pretty much guarantee the 1st place for me. My teacher thinks my program's current capabilities, with just a mouse hover and mouse clicking interface with some animated gifs that allows access to several neatly displayed texts, would probably win me first place. However I feel I would go crazy if I actually had legitimate competition for once and lost because I didnt include this damn multimedia. Not to mention I want to include this on my portfolio in the somewhat distant future (along with my Poker Program I finished last month)...I dont know where I'm going with this...

  • Accessing Resource Central

    Pardon my asking this simple question as I suspect I am missing something obvious, (I did a search of the forum and did not find anything on it)
    Where and how do I access RESOURCE CENTRAL ?
    I want to look at the new scores as well as the sound effects
    Thank you

    Thnaks Jeff
    Knew it was something simple
    BUT it does not want to connect - the little circular arrow just goes round and round

  • Access wav-files in jar-archives (URL works, File works not)

    Hi there!
    The un-jar-ed application works fine, but I have a problem with accessing files in jar archives.
    URL url = Classname.class.getResource("testdir/test.wav");works fine (and loading images works this way), but as soon as I try to get the file
    File file = new File(url.getFile());I get an null-exception.
    (in my case, I use the jmf package to play the sound-files, and I get the problem when I try to instatiate the MediaLocator
    MediaLocator mediaLocator = new MediaLocator(url);but I think the problem is the same)
    Thanx for help

    works fine Then keep doing it that way. What's the problem? It's true that you can't access something in a jar archive via a File object, so don't do that.

Maybe you are looking for

  • Hi all query on script

    what is the use of standard text in scripts.how to use styles in scripts.can u give me a detailed code for the subroutine what we write in se71 as well as the subroutine pool in se38 and scrreen shots if u have . my mail id is [email protected] rewar

  • Multiple applications in standalone OC4J

    I'm using Eclipse in XP to deploy applications to the standalone OC4J server. Certain applications use different .jar files from the others. I understand that all jars in the c:\oracle\oc4j10.1.3\j2ee\home\applib are used by all applications. When us

  • UIX LOV: How to Design an LOV that provides lookup value to multiple field

    Hi, I've have an input form which has following fields. 1) Task Name1: (input lookup field. invokes LookupTask.uix) 2) Task Name2: (input lookup field. invokes LookupTask.uix) 3) Task Name3: (input lookup field. invokes LookupTask.uix) 4) TaskId1 (hi

  • Problem Install After Effects CC on OS X Mavericks 10.9

    I get an error try to update after effect CC manually on OS X Mavericks . According to this page: http://helpx.adobe.com/after-effects/kb/effects-launch-mac-os-109.html I have to download and instal an update manually. But when I try to install the p

  • Should I color correct in Premiere Pro or something else?

    Hey guys, I'm an experienced noob in digital video production. I learned on using an HD camera and Final Cut Pro 7 in my communications class. But now that I graduated, I bought myself a t3i and the adobe creative cloud. My question is, should I colo