Database in a jar?

G'day folks, there is a similar but different question down below, but I will ask this anyways as I have gone through the archives and couldn't find an answer.
using 1.4.1_01 and MSAccess as my database.
I have written a small application that accesses a MSAccess DB. I have access on my machine and created the DB through the System dns steps, and am using the sun.jdbc.odbc.JdbcOdbcDriver (bridge driver), so, on my machine, the program works great. but I wanted to bundle it into a .jar and give it to a friend. So I placed the following in a jar called CoffeeJar.jar -
PracDb.mdb
InsertCoffeesGUI.class
and then there is also the Manifest.mnf (which just has Main-Class: InsertCoffeesGUI)
InsertCoffeesGUI is the main class. Now my understanding was that when InsertCoffeesGUI is compiled (and it has the Class.forName statement) it includes all the files that you need to run that class. And I thought that if you simply put the database and the class which accesses it in the same .jar file they should connect and talk. BUT, they don't and I get the error - [Microsoft][OdbcDriverManager]Data source name not found and no default driver specified - after searching the archives I have found some confusing info.
The first confusing part was stated that you have to include in the manifest file, a Class-Path: header with a relative path to the bridge driver.
the second confusing part was a statement that you have to include the driver in the .jar.
So, my questions are?
1.what else do I have to do to get the .class file to connect to and talk to the PracDb?
2. do I have to include the Class-Path statement in the manifest file to the jdbc.odbc bridge driver. if so what is the path. the closest that I can figure out is c:\"Program Files"\java\j2re1.4.1_01\lib\ext and from that I find a number of executable jar files including dnsns.jar - which is the only one that kinda sounds like it might be useful.
3. Do I have to include a driver in the .jar?
4. should I be using another database which is an embedded DB? and what the heck is an embedded DB? - I found a reference to hsqldb and went to the website and still couldn't figure this out? i.e how is an embedded db different from a msaccess Db?
5. Am I supposed to create a dns on my friends computer - this is not very practical?
Any other information or references to info would be greatly appreciated. Thanks alot as always for helping me understand?

So would my CoffeeJar.jar contents look like this?
InsertCoffeesGUI
mydatabase
MySQL.jar
MySQL-Connector-java
and then with these items in there my application should be able to connect with my database? Sorry to be a pain, but I can't find anything anywhere. There is lots of info on JDBC and lots of info on JAR but nothing about how to put the two together, or what you need to do to get them to work together in a .jar!!!
Thanks for your help, Oz!!!!!!!

Similar Messages

  • Database in a jar file

    I have an application packaged in a .jar executable. It connects to an Access database using the JDBC-ODBC bridge, so I have the data source set up on my PC, all this works fine.
    My question is how would I go about putting the database into the .jar executable so my files can access it without a user haveing to set up a datasource on thier PC?
    Thanks for any help

    I don't think you are going to be able to reach into a jar and do random access to one of the files inside of it. That's essentially what databases do. So while you might be able to put an .mdb file into a zip, you are going to have to get it out and onto the users hard drive to do anything with it.
    Here's a link which talks a little about that (and web start too)
    http://forum.java.sun.com/thread.jsp?forum=38&thread=242403
    Now that you have an access file, you've got to talk to it. If you don't want to have a DSN, you can either go DSNless
    http://forum.java.sun.com/thread.jsp?forum=31&thread=297824
    or use an MSaccess JDBC driver
    http://servlet.java.sun.com/products/jdbc/drivers

  • How to use database file within jar archive

    Hi. I'm quite new in Java programming, and I'm wondering if what I did makes sense or not.
    In my applet I'm using a MS Access Database file, which is contained in the same Jar Archive like the Applet class file. I tried and tried to use this Database file directly but it wouldn't work. Than I read in some other forum that it is not possible to use the database file directly within the archive. First question: Is that true?
    Than I desided to extract the DB file in the init() method of my applet to the default temporary foulder. When the program is closed I use the destroy() method to delete it again. Everything works well now. But is this the typical way this is done?
    Thanks for help!

    Hi,
    here is the code which extracts the database file out of the jar archive (the same archive in which the class file is):
    //get the user temporary folder
    File TempFolder = new File(System.getProperty("java.io.tmpdir"));
    //create (empty) db file
    efile = new File(TempFolder, "steelSections.mdb");
    // if database file is not yet extracted
    if (!efile.exists()) {
    //get an input stream for the database file
    InputStream in = new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream(
    "FaST/db/steelSections.mdb"));
    //create an output stream for the db file on the file system
    OutputStream out = new BufferedOutputStream(new FileOutputStream(efile));
    //-Buffer to copy the data
    byte[] buffer = new byte[2048]; //buffer to copy the binary
    for (;;) {
    int nBytes = in.read(buffer); //read data
    if (nBytes <= 0)
    break; //no more data to read
    out.write(buffer, 0, nBytes); //write data
    out.flush(); //close out and in streams
    out.close();
    in.close();
    If you have the db file in an other jar archive file you need a referenze to the entry in the other jar archive. I'm not sure how to get this, but I'm sure you fill find a solution by searching in this forum...
    Good luck!

  • Connecting to a database inside a JAR?

    Hi,
    Can I do the following:
    Connect to flatfile database inside the same jar as my program? i.e., would something along the lines of:
    jdbc:jar://db.txt
    work? And if so, what would be the correct way to do it, other than my horrible example above. If so, what database/jdbc driver can i use for it?
    Thanks in advance for all help!
    Stu

    You could retrieve the data but your gonna have problems when it comes time to update.

  • Please help, cannot connect to Access database with a jar file

    Hi, i created a jar file from my java project, using eclipse.
    When i try open the jar through command prompt, the following error is given:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Could not find
    file '(unknown)'.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at Methods.con(Methods.java:15)
    at LoginScreen.getCmboLogins(LoginScreen.java:80)
    at LoginScreen.getJContentPane(LoginScreen.java:65)
    at LoginScreen.initialize(LoginScreen.java:46)
    at LoginScreen.<init>(LoginScreen.java:31)
    at DataUse.main(DataUse.java:25)
    No Connection to dataBASE
    The program runs fine within eclipse and the database is bundled in the jar.

    rohangr wrote:
    The program runs fine within eclipse Because the database isn't in the jar.
    ...and the database is bundled in the jar.That isn't going to work.
    The MS ODBC driver (which has absolutely nothing to do with java) expects to find the MS Access file in the windows file system.
    And the contents of the jar file does not fit into that requirement.

  • How do I include the MIDI sound database in my JAR?

    Do I just put it in the Jar and type include soundbank or something?

    EJP wrote:
    MIDI not working on other PC's.And still no SSCCE.
    db

  • Loading SOAP.jar into a 10g database

    Hello,
    We recently moved from a 9i Oracle DB to a 10g.
    On the Oracle 9i we used the guidelines mentioned in http://www.oracle.com/technology/tech/java/jsp/pdf/JavaDB_Use_Case.pdf to set up the communication with a secure webservice.
    However after having switched to the new database these same JAR files no longer seem to be valid. Well actually only the SOAP.jar will no longer load into the database. It complains about a missing classes (OracleSOAPHTTPConnection could not be resolved) - the "funny" thing however is that exactly that class is be defined in SOAP.jar if you open up the jar file.
    Can anyone give me hints about what might be wrong - Obviously I am missing something quite fundamental - I am at a loss to what it could be though.
    Kind regards
    Bo

    See the Callout users guide http://www.oracle.com/technology/sample_code/tech/java/jsp/callout_users_guide.htm.
    Kuassi

  • Accessing a Derby database inside of a Jar file...

    Hello,
    I've browsed many threads that touch on aspects of this topic, but I still can't seem to figure this out. Here is my dilemma:
    [1] I have a simple application that stores some data using JavaDB.
    [2] Everything works fine when I bundle the app into a jar, as long as I leave my Database folder outside the jar
    [3] If I include the DB in the jar the app does not see it.
    [4] I can't just leave the folder outside the jar because I eventually plan on deploying the app as a Web Start program.
    The Dev guide on JavaDB says +"A database can be in one of many locations: in the current working directory, on the classpath, in a JAR file..."+, and this apparently can be set using the derby.system.home property. I currently use the following to set this property: System.setProperty("derby.system.home", ".myDatabase"); How would I need to change this to allow the app to find the database inside the jar? If this requires the DB to be read-only (which is fine with me), what properties need to be set to designate the DB as such?
    Any input would be greatly appreciated.

    Well, upon rereading the Derby Developer's Guide I found the information I sought in the section "Creating Derby databases for read-only use" (p.34-37). I'm still not 100% sure about how to do the Web Start implementation, but this should put me on the right track.
    [UPDATE IN CASE ANYONE STUMBLES UPON THIS THREAD] It seems that the issue with Web Start is that the database needs to be access a writable location for the temporary directory, so I presume web start would have to request disc-access privileges... something I'm trying to avoid.
    Edited by: CommanderSalamander on Nov 9, 2007 10:06 AM

  • Pointbase : How can I create a stored procedure with Pointbase database?

    Hello,
    Excuse me for my english, I'm not anglophone. I try to create a stored procedure.
    This is my file SampleExternalMethods.java :
      import java.sql.*;    //import com.pointbase.jdbc.jdbcInOutDoubleWrapper;          public class SampleExternalMethods    {      // A connection object to allow database callback      static Connection conn = null;      static Statement l_stmt;      static Statement m_stmt;      static CallableStatement m_callStmt = null;      static ResultSet l_rs = null;          public static void main(String[] args)      {        try        {          String url = "jdbc:pointbase:server://localhost/pointbaseDB";          String username = "PBPUBLIC";          String password = "PBPUBLIC";          conn = DriverManager.getConnection(url, username, password);          doCreateProcedure();          doInvokeProcedure();        } catch (SQLException e) {          e.printStackTrace();        } finally {          if (m_stmt != null) {            try {              m_stmt.close();            } catch (Exception e) {              e.printStackTrace();            }          }          if (m_callStmt != null) {            try {              m_callStmt.close();            } catch (Exception e) {              e.printStackTrace();            }          }          if (conn != null) {            try {              conn.close();            } catch (Exception e) {              e.printStackTrace();            }          }        }      }                  public static void getCountry(String Iso_Code)      {        try        {          // Query the database for the country iso code          l_stmt = conn.createStatement();          l_rs = l_stmt.executeQuery( "SELECT * FROM countries"          + " WHERE country_iso_code ='" + Iso_Code + "'");          //Affichage du résultat de la requête          l_rs.next();          System.out.print(l_rs.getString(1) + " - ");          System.out.print(l_rs.getString(2) + " - ");          System.out.println(l_rs.getString(3));          // Close the result set          l_rs.close();        } catch (SQLException e) {          e.printStackTrace();        } finally {          if (l_rs != null) {            try {              l_rs.close();            } catch (Exception e) {              e.printStackTrace();            }          }          if (l_stmt != null) {            try {              l_stmt.close();            } catch (Exception e) {              e.printStackTrace();            }          }        }      }            public static void doCreateProcedure() throws SQLException {        // SQL statement to create a stored procedure        String SQL_CREATE_PROC = "CREATE PROCEDURE getCountry(IN P1 VARCHAR(30))"        + " LANGUAGE JAVA"        + " SPECIFIC getCountry"        + " NO SQL"        + " EXTERNAL NAME \"SampleExternalMethods::getCountry\""        + " PARAMETER STYLE SQL";        // Create a SQL statement        m_stmt = conn.createStatement();        // Execute the SQL        m_stmt.executeUpdate(SQL_CREATE_PROC);        // Close the statement        //m_stmt.close();      }          public static void doInvokeProcedure() throws SQLException {        // Create SQL to invoke stored procedures        String SQL_USE_PROC = "{ call getCountry(?) }";        // Create a callable statement with three binding parameters        m_callStmt = conn.prepareCall(SQL_USE_PROC);        m_callStmt.setString(1, "CA");        m_callStmt.executeQuery();        // Close the callable statement        //m_callStmt.close();      }    } 
    Afterwards, I have read this note in a Pointbase document:
    To invoke the dateConvert external Java method from a stored function, you must use the
    CREATE FUNCTION statement. The dateConvert external Java method is called from the
    class, SampleExternalMethods.
    In order for the database to access this external Java method, the class SampleExternalMethods
    must be included in the database CLASSPATH. For PointBase Embedded - Server Option, it
    must be in the Server CLASSPATH, but not in the Client CLASSPATH.
    If PointBase Server is run with the Java Security Manager, in the java policy file grant
    ’com.pointbase.sp.spPermission’ to the class that implements the external Java method.
    An "spPermission" consists of a class name with no action. The class name is a name of a class
    that could be used in creating a Stored Procedure in PointBase. The naming convention follows
    the hierarchical property naming convention and that is supported by
    "java.security.BasicPermission". An asterisk may appear by itself, or if immediately preceded
    by ".", may appear at the end of the name, to signify a wildcard match. The name cannot
    contain any white spaces.
    I'm not sure, but I suppose that I must include the class SampleExternalMethods in a .jar file.
    The database CLASSPATH could be : C:\Sun\AppServer\pointbase\lib\
    These my files in this database CLASSPATH:
    pbclient.jar
    pbembedded.jar
    pbtools.jar
    pbupgrade.jar
    I have tryed to include the class SampleExternalMethods in pbclient.jar and pbembedded.jar with this command:
    jar -uf pbembedded.jar SampleExternalMethods
    Afterwards I do that,
    1) Start Pointbase
    2) Configuration of classpath
    set classpath=C:\Sun\AppServer\pointbase\lib\pbclient.jar
    set classpath=%classpath%;D:\J2EE\Ch07Code\Ch07_06
    I precise that my file SampleExternalMethods is into D:\J2EE\Ch07Code\Ch07_06\Ch07.
    Then, I run the program:
    D:\J2EE\Ch07Code\Ch07_06>java -Djdbc.drivers=com.pointbase.jdbc.jdbcUniversalDriver Ch07.SampleExternalMethods
    But I have an error message:
    Exception in thread "main" java.lang.NoClassDefFoundError: Ch07.SampleExternalMethods (wrong name: SampleExternalMethods)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.DefineClass(ClassLoader.java:539)
    The problem, I suppose, comes from that the class SampleExternalMethods
    must be included in the database CLASSPATH, but there is a pbserver.jar with pointbase normally, but I didn't find it. That's why I use pbembedded.jar or pbclient.jar in order to include the class SampleExternalMethods. May be I must start from C:\Sun\AppServer\pointbase\lib\ instead of D:\J2EE\Ch07Code\Ch07_06\Ch07?
    Please, can somebody helps me?
    Thank you in advance.
    cagou!

    jschell wrote:
    And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
    >And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
    >
    And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
    Thank you for your response, I have done two classes:
    SampleExternalMethods.java:
    package Ch07;
    import java.sql.*;*
    *public class SampleExternalMethods*
    *public static void getCountry(String Iso_Code)*
    *// A connection object to allow database callback*
    *Connection l_conn = null;*
    *Statement l_stmt = null;*
    *ResultSet l_rs = null;*
    *try*
    *String url = "jdbc:pointbase:server://localhost/pointbaseDB";*
    *String username = "PBPUBLIC";*
    *String password = "PBPUBLIC";*
    *l_conn = DriverManager.getConnection(url, username, password);*
    *// Query the database for the country iso code*
    *l_stmt = l_conn.createStatement();*
    *l_rs = l_stmt.executeQuery( "SELECT* FROM PBPUBLIC.COUNTRIES"
    +" WHERE country_iso_code ='"+ Iso_Code +"'");+
    +//Affichage du r&eacute;sultat de la requ&ecirc;te+
    +l_rs.next();+
    +System.out.print(l_rs.getString(1)+ " - ");
    System.out.print(l_rs.getString(2) +" - ");+
    +System.out.println(l_rs.getString(3));+
    +// Close the result set+
    +l_rs.close();+
    +} catch (SQLException e) {+
    +e.printStackTrace();+
    +} finally {+
    +if (l_rs != null) {+
    +try {+
    +l_rs.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (l_stmt != null) {+
    +try {+
    +l_stmt.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (l_conn != null) {+
    +try {+
    +l_conn.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +}+
    +}+
    +}+
    CreateMethods.java:
    +package Ch07;+
    +import java.sql.*;+
    +public class CreateMethods+
    +{+
    +// A connection object to allow database callback+
    +static Connection m_conn = null;+
    +static Statement m_stmt;+
    +static CallableStatement m_callStmt = null;+
    +public static void main(String[] args)+
    +{+
    +try+
    +{+
    +String url = "jdbc:pointbase:server://localhost/pointbaseDB";+
    +String username = "PBPUBLIC";+
    +String password = "PBPUBLIC";+
    +m_conn = DriverManager.getConnection(url, username, password);+
    +doCreateProcedure();+
    +doInvokeProcedure();+
    +} catch (SQLException e) {+
    +e.printStackTrace();+
    +} finally {+
    +if (m_stmt != null) {+
    +try {+
    +m_stmt.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (m_callStmt != null) {+
    +try {+
    +m_callStmt.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +if (m_conn != null) {+
    +try {+
    +m_conn.close();+
    +} catch (Exception e) {+
    +e.printStackTrace();+
    +}+
    +}+
    +}+
    +}+
    +public static void doCreateProcedure() throws SQLException {+
    +// SQL statement to create a stored procedure+
    +String SQL_CREATE_PROC = "CREATE PROCEDURE PBPUBLIC.getCountry(IN P1 VARCHAR(30))"+
    " LANGUAGE JAVA"
    +" SPECIFIC getCountry"+
    " NO SQL"
    +" EXTERNAL NAME \"SampleExternalMethods::getCountry\""+
    " PARAMETER STYLE SQL";
    // Create a SQL statement
    m_stmt = m_conn.createStatement();
    // Execute the SQL
    m_stmt.executeUpdate(SQL_CREATE_PROC);
    // Close the statement
    //m_stmt.close();
    public static void doInvokeProcedure() throws SQLException {
    // Create SQL to invoke stored procedures
    String SQL_USE_PROC = "{ call getCountry(?) }";
    // Create a callable statement with three binding parameters
    m_callStmt = m_conn.prepareCall(SQL_USE_PROC);
    m_callStmt.setString(2, "CA");
    m_callStmt.executeQuery();
    // Close the callable statement
    //m_callStmt.close();
    }But I have the same error message that previously.
    I have read this note and I suppose that the problem is linked:
    If PointBase Server is run with the Java Security Manager, in the java policy file grant
    *’com.pointbase.sp.spPermission’ to the class that implements the external Java method.*
    An "spPermission" consists of a class name with no action. The class name is a name of a class
    that could be used in creating a Stored Procedure in PointBase. The naming convention follows
    the hierarchical property naming convention and that is supported by
    *"java.security.BasicPermission". An asterisk may appear by itself, or if immediately preceded*
    by ".", may appear at the end of the name, to signify a wildcard match. The name cannot
    contain any white spaces.
    Can you explain me what I must to do in order to solve this problem of spPermission.
    Thanks.

  • New using databases in Java

    First of all hello, this is my first post in the Java oracle forum,
    I know basic knowledge of java(school) and some mysql database(self thought) too.
    I wanted to make a java app where i could use a database inside the same jar, but i am not pretty sure how to do this, i saw in a webpage where it said that if I used a database from a jar file the database wouldnt be writable just readable, is this true?
    can someone point me out in how to use a database for a executable jar?
    THX!
    PS: using netbeans

    It would probably be best if your application can create the database from scratch though - that's how I would do it anyway. Assuming you're talking about an embedded database of course; I would recommend H2 if you are as it is fast, robust and feature complete.
    http://www.h2database.com/html/main.html
    Then you only need to distribute the application jars and when the application runs and detects there is no database yet, it will generate it.
    The way I've dealt with that at one point in time is to give the user the option to choose an "installation directory". This gives the user the possibility to choose a directory that is safe and can actually be written to. In that directory I would then let the database be created - or recreated if someone would remove it by hand. There is the question of where you keep track of what directory the user picked; I'm lazy and I create a configuration file in the user's home directory (user.home Java system property) but you could also use the Preferences API for it.
    http://docs.oracle.com/javase/7/docs/api/java/util/prefs/Preferences.html
    Lots of information there, it will require some research if you're interested in doing something like this :)

  • Main-class not found error while clicking on the jar

    I have a created a jar �FinARM.jar� for my swing application using eclipse.
    Clicking on this jar, it is giving the problem main-class not found.
    It contains the MANIFEST.MF file, with entry Main-Class: FinAlignTest for the main class.
    FinAlignTest is my main class.
    I have a similar jar created with a small swing application (Single file) clicking on it can open the swing application.
    It is also attached above.

    Hi ,
    My Apllication runs with out any warnings or errors. But when i create a jar file using eclipse it is giving this problem.
    When i double click on the jar file i am getting this problem. MANIFEST.MF entry contains the main method entry.
    I have created another jar (Which contains a simple java file, swing application) from eclipse export option.
    It works fine on click.
    But jar FinARM.jar contains 5 files (Swing app), which even fetch some data from the database.
    My jar is placein the same machine where it can fetch data from DB
    Can u plese tell me whats the problem.
    -regards
    Anu

  • OBPM Configuring WebSphere Application Server  b1resource.jar

    in OracleBPM-ConfigGuide_10.3_2
    5. Press Next to enter the JDBC Classpath information.
    You must list the following .jar files:
    <ORABPM_HOME>/libraries/b1oracle.jar (Oracle only)
    <ORABPM_HOME>/libraries/b1db2.jar (DB2 only)
    <ORABPM_HOME>/libraries/b1sqlserver.jar (SQL Server only)
    <ORABPM_HOME>/libraries/b1util.jar
    Oracle BPM | Configuring Oracle BPM Enterprise on J2EE | 23
    <ORABPM_HOME>/libraries/b1resource.jar
    <ORABPM_HOME>/libraries/b1base.jar
    <ORABPM_HOME>/ext/fuego.database.websphere.helper.jar
    but i can't find b1resource.jar ?
    help
    Edited by: user2968659 on 2010-5-26 上午1:22

    Hi,
    Use the Deployment Manager Soap port not the Application Server port
    Maddy

  • Storing data with executable JAR

    if I have an executable JAR that needs to read and write from a text file so that users can customize the program, can I put the text file or any kind of database inside the JAR or does it have to go outside. Also, what is the best way to store such data, in a database or in a text file?

    if I have an executable JAR that needs to read and
    write from a text file so that users can customize
    the program, can I put the text file or any kind of
    database inside the JAR or does it have to go
    outside. I think it's safe to say that you'd need to create a folder to keep your files in. i.e. the Jar won't get updated.
    Also, what is the best way to store such
    data, in a database or in a text file?Depends, a small amount of simple data should go in a flat file, .txt is fine, whatever. If you have lots of (possibly complex) data and relationships between the data, etc. then you'd likely use a database.

  • .jar netbeans

    hello all,
    I created a jar file using netbeans put in a classpath for a database driver (derby.jar). There are also 8 classes in this jar file, i specified which main should start everything is working perfectly. But some of the classes access audio and images in the jar file, but i get an exception saying that i am missing these files but they are in the jar file! Anyone know why?
    This is how the class access these files:
    AudioStream sound1 = new AudioStream(new FileInputStream("Test.wav"));And this is the exception:
    Exception in thread "main" java.io.FileNotFoundException: Test.wav (No such file or directory)
            at java.io.FileInputStream.open(Native Method)
            at java.io.FileInputStream.<init>(FileInputStream.java:106)
            at java.io.FileInputStream.<init>(FileInputStream.java:66)
            at Splash2.sound(Splash2.java:89)
            at Splash2.<init>(Splash2.java:40)
            at Splash2.main(Splash2.java:124)Will appreciate any help since i really need to get this to work.
    Thanks all

    I have had this problem before also, the way i got it to work was using:
    AudioClip sound1 = Applet.newAudioClip(this.getClass().getClassLoader().getResource("SomeSoundFile.wav"));
    //It also works for getting images out of a jar file:
    ImageIcon imgicon = new ImageIcon(this.getClass().getClassLoader().getResource("SomeImage.gif") );
    Image img1 = imgicon.getImage();Calling this.getClass().getClassLoader().getResource("SomeImage.gif") returns a java.net.URL to the image in your jar file, then you need to call something that can accept a URL and get an image out of it (for example, I used ImageIcon for simplicity). (Note that you need to call it from an instantiated class, and not your main method, you would most likely make this call in a media loader class or something)
    The actual filename you submit as the getResource string is the path to the resource from the root jar directory, so if you had an image folder, you would just need to use something like "images/SomeImage.gif"
    Good luck, I hope this helps

  • Environment embed jar file

    Hi there,
    Is it possible to package the database in a jar fille and create an enviroment using this embedded database?
    The following code-snippet does not work:
    URL url = PcTools.class.getResource("/00000000.jdb");
    File envdir = new File(url.getPath().substring(0, dirName.lastIndexOf("/")));
    myEnv = new Environment(envdir, envConfig);
    thank you in advance

    Hi there,
    Is it possible to package the database in a jar fille and create an enviroment using this embedded database?
    The following code-snippet does not work:
    URL url = PcTools.class.getResource("/00000000.jdb");
    File envdir = new File(url.getPath().substring(0, dirName.lastIndexOf("/")));
    myEnv = new Environment(envdir, envConfig);
    thank you in advance

Maybe you are looking for

  • Error 1311 - source file not found...m182.cab

    Good Morning, I am trying to reinstall Crystal Reports XI on a blade server and the installation will not complete. I receive message, "Error 1311. Source file not found: Z:\win32\m182.cab. Verify that the file exists and that you can access it." I d

  • I have imported an album but the album does not display

    I just loaded Mannheim Steemroller's Extraordinair christmas CD.  But when I look at the album display nothing shows that it was loaded into iTunes.  However all of the trtacjs are listed in the "Reciently Added" listing in iTunes.  It includes the a

  • Has any one used RSA on Gemplus Xpresso Javacards? (JC 2.1.1)

    Hello, i ve been trying to generate an RSA keypair on my Xpresso card, but the applet fails to load... what i try is... package packJCardDemo1; import javacard.framework.*; import javacard.security.*; public class CardRWV extends Applet { private sta

  • How to get component to scale

    So I am working on a little flip book application that has a control bar below it to control the flip book. I decided to setup the control bar as a component which I have attached below. Got the component done and it is working with the flip book for

  • How to download Facebook app to my I pad 2

    When I am trying to download Facebook or other apps, it found not possible.