Importing .jar files

I have been checking out the forums and I think I am more confused than before. I have a bunch of classes in a .jar file and I want to use them in another app. I haven't changed what my classpath is because it has been so confusing I decided to reinstall the j2sdk. What should I set the classpath too? I have my class and the .jar file that I want to use in C:\Java Stuff\. What import statement do I have to have if the name of my .jar file is MyClasses.jar?
Thank you!

What you're saying is that your directory structure is something like this:
C:\Java Stuff\com\mydomain\myclasses\MyClass.class
C:\Java Stuff\MyJar.jarIf this is the case, you don't have to extract the files from the jar file into the directory. The jar file contains all the files and Java is able to fetch them directly in the jar file.
However, to do this, your class path must include the jar file, and not just it's directory.
So instead of:
CLASSPATH=c:\j2sdk1.4.0_02\bin;c:\Java Stuff;you must have
c:\j2sdk1.4.0_02\bin;c:\Java Stuff\MyJar.jar;Hope it helps!

Similar Messages

  • Import JAR files (integrating JasperReports)

    Dear all,
    I'm using JDeveloper 11.1.1.3.0 on Windows 7 32bit.
    I search this forum and I google a lot, but I couldn't find any workable solution.
    I downloaded the newest version of JasperReport and iReport from the official website. I've done some tutorials from this site and everything seems to work fine.
    Now I want to integrate JDev with JasperReports. I create new Fusion Web Application ADF, I get the properties of Model project, Libraries and Classpath tab, add Library and click New... I set the Library name as JasperReports, location as Project, check Deploy ad Default. I add to Class path every JAR files in E:\JasperReports\jasperreports-3.7.6\lib and to Source path the whole directory E:\JasperReports\jasperreports-3.7.6\src. I get sure that the Export is checked and I save all the changes.
    I create a new Java Class JasperTest and I use this sample code:
    import net.sf.jasperreports.engine.*;
    import net.sf.jasperreports.engine.export.*;
    import java.util.*;
    public class JasperTest {
        public static void main(String[] args) {
            String fileName = "test.jasper";
            String outFileName = "test.pdf";
            HashMap hm = new HashMap();
            try {
                // Fill the report using an empty data source
                JasperPrint print = JasperFillManager.fillReport(fileName, hm, new JREmptyDataSource());
                // Create a PDF exporter
                JRExporter exporter = new JRPdfExporter();
                // Configure the exporter (set output file name and print object)
                exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outFileName);
                exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
                // Export the PDF file
                exporter.exportReport();
            } catch (JRException e) {
                e.printStackTrace();
                System.exit(1);
            } catch (Exception e) {
                e.printStackTrace();
                System.exit(1);
    }I cant compile this, it gives me Error(1,1): package net.sf.jasperreports.engine does not exist etc..
    I cant import any class from JasperReports. Did I something wrong with importing the JAR files to my project ? Maybe I should set some system environment variable ? What else I can do ?
    Any help will be appraciated.
    Regards,
    Wojtek.

    Hi,
    I am also facing the same problem, I have few Jasper Reports which are closely integrated with my APEX applications, but for this i am using another application ( Jasper reports) which deployed in tomcat. This application hardly have 20 lines of java code, so i thought of embedding same in PL/SQL itself, But i am facing problem while importing JAR files i.e.
    1. Where to put these JAR files so that i can import them in my PL/SQL.
    2. I also tried using JAVALOAD function, but that also not worked for me.
    Please give me some solution how to go about it??

  • How to import .jar files in order to use the classes within this file

    hello guys,
    I'm just wondering how can i import .jar files in order to uses the classes within this file.
    let's take an example:
    i have a folder in which I have many .jar files which contain classes to be called. the full path of this folder is set in the Classpath inside the enviroment variables.
    so does anyone have any idea how can i import these .jar files so i can use the classes?
    thank you.

    Hi,
    My problem is that: I created a Serializable class in a project. And I added this project (first project) to another project (second project). First project is appearing in the second project' s Libraries folder. No problem. I want to create a jar file from second project. i.e. I want to Build second project (I use NetBeans IDE). I am using Build Main Project tab under Run. It is falling out. I am finding it second project' s jar file under its folder. I am clicking on it. But it is NOT WORKING. Do you know WHY. Could you help me please?
    Thanks,

  • Interactive Reporting-Importing jar files

    Hello Experts,
    We have Hyperion Interactive reporting 8.3 installed and I am trying to implement user level restrictions to access the Brio reports, using a dashboard section. We already have a table tab_user where the login_id and password are stored. The user supplied values should be compared with that table values. Problem here is, the password is stored in an encrypted format in the database table. So, in brio also I have to encrypt it and do the comparison with the database password or the other way around. For this, can we import jar files (where the password will be encrypted )in Hyperion??
    If yes, please let me know how to achieve that.
    Also please suggest URL’s that has some complex sample dashboards.
    Let me know if anything is not clear.
    Thanks in avance.

    Hi Wayne,
    We don't need the decrypt routine. We have other applications that also follow the same process to encrypt the string and whatever output I am getting it's matching with those applications.
    When I encrypt the string password with key M&T_reee the encrypted string is *894B11B5A398331FA6C58CD301AAE756*
    I was not able to establish an ODBC connection(where I am processing the stored procedure) from the dashboard.
    When I try following set of commands, it's throwing an error "Script(x):uncaught exception: Internal Error"
    ActiveDocument.Sections["Procedure_qry"].DataModel.Connection.Open("C:\\ODBC_SP_DB.oce")
    ActiveDocument.Sections["Procedure_qry"].DataModel.Connection.SetPassword("test")
    ActiveDocument.Sections["Procedure_qry"].DataModel.Connection.Connect()
    When I connect the query manually using the same oce it's working fine, but I couldn't achieve this thru dashboard.Please advice.
    -Thanks

  • Importing .jar file into WSAD512?

    how to import executable jar file into WSAD workspace.
    I am trying to import .jar file,but there is no option to import jar file.
    any help...

    I have never had any trouble importing any kind of a file into a WSAD workspace. The file import function doesn't care what kind of files you import.

  • Adding Libraries & External Library DC - Not able to import JAR Files

    Hi,
    I am trying to import the jar files to development environment.
    The JAR file was added by following the steps mentioned in below blog :
    /people/bala.krishnan2/blog/2006/09/25/bid-adieu-to-bots--using-captchas
    Please find the error log below :
    20100728065650 Info   :connected to deploytool via sdm protocol
    20100728065651 Info   :deploy every archive associated to the buildspace: DP1_MSSTRK19_D
    20100728065651 Info   :getting DC mss/eepro/salarydata from CBS for buildspace: DP1_MSSTRK19_D
    20100728065651 Info   :Following SDAs were added:
    20100728065651 Info   :  201007280456510519_sap.com_SAP_MSS_1_sap.com_msseeprosalarydata.sda
    20100728065651 Info   :archives (201007280456510519_sap.com_SAP_MSS_1_sap.com_msseeprosalarydata.sda) for DC mss/eepro/salarydata were selected
    20100728065652 Info   :Start deployment:
    20100728065652 Info   :The following archives will be deployed (on http://sapdp1ci.zrh.swissre.com:53018)
    20100728065652 Info   :/usr/sap/DP1/SYS/global/TCS/DEPLOYARCHIVES/201007280456510519_sap.com_SAP_MSS_1_sap.com_msseeprosalarydata.sda
    20100728065652 Info   :starting deployment
    20100728065652 Info   :errorhandling rule is switched from OnErrorStop to OnErrorSkipDepending
    20100728065652 Info   :prerequisite errorhandling rule is switched from OnPrerequisiteErrorStop to OnPrerequisiteErrorSkipDepending
    20100728065654 Info   :deployment finished
    20100728065654 Info   :errorhandling rule is reseted
    20100728065654 Info   :prerequisite errorhandling rule is reseted
    20100728065654 Info   :Deploy log:
    20100728065654 Info   :
    20100728065654 Info   :
    20100728065654 Info   :
    20100728065654 Info   :
    20100728065654 Info   :
    20100728065654 Info   :
    20100728065654 Info   :
    20100728065654 Info   :
    20100728065654 Info   :Jul 28, 2010 6:56:52 AM  Info: Start file transfer to /usr/sap/DP1/JC30/SDM/program/temp/201007280456510519_sap.com_SAP_MSS_1_sap.com_msseeprosalarydata.sda
    20100728065654 Info   :Jul 28, 2010 6:56:52 AM  Info: File transfer of /usr/sap/DP1/JC30/SDM/program/temp/201007280456510519_sap.com_SAP_MSS_1_sap.com_msseeprosalarydata.sda finished for 9 ms. Total file size is 1347307 bytes.
    20100728065654 Info   :Jul 28, 2010 6:56:52 AM  Info: The SDM client uses an old SDM client API.
    20100728065654 Info   :Jul 28, 2010 6:56:52 AM  Info: -
    Starting deployment -
    20100728065654 Info   :Jul 28, 2010 6:56:52 AM  Info: Error handling strategy: OnErrorSkipDepending
    20100728065654 Info   :Jul 28, 2010 6:56:52 AM  Info: Prerequisite error handling strategy: OnPrerequisiteErrorSkipDepending
    20100728065654 Info   :Jul 28, 2010 6:56:52 AM  Info: Update strategy: UpdateAllVersions
    20100728065654 Info   :Jul 28, 2010 6:56:52 AM  Info: Starting deployment prerequisites:
    20100728065654 Info   :Jul 28, 2010 6:56:53 AM  Info: Loading selected archives...
    20100728065654 Info   :Jul 28, 2010 6:56:53 AM  Info: Loading archive '/usr/sap/DP1/JC30/SDM/program/temp/201007280456510519_sap.com_SAP_MSS_1_sap.com_msseeprosalarydata.sda'
    20100728065654 Info   :Jul 28, 2010 6:56:54 AM  Info: Selected archives successfully loaded.
    20100728065654 Info   :Jul 28, 2010 6:56:54 AM  Error: Unresolved dependencies found for the following SDAs:
    20100728065654 Info   :
    20100728065654 Info   :1.: development component 'mss/eepro/salarydata'/'sap.com'/'DP1_MSSTRK19_D'/'31236'/'0'
    20100728065654 Info   :dependency:
    20100728065654 Info   :       name:     'temp/jxljar1'
    20100728065654 Info   :     vendor:     'swissre.com'
    20100728065654 Info   :
    20100728065654 Info   :There is no component either in SDM repository or in Deployment batch that resolves the dependency.
    20100728065654 Info   :
    20100728065654 Info   :Deployment will be aborted.
    20100728065654 Info   :Jul 28, 2010 6:56:54 AM  Error: No Software Component Archive (SCA) or Software Delivery Archive (SDA) selected. Select at least one.
    20100728065654 Info   :Deployment will be aborted.
    20100728065654 Info   :Jul 28, 2010 6:56:54 AM  Error: Prerequisites were aborted.
    20100728065654 Info   :Jul 28, 2010 6:56:54 AM  Error: Error while creating deployment actions. No Software Component Archive (SCA) or Software Delivery Archive (SDA) selected. Select at least one.
    20100728065654 Info   :Deployment will be aborted.
    20100728065654 Info   :end of log
    20100728065654 Info   :End deployment:
    20100728065654 Info   :
    20100728065654 Info   :Summary of deployment
    20100728065654 Info   :==> deployment finished for mss/eepro/salarydata (28979) with rc=12
    20100728065654 Info   :deployment finished for buildspace: DP1_MSSTRK19_D
    Please let me know how to fix this issue.
    Thanks in advance.
    Thanks and Regards,
    Rashmi

    Rashmi,
    Following observations from the error log:
    a)  DC temp/jxljar1 is External Library DC; if I am not wrong.
    b) Once the J2EE DC is deployed; automatically jxljar1 should also be loaded in server
    Coming to the issue you are facing; plz let us know following points:
    a) Are you trying to transport the content from one landscape to the other i.e. development to QA?
    b) During what operation and in which unit(DTR/CMS/CBS);you are facing the issue?
    Regards,
    Ganga

  • Imported Jar file not loaded at run time ORA-105100

    Oracle 9iDS forms Version 9.0.2.9.0
    Oracle 9iAS Release 2
    I have imported java classes from a jar file into my form. I have it working in client server. Added the entries to the classpath in the default.env and system environment variable for development of the form and for execution.
    Moved the jar file, form and testing html to the application server. Modified the classpath in the default.env file. Tested the form. Got the ORA-105100 error. MetaLink note 261650.1 states that error frm-40735 When-Button-Pressed triger raised exception ORA-105100 if calling a java function from a jar file. Cause: Jar file not loaded at run time. Solution: add in your default.env CLASSPATH parameter your jar file including the whole directory of the jar file location. That has been done and the OC4J has been restarted. Still get error.
    Oracle support has not been able to give me much help as of yet. Does anyone have any further ideas, or documentation that I can read to help get this working?
    Thanks in advance for any assistance that is offered.

    Hey people any clues?

  • How to import JAR file into a class

    I have a JAR file that i need to use the content of that file in another class. But when i use "import" syntax, the compiler list down the error that the class of the JAR file is not found.
    For example,
    import log4j;
    after compile, the error is "Class log4j is not found in import".
    Please help me. Thank you

    A common misconception of the import statement is that it would actually do something. Well, it doesn't. It is only a mark for the compiler that you would like to use the shorter name for the classes mentioned, instead of the fully qualified one. You could use the name "java.awt.datatransfer.Clipboard" everywhere you wanted to use the Clipboard class, did you "import" that package or not.
    You don't have a class called "log4j" so the compiler complains that it can't find it. Instead, you have classes called org.apache.log4j.* (yes, you can use the * to substitute class names), IIRC. So you could use a import statement with "importorg.apache.log4j.*;" but you don't really have to.
    Just make sure that java will found those classes.
    http://java.sun.com/j2se/1.3/docs/tooldocs/findingclasses.html

  • How do I import Jar files in JSP? (novice)

    Hello,
    I have developed BC4J UIX JSP in JDev9i. Every JSP there is a URI that points to an Oracle website:
    <%@ taglib uri="http://xmlns.oracle.com/uix/ui" prefix="uix" %>.
    This is causing errors for those that are trying to deploy on HP UX. They have asked me to import some .jar files(i.e. uixtags.jar, DataTags.jar, etc) into the pages and omit the above URL. Is this possible. If so can anyone help with how to do this. If it is not, is there a way to point to this website without doing so on the JSP page?
    Thank you in advance
    Rob

    Put the jar files in WEB-INF\lib directory.
    Now you can import the classes in the jar files in your JSP.

  • Help : importing jar files

    i want to access classes in a jar file.. can i import the pakage without needing to extract the class files from the jar file??
    how can u use the jar file in the app that i have made??

    Place the JAR file in your classpath.

  • Problems importing Jar files

    Hi
    I have tried to implement a sample version of jfreechart which is a component for graphing but unfortunatly there is an error with importing some of the libraries i have added all the . jar files to the Class Path and i have opened the .jar file in net beans so i dont know what the problem is
    Problem is with the lines
    import org.jfree.ui.ApplicationFrame;
    import org.jfree.ui.RefineryUtilities;
    It tells me that org/jfree/chart/demo/LineChartDemo1.java [60:1] package org.jfree.ui does not exist
    C:\j2sdk1.4.2_03\lib\jfreechart-0.9.16\jfreechart-0.9.16.jar;
    C:\j2sdk1.4.2_03\lib\jfreechart-0.9.16\lib\jcommon-0.9.1.jar;
    C:\j2sdk1.4.2_03\lib\jfreechart-0.9.16\lib\servlet.jar;C:\j2sdk1.4.2_03\lib\jfreechart-0.9.16\lib\gnujaxp.jar
    Refereence at http://www.jfree.org/jfreechart/index.html

    Check to make sure that the jar files have the above mentioned classes.
    Do a jar -tvf to find the contents of the JAR file.
    Next check your classpath entries again. Also adding these libraries to the JDK lib directory will not automatically add them to the classpath. So check to make sure they are added and if you are using an IDE, check the command line the IDE produces (most IDE's do that) to make sure your classes are there in the -classpath option.
    Vijay

  • Importing jar files for Java mapping ?

    Hi Guys,
    I am developing a java mapping by using Eclipse. I want to know <b>where can i find the jar files of xi which i need to import into Eclipse to develop the Java Mapping</b>.
    I need to use the external jar files for this Java Mapping and once i am done with the mapping, <b>How can import the external .jar files into XI</b>
    any hep would be really appreciated
    Thanks,
    srini

    Sri,
    check <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions's XI FAQ</a> for the location of .jar of mapping API.
    <b>5. Where can I find aii_map_api.jar to create my Java mapping?</b>
    After you have created your java mapping class, export your project to a .jar file and import this .jar into Imported Archives (under Mapping node) in Integration Repository.
    Regards,
    Henrique.

  • Which folder shall I put, when I import Jar file in the Apache?

    Hi,
    I m meeting a problem:
    I need to import javax package in the jsp page, and I copy the relevant Jar file into WEB-INFO/lib folder, but it doesn't work: i execute the page in the IE explorer that is showed "import javax package is not found".
    I don't the reason. Who can help me ? Urgent!
    Thank you
    Andrew

    There is no "javax" package. However, there are quite a few "javax.something" packages. You have to give the whole package name to import it, you can't import a group of packages generically.

  • EPA file import jar file

    Hi all,
      Does someone have the jar file required for importing an EPA file?
    Where can I find the API <b> com.sapportals.portal.transport.ui.*</b>?
    Any help will definitely be rewarded.
    Thanks & Regards,
    M.Subathra

    Hi Subathra,
      Please refer the thread
    <a href="https://www.sdn.sap.com/irj/sdn/thread?threadID=128785">https://www.sdn.sap.com/irj/sdn/thread?threadID=128785</a>
    Same problem is discussed here..
    Hope this helps...
    Regards,
    Sharadha

  • Importing jar files in Sun Java Studio

    Hi
    I am new to java and have recently installed Sun Java Studio Enterprise. As a part of assignment, I have been provided a jar file and use it.
    But i have not been able to load it into my program. How do i load it ?

    Hi
    I am new to java and have recently installed Sun Java Studio Enterprise. As a part of assignment, I have been provided a jar file and use it.
    But i have not been able to load it into my program. How do i load it ?

Maybe you are looking for