Importing classes/jar files

Hi
im writing a simple mail program but i need to import classes or jar files
import com.oreilly.servlet.MailMessage;
is the line i have but i cant find the jar file/class
when i search for it i only get the description
where can i find tha actual jar file or package ???

you must to have the jar file from you want import classes if you don't have this jar you can't do this.
if you've the jar, you must indicate to your IDE environment where can find this jar file I don't know meybe in the common menu options > Project settings...
or if you're working with webserver (or stand alone)as Tomcat you need copy jar into /lib folder.

Similar Messages

  • Don't know how to make my main class import a jar file

    OK, the title doesn't make much sense but here are my create-jar.bat and manifest files:
    create-jar.bat:
    jar cvmf manifest.txt dassimul-admin.jar player/ admin/ com/ connector/ common/ *.class
    manifest.txt:
    Main-Class: admin.DASAdmin
    the problem is that in connector/ folder there is the jdbc mysql connector driver (.jar file).
    in Eclipse I can add this jar to the Java Build Path, so the program runs.
    When I double-click the dassimul-admin.jar file, I get a Class Not Found Exception
    C:\MYWORK\dassimul>java -jar dassimul-admin.jar
    FATAL ERROR WHILE LOADING SQL DRIVER: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    I think that the problem lies in the fact that admin.DASAdmin can't see and import the jar file in connector/ folder... am I right?

    It looks like you are putting the mysql jar file inside the dassimul jar. That won't work unless you write custom code. You should use the Class-Path attribute of the manifest to define a relative path(s) to the other jar(s) that you need to use.
    [http://java.sun.com/docs/books/tutorial/deployment/jar/index.html]

  • How to import a jar file in JSP

    How to import a Jar file in JSP Page.
    please reply its very urgent!

    Hey I am facing a similar problem:
    I have this jar file lbswebservice.jar that I have to use for my application.
    I added it to the classpath, I copied it in my WEB-INF/lib folder, but when I try to access classes in this package, it doesnt work.
    For example the jar contains the package com.blipsystems.lbs.ws.messages.* ; that contains different classes, like the Campaign class.
    I tried to use this class (just to create an object) in different context (through jsp, or just through java test classes), but it never works, i get the error: com.blipsystems.lbs.ws.messages.Campaign cannot be resolved to a type
    I am a bit desperate here...

  • How to import external jar file

    i am using bcprov-jdk14-124.jar file for my project. i can import this jar file through eclipse project properties but this is not worklng when i create jar file for my project. This is worked in eclipse only. i want to use that jar file in my project current path. so any body help me how to import this jar file? ( i am using mac os to develop java project )

    You need to specify the classpath when you execute it outside of Eclipse.
    Kaj

  • Import the jar file of jfreereport to bluej

    i'm having trouble importing the jar file needed to use the jfreereport in bluej.
    as much as possible i don't want to type the SET CLASSPATH in the command window. is there a way to include the jfreereport jar file to be used in the bluej?

    You're doing privileged operations almost everywhere in this applet so you can't use the straightforward calls. At a minimum you need to put your applet in a jar, sign the jar and use AccessController.doPrivileged() to wrap the code which does the privileged operations, which is basically all of your code. In other words, you would need one to wrap your code in init(), one in start(), one in actionPerformed(), etc.

  • Artifact harvest failed due to: Unexpected error import: Invalid jar file

    Hi,
    i am trying to submit the .biz and .proxy file to OER using Eclipse,
    but i am getting the following error,
    can anybody help me on it,
    what i am missing ?
    8332 [Main Thread] INFO com.bea.alsb.harvester.plugin.reader.OSBReader - OSB Config Jar Import / Validation starting.
    <Mar 13, 2012 10:28:16 AM IST> <Warning> <ConfigFwk> <BEA-000000> <Setting transaction '6' as rollback only. Rollback reason:
    java.io.IOException: Invalid jar file
    at com.bea.wli.config.importexport.ConfigJar$LogicalJarForm.<init>(ConfigJar.java:1341)
    at com.bea.wli.config.task.impl.UploadJarTask._execute(UploadJarTask.java:46)
    at com.bea.wli.config.task.impl.SessionedTask$1.execute(SessionedTask.java:233)
    at com.bea.wli.config.transaction.TransactionalTask._doExecute(TransactionalTask.java:217)
    at com.bea.wli.config.transaction.TransactionalTask._doExecuteWithRetry(TransactionalTask.java:162)
    at com.bea.wli.config.transaction.TransactionalTask.doExecute(TransactionalTask.java:142)
    at com.bea.wli.config.task.impl.SessionedTask.doExecute(SessionedTask.java:236)
    at com.bea.wli.config.task.impl.SessionedTask.doExecute(SessionedTask.java:191)
    at com.bea.wli.config.task.impl.UploadJarTask.uploadJar(UploadJarTask.java:36)
    at com.bea.wli.config.mbeans.Config.uploadJarFile(Config.java:442)
    at com.bea.alsb.harvester.utils.ConfigJarUtils.importConfigJar(ConfigJarUtils.java:79)
    at com.bea.alsb.harvester.plugin.reader.OSBReader.readQuery(OSBReader.java:196)
    at com.bea.alsb.harvester.plugin.reader.OSBReader.readQueries(OSBReader.java:112)
    at com.bea.alsb.harvester.plugin.reader.OSBReader.read(OSBReader.java:87)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.flashline.util.classloader.ContextClassLoaderHandler.invoke(ContextClassLoaderHandler.java:39)
    at $Proxy0.read(Unknown Source)
    at com.oracle.oer.sync.framework.MetadataManager.start(MetadataManager.java:630)
    at com.oracle.oer.sync.framework.Introspector.<init>(Introspector.java:204)
    at com.oracle.oer.sync.framework.Introspector.main(Introspector.java:430)
    8426 [Main Thread] ERROR com.oracle.oer.sync.framework.MetadataManager - Artifact harvest failed due to: Unexpected error import: Invalid jar file
    com.oracle.oer.sync.framework.MetadataIntrospectionException: Unexpected error import: Invalid jar file
    at com.bea.alsb.harvester.utils.ConfigJarUtils.importConfigJar(ConfigJarUtils.java:97)
    at com.bea.alsb.harvester.plugin.reader.OSBReader.readQuery(OSBReader.java:194)
    at com.bea.alsb.harvester.plugin.reader.OSBReader.readQueries(OSBReader.java:112)
    at com.bea.alsb.harvester.plugin.reader.OSBReader.read(OSBReader.java:87)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.flashline.util.classloader.ContextClassLoaderHandler.invoke(ContextClassLoaderHandler.java:39)
    at $Proxy0.read(Unknown Source)
    at com.oracle.oer.sync.framework.MetadataManager.start(MetadataManager.java:630)
    at com.oracle.oer.sync.framework.Introspector.<init>(Introspector.java:204)
    at com.oracle.oer.sync.framework.Introspector.main(Introspector.java:430)
    Caused by: java.io.IOException: Invalid jar file
    at com.bea.wli.config.importexport.ConfigJar$LogicalJarForm.<init>(ConfigJar.java:1341)
    at com.bea.wli.config.task.impl.UploadJarTask._execute(UploadJarTask.java:46)
    at com.bea.wli.config.task.impl.SessionedTask$1.execute(SessionedTask.java:233)
    at com.bea.wli.config.transaction.TransactionalTask._doExecute(TransactionalTask.java:217)
    at com.bea.wli.config.transaction.TransactionalTask._doExecuteWithRetry(TransactionalTask.java:162)
    at com.bea.wli.config.transaction.TransactionalTask.doExecute(TransactionalTask.java:142)
    at com.bea.wli.config.task.impl.SessionedTask.doExecute(SessionedTask.java:236)
    at com.bea.wli.config.task.impl.SessionedTask.doExecute(SessionedTask.java:191)
    at com.bea.wli.config.task.impl.UploadJarTask.uploadJar(UploadJarTask.java:36)
    at com.bea.wli.config.mbeans.Config.uploadJarFile(Config.java:442)
    at com.bea.alsb.harvester.utils.ConfigJarUtils.importConfigJar(ConfigJarUtils.java:79)
    at com.bea.alsb.harvester.plugin.reader.OSBReader.readQuery(OSBReader.java:196)
    ... 11 more
    Please help...
    Regards,
    yogesh

    Hi Yogesh - when you say "i don't think the file is corrupt, because it works fine in eclipse", do you mean, you are actually able to publish them to a server and test those out?
    Dont know your exact scenario, but when you say that you took the sbconfig from another machine and used it on your local system, cant we just go ahead with that? I mean, clean up your code base, and then import this latest "working" sbconfig and start afresh?
    -Swagat

  • How to create package and import from jar file?

    Hi all,
    I am writing a software and I am not sure how to create a package for the classes.
    Say I have two classes in the same directory as follows:
    testA.java
    ==========
    package AB;
    public class testA
    public static void main(String[] args){
         testB myB = new testB();
         System.out.println("A test");
    testB.java
    ===========
    package AB;
    public class testB
    public testB(){
         System.out.println("B constructor");
    both file compile without the package heading;
    both file compile using: javac -classpath .\ *.java
    Question 1:
    I cannot run testA by: java -classpath .\ testA
    I think it is a syntax error. What is the correct one?
    If I run testA by: java testA
    The only output I get is: A test
    But I am expecting: B constructor /n A test
    What went wrong?
    Question 2:
    I need to use APIs of another software. I have downloaded a .jar file (xxx.jar) with all the classes in it. And I have put "import xxx.*;" in my source file. But the compiler complains about the importing. What is the right way to copmile it?
    I have read a couple of tutorials but they don't answer my question.
    (I am using windows2000 and don't have the classpath variable.)
    Hope some one can help.
    Thanks a lot

    Try moving testA out of the package and importing 'AB.*;'
    If you have:
    ./testA.class
    ./AB/testb.class
    Then to execute testA from ./ type: java -cp . testA

  • Importing the jar files

    import com.sapportals.portal.prt.service.jco.IJCOClientPoolEntry;
    import com.sapportals.portal.prt.service.jco.IJCOClientService;
    i am getting errors while adding these lines , can u suggest me what are the external jar files and the API files we need to upload. to resolve this error .
    thanks in advance.

    \usr\sap\F48\JC30\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.portal.runtime.application.jcoclient\lib
    Get it from here and add it to your classpath by selecting it in Add External Jars.
    For future reference install Class Locator.
    Hope it helped.

  • How do i run a class which has too many dependencies/class/jar file

    i am very new in java environment, i have developed a class which has to many jar file, it works fun when i run it from ide but problem arise which i wanna run it from command promt like
    java classname
    here is my code
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.util.HashMap;
    import java.util.Map;
    import net.sf.jasperreports.engine.JRException;
    import net.sf.jasperreports.engine.xml.JRXmlLoader;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperExportManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;
    import net.sf.jasperreports.engine.design.JasperDesign;
    import net.sf.jasperreports.view.JasperViewer;
    public class ReportViewer {
         public static void main(String[] args) {
              try {
                   JasperDesign jasperDesign = JRXmlLoader.load("EmpDeptReport.xml");
                   JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
                   Map parameters = new HashMap();
                   parameters.put("Title", "JasperReport");
                   Connection conn = Database.getConnection();
                   JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
                             parameters, conn);
                   JasperExportManager.exportReportToPdfFile(jasperPrint, "Sebl_Statement.pdf");
                   JasperViewer.viewReport(jasperPrint);
              } catch (JRException e) {
                   e.printStackTrace();
              } catch (SQLException e) {
                   e.printStackTrace();
    so expert people , please help a novice people.
    [code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    If you place all of your extra .jar files into a "lib" folder in same folder as your jar file then you can call the java class easily using a script similar to.....
    #--------- runJava.bat file to call java program --------------------
    cp=.
    for f in lib/*.jar; do cp=$cp:$f; done
    java -cp $cp:PROGRAM_JAR_FILE.jar com.myclass.mainclass
    #--------- end script -------------
    This loops over the *.jar files in the lib folder and adds them to the classpath. Please note that ":" is used as a cp seperator since this script was run on linux.
    hth,
    Robin

  • Weblogic Classes / Jar files

    Is there place that list the classes for a particular weblogic jar file? Right now a developer asked me what .jar file does this class, weblogic.logging.NonCatalogLogger, live in. The only way I know how to find out is to unjar each jar file until I find it. Is there an easier way?
    Thanks.

    you can use jarscan tool
    http://it.cybergav.in/2009/09/30/scanning-jars-with-jarscan/

  • To import a .jar file in NWDS 7.0

    Hi All,
    I have to establish connection between NWDS 7.0 and MDM . Therefore, I want some .jar files to be used in my application.
    But, I am unable to include them.
    Have tried a lot of threads but still am unable to include them.
    Please help me.
    Thanks and regards,
    Shubham Narayan Gupta

    Dear Shubham,
    You need to create external library dc to includes external .jar file.
    Please refer to below documents :
    How to use external libraries in the SAP component model (PART I)
    How to use external libraries in the SAP component model (PART II)
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/006a6229-b1ed-2e10-0c8c-cc5673cf268f
    Best Regards
    Arun Jaiswal

  • J2SE 1.4 cannot import from JAR files

    Windows 2000
    J2SE 1.4.0
    Textpad (IDE)
    Everytime I attempt to use a package from a JAR file, I get a "package _name_ does not exist" during compilation. If I un-jar the package, then the compilation runs normally.
    I am putting the JAR files in c:\program files\j2sdk1.4.0\lib and my classpath is set to .;c:\program files\j2sdk1.4.0\lib. I don't think its a classpath problem though, because it only occurs with JAR files.
    Textpad performs the following command to compile: javac filename. Manually compiling does not help, nor does using the -classpath option.
    It is as if javac is not looking in the JAR files, and like I said if I un-jar the package, everything compiles normally. This has been driving me crazy for a couple of months now, and I would really appreciate any hints anyone can give me as to what might be causing this.
    Thanks,
    Jeremy Figgins

    I just decided to check if it was possibly a bad installation; the problem occurs on my other Win2k machine as well, so that precludes that possibility. The directory structure on the other machine is slightly different as reflected by its CLASSPATH:
    .;C:\Program Files\java\lib
    Thanks,
    Jeremy Figgins

  • How to import a *.jar file with Jbuilder ?

    Hi,
    I just begin to use Jbuilder and when I use a sample with this line in the program:
    import com.borland.dbswing.*;
    The debugger find an error. In fact it cannot find com.borland....*;
    Do you know what to import how to find it and where to do it with Jbuilder
    Thanks, I am really lost

    JBuilder has this rather patronising notion of "libraries" - taking classpaths to a whole new level of idiocy!
    In "project properties" there should be a tab called "required libraries". I've no idea which library the package you want is in - have a look at the libraries that JBuilder comes with - it might be obvious.

  • 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,

  • 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??

Maybe you are looking for