How to include the mysql-connector in a simple .jar file

Well I started up with java again. Just messing around. This project I'm making now is just plain simple, I have a program thats going to read a table in a database from a server I have here at home. It works fine if I do like this: java javafil to run the file, it reads from the database fine.
But when I made a .jar file out of it using this command: jar cmf manifest.txt javafile.jar *.class
It won't connect to the database. Or it doesn't print out the rows in the table. So I thought I have to include the mysql-connector with the .jar.
manifest.txt
Main-Class: javafile
Now what is an easy way to do this?
This program is also going to be run from a computer that might not have the mysql-connector installed on the computer. Like a friend of mine wants to connect to the database and read it.
I've tried to google "mysql connector in a .jar file" but I get tons of informations about the mysql-connector.jar instead of what I'm looking for.
Thanks,
Torbj�rn Svae
Edited by: LordSvae on 19.jun.2008 14:52

LordSvae wrote:
Yeah but the other computer might not have that connector file on their computer. So is there like I way I can use it when it is in the .jar file? Thats kinda what I wanted. You cannot include another JAR in a JAR file. You however can extract it and put the classes in your JAR. Verify the license agreement if it is allowed. Although this is considered as a bad practice (poor upgradebility and maintainability).
If you don't want to use the -cp parameter, then use the class-path entry of the manifest.mf of your JAR. You can also write a batch file with the whole JAR -cp command in a single line and run the batch file instead.
Pluss, even though I have the right classpath in the environment variables set, it doesn't work for me either. So I guess it doesn't load the connector when running the .jar file.The classpath environment variable has nothing to do with running JAR's. Forget about it and use the -cp or -classpath parameter.

Similar Messages

  • How to include the characters " " and " " in a XML properties file.

    hi
    including the following prop entry gives me the error "Element is not closed" error message.
    <entry key="test">can't include chars < and ></entry>
    But i need to include the chars "<" and ">" in my xml properties file.
    please help.
    thanks

    Try &lt; and &gt;
    Dave Patterson

  • How to include a JSP page contained in a JAR file ?

    Hello,
    I have a Servlet in which I would like to include, in the Response, the content of a JSP page contained in an external JAR file included in my lib directory ?
    Could someone help me please ?
    Thanks in advance.
    bgOnline

    I don't think thats possible with the standard j2ee server.
    There are probably ways around it, but it would involve a large component of custom coding.

  • How to get the com.sap.portal.admin.wizardframework_api.jar file

    Hi this is related to the wizard creating component required .jar file. Can any body tell me , how to get this jar file. I have searched in my IDE plug-in's folder. But i have nt find this.
    com.sap.portal.admin.wizardframework_api.jar
    how to get thid jar file.
    REgards
    Vijay

    Vijay,
    You can access the above mentioned par file from this location,
    System Admin -> support -> Support Desk->ROOT/WEB-INF/deployment/pcd (download this folder)
    ->com.sap.portal.admin.wizardframework.par.bak->extract the file
    alternatively,
    u can find the same in,
    \j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.portal.admin.wizardframework\lib
    Thanks & Regards,
    Ramganesan K
    Keane Inc

  • How to include the page dynamically in JSF

    Hi all
    Below is static include
    <jsp:include page="../inc/sideMenu.inc"/>
    How to include the file dynamically
    Thanks

    Hi,
    Though I have not tried it I think making use of a variable to hold the page name to be included should work. Could you try this and see if it works?
    Cheers
    Giri :-)

  • How to include the pages dynamically in JSF

    Hi all
    Below is static include
    <jsp:include page="../inc/sideMenu.inc"/>How to include the file dynamically
    Thanks
    Sudhakar

    Hi,
    Though I have not tried it I think making use of a variable to hold the page name to be included should work. Could you try this and see if it works?
    Cheers
    Giri :-)

  • How to include the insert picture option in the PDF form?

    Hi, Can some one please help How to include the insert picture option in the PDF form? I am using acrobat XI pro and trying to use an evaluation form which requires to insert product pictures.

    Here's a link to a previous topic where this was discussed: http://forums.adobe.com/message/6050458

  • How to Include the URL of a page in Notification Email ?

    Hi ALL,
    I need your help to implement the below requirement.
    I have implemented Email notification in our application.so when ever the user creates any form/modify the form ,mail will be triggered to them.Now the users want to include the link in the email.
    When they click the link in email ,it should be navigated to the newly created form page in Apex.
    How to include the link of the page in the Email process?
    Thanks,
    Ramya.

    Hi Tuceef,
    Thanks for the response.
    I have created another hidden item P8_URL1 IN page 8 and
    I have created an on submit process in page processing section.
    the pl/sql code is
    Begin
    htp.p('<script type = "text/javascript">');
    function setLocation(href)
               // set the location path specified in the textbox.
               htp.p('location.href = document.getElementById(href).value;');
              htp.p('P8_URL1:= location.href');
    htp.p('</script>');
    end;But the code fetching the plain URL only,it's navigating to the empty form page when i click on the URL.
    Please correct the code if am wrong anywhere!
    Thanks & Regards,
    Ramya.

  • How to Include the Infocubes in a Multiprovider..!!

    Hello Experts,
    Question is related to multiproviders. I have some 20 to 30 of the infocubes in Dev System.
    I have 2 multiproviders in the same system. I come to know..some of the infocubes missed out in multiproviders.
    I tried to add those missed infocubes into multiprovider (MPRO --> Context Menu --> Change ) Change Structure.
    But i found some of the infocubes are not available in the MPRO Structure Itself. For your info those all missed infocubes all are avaialable in the Dev system into some other info areas.
    Now Question is how to include the infocubes of which of them are not available in MPRO Structure itself. I want to add the infocubes in the Multiprovider itself.
    Please reply me the answer for the above scenario.
    Thanks and Regards,
    SN.

    Hi Parvin,
    Thanks for your reply. But i already tried as you mentioned.
    Here my issue is..even for giving the tickmark also..the infocube needs to be opened in the MPRO structure.
    My problem is Infocube itself is not opening in MPRO Structure.
    How to include the infocube in the MPRO Structure itself.
    Those cubes are avaialable in the Dev system where as those are not available in MPRO.
    Thanks,
    SN

  • How to include the simbol % in a flash chart

    hello everyone
    Do you know how to include the simbol % in a flash chart?
    I am using a 3D flash chart. This simbol obviously would be after that number of percentage.
    Do I must modify the chart XML adding some after that {VALUE} ?
    Any help would be very appreciated
    Thank you in advance
    Best Regards

    Erik:
    You can specify the '%' in the 'Postfix' field in the 'Display Settings' on the 'Chart Attributes' page.
    Varad

  • How to include the hebrew languare in the Oracle Data?

    Hi All,
    I'm using this code in nls_lang value in the registry to include Arabic and English languages in the data:
    AMERICAN_AMERICA.AR8MSWIN1256
    but how to include the hebrew language to be used in the data also Plz?
    Note: I'm using Oracle DB 10g R2

    Your database character set (SELECT value FROM nls_database_parameters WHERE parameter='NLS_CHARACTERSET') must be AL32UTF8 to support both Arabic and Hebrew. The client must be Unicode-enabled to enter both languages simultaneously.
    -- Sergiusz

  • How to include the Pipe symbol ("|") in the column heading.

    Hi ,
    Can somebody advice how to include the Pipe symbol ("|") in the column heading.
    Regards,
    Yagne

    Are you looking for this ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>set colsep '|'
    satyaki>
    satyaki>select * from emp;
         EMPNO|ENAME     |JOB      |       MGR|HIREDATE |       SAL|      COMM|    DEPTNO|JOB1     |DOB
    ----------|----------|---------|----------|---------|----------|----------|----------|---------|----
          7499|ALLEN     |SALESMAN |      7698|20-FEB-81|     211.2|       300|        30|SALESMAN |
          7521|WARD      |SALESMAN |      7698|22-FEB-81|      1650|       500|        30|SALESMAN |
          7654|MARTIN    |SALESMAN |      7698|28-SEP-81|      1650|      1400|        30|SALESMAN |
          7788|SCOTT     |ANALYST  |      7566|19-APR-87|      4356|          |        20|ANALYST  |
          7839|KING      |PRESIDENT|          |17-NOV-81|      6600|          |        10|PRESIDENT|
          7844|TURNER    |SALESMAN |      7698|08-SEP-81|      1980|         0|        30|SALESMAN |
          7876|ADAMS     |CLERK    |      7788|23-MAY-87|     145.2|          |        20|CLERK    |
          7900|JAMES     |CLERK    |      7698|03-DEC-81|      1254|          |        30|CLERK    |
          7902|FORD      |ANALYST  |      7566|03-DEC-81|    4791.6|          |        20|ANALYST  |
          7934|MILLER    |CLERK    |      7782|23-JAN-82|      1716|          |        10|CLERK    |
          7566|Smith     |Manager  |      7839|23-JAN-82|      1680|         0|        10|Manager  |23-JAN-89
         EMPNO|ENAME     |JOB      |       MGR|HIREDATE |       SAL|      COMM|    DEPTNO|JOB1     |DOB
    ----------|----------|---------|----------|---------|----------|----------|----------|---------|----
          7698|Glen      |Manager  |      7839|23-JAN-82|      1680|         0|        10|Manager  |23-JAN-89
          1111|Selen     |SALESMAN |      7499|20-FEB-81|      1920|         0|        20|SALESMAN |23-JAN-89
          1111|Selen     |SALESMAN |      7499|19-OCT-08|      3000|         0|        10|         |
          7499|ALLEN     |SALESMAN |      7499|19-OCT-08|      3000|         0|        30|         |
             1|boock     |         |          |         |          |          |          |         |
    16 rows selected.
    Elapsed: 00:00:01.03
    satyaki>Regards.
    Satyaki De.

  • How to include the first row of detail in every xquery transformed xml?

    I am dealing with a XML file,where i need to publish to different BS.
    First node will be a common node node which contains vital info,second node goes to one BS and third goes to another BS.
    *<header></header>*
    *<details></details> (they are unbounded, but the first detail tag which comes in the input file is a mandatory tag in such a way that it needs to be included in every transformed message)*
    *<trailer></trailer>*
    We need to apply x query transformation on it in such a way:
    *</header></header>*
    *<1st detail></1st detail>*
    *<detail></detail> (2nd row of detail in input file)* -------------------------> Goes to BS1
    *<trailer></trailer>..*
    *<header></header>*
    *<1st detail></1st detail>*
    *<detail></detail> (3rd row of detail in input file)* ----------------------------->Goes to BS2
    *<trailer></trailer>*..
    And so on.
    Now, the problem is how to include the first row( *1st detail* ) of detail in every xquery transformed xml?

    are you looping of this input with a for each?
    /yourdata/details[1] should return always the first detail element.
    or before the for each do an assing of this first detail element to "generic_details_var"
    and use this var in every looping iteration (in an assign or as input for xquery)

  • How to include the promotion and sales deal in the value contract ?

    Question : Can a value contract contain other special pricing agreement ?
    If yes, how to include the promotion and sales deal in the value contract ?
    Thanks for your input.
    Oscar

    Hi Oscar,
    I have not worked on this aspect as such but once you create a value contract I think you as well create a promotion and sales deal for the customer with whom you have value contract with in the validity period of the contract and system should pick up data accordingly as the customer is same (Contract) and is within the validity period.
    Pl give feed back.
    regards
    Srini

  • How to include the file name as an XML field

    Hi,
    I'm using a file adapter for process a flat file and convert it into an XML. Does anybody knows how to include the file name into an XML field.
    Ex.
    I process the file named <b>XXIMN21022007.txt</b> and I need an XML like:
    <MT_FILE>
    <field1></field1>
    <field2></field2>
    <field3></field3>
    <filename><b>XXIMN21022007.txt</b></filename>
    </MT_FILE>
    Regards
    Gonzalo

    Just go for dynamic configuration.
    Check the sender file adapter to write the filename in the header (as explained in Michal's blog) and then read that header in some mapping.
    U can use that even in simple message mappings.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm
    Your code for the filename tag would be something like:
    <i>DynamicConfiguration conf = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        “http://sap.com/xi/XI/System/File”,
        “FileName”);
    return conf.get(key);</i>
    Regards,
    Henrique.

Maybe you are looking for

  • Facing problem in creating socket in a method from an already deployed application exe while same method is working from another exe from same environment from same location.

    Dll Created In: - MFC VC 6.0 Application Exe Developed In: - VC 6.0, C# and VB.net (Applications which are using dll) OS: - Windows XP sp2 32bit / Windows Server 2008 64 bit Problem: - Facing problem in creating socket in a method from an already dep

  • Sort by file name

    I'm loading from negatives, all in random order, so I do not have valid time stamps on the Windows files.  I've renamed the file to put them in order.  Why can't I get Organizer to load them by name?  Once I fix and rotate the files why can't I see t

  • Photos not showing up in MacOS Desktop

    I read in a response to a message about downloading photos the following: "However you can move photos as you have already seen by using the quick install tool." I don't undertand it what that stement meant.  Sooo my question is: Is there any way I c

  • Need 3 column based on excel formulas, for Average cost of sales.

    hii,, i am using Oracle 10g... select pdate, pcode, pno, pqty, pprice, trade_amt      , qty_on_hand      , total_cost      , case when pqty < 0        then             lag (avg_price) over (order by pdate)        else          avg_price        end av

  • Hashtable mapping question

    Hello All: I have a hashtable object in my java code thats represented as a jobject in my jni code. I then call GetObjectClass to get the class for this jobject. Finally I call GetMethodID to retrieve the method ID for the put method of the hashtable