Importing a .class file into my package?

Hi. I'm making a java program but I need to use an external .class file to get variables and use methods from. Is it possible to "import" a class file into my package to be able to do so?
Thanks

Basically, for our last project we created a class
that held the information about a year: how many days
were in a month, how many months were in a year, etc.
etc. For this project, we'll be having to use that
same class to make a GUI calendar. Our teacher
provided a class which he compiled for us to use in
our projects incase our previous class had some flaws
in it, which mine did. Unfortunately, it's in .class
format and I don't know how to use it in my package!That's going to be a problem then. I would assume that it is going to have an API like your old one did. Same name and same methods etc. So do you know what the name and method signatures of your class were supposed to be?

Similar Messages

  • Import class file in default package (netbeans) into my jsp

    Hello all I have created a class file in the default package under Source Files in the netbeans 5 ide.
    I am having a problem importing that class file into my jsp(which resides in the Web Pages directory .
    I tried the following:
    <jsp:useBean id="dial" class="Test" scope="session" />
    my class file is Test.java
    Any help or explanation would be greatly appreciated.
    TIA!

    Will not work. Classes have to be defined in a package, the default package just wont do.
    ram.

  • Importing .class file into jsp file

    i am unable to import a .class file into my .jsp file
    please give me the correct method to import and also tell me where to deploy the .class file

    i am unable to import a .class file into my .jsp
    file
    please give me the correct method to import and also
    tell me where to deploy the .class filehttp://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-JSP.html#Section5

  • Importing my class files from another folder

    hello everybody ,im creating a software package for a new company and want to organise my class files into different folders so that it would be easier for someone to navigate through them and update if necessary ,how do i import an instance of a class in a file that is in a subfolder of the folder that contains the class that is calling it.(sorry for being a bit long winded) iv tried diff things and they didn't work.
    At the moment i have all the files in the one folder,but as i said above want to put them into appropriate folders.
    I would be very gratefull if someone could give me some examples and if not some appropriate links,thanks iv tried looking for this on the net but could not find anything.

    What you should probably do is to organise your classes into a heirarchy of packages not merely folders. Java expects the package structure to be reflected in the directory structure holding both the source and class files. If it's looking for a class called, say, com.mycompany.widgets.MainWidget it expects to find it in a directory com//mycompany/widgets relative the the directory on the class path.
    Use the package directive in each source file to indicate the package path.

  • Call java class file into jsp file

    Hello experts,
    I wrote a class file which have validation functions it successfully created a class file of that java file.
    and I puted that class file into tomcat's ../WEB-INF/classes folder.
    And whenever I am going to execute the jsp page it give error like
    "regexFunctions cannot be resolved to a type"
    My class file is like follows,
    import java.util.regex.*;
        public class regexFunctions
        private static int SUCCESS = 0;
        private static int FAILURE = 1;
        private static int MISSING_INFO = -1;
        public static String ALL_STRING_REGEX = "^[a-zA-Z]+$";
        public static String ALL_NUMBER_REGEX = "[0-9]+";
    public static int checkForString(String inputtedValue)
             int retCode = FAILURE;
             if ((inputtedValue != null) && (inputtedValue.length() > 0))
                 Pattern pattern = Pattern.compile(ALL_STRING_REGEX);
                 Matcher matcher = pattern.matcher(inputtedValue);
                 if (matcher.find())
                     retCode = SUCCESS;
             return retCode;
    }My jsp page is like follows,
                <%
                     regexFunctions reg = new regexFunctions();
         String id = request.getParameter("txtId");
         int i = regexFunctions.checkForString(id);
               %>So Please Let Me Help Out...

    Put it into a package. Classes in packages can't access classes with no package, since about 2003.

  • How to access a class file outside the package?

    created a two java files Counter.java and TestCounter.java as shown below:
    public class Counter
         public void print()
              System.out.println("counter");
    package foo;
    public class TestCounter
         public static void main(String args[])
              Counter c = new Counter();
              c.print();
    Both these files are stored under "D:\Test". I first compiled Counter.java and got Counter.class which resides in folder "D:\Test"
    when i compile TestCounter.java i got the following error message:
    D:\Test>javac -classpath "d:\Test" -d "d:\Test" TestCounter.java
    TestCounter.java:6: cannot find symbol
    symbol : class Counter
    location: class foo.TestCounter
    Counter c = new Counter();
    ^
    TestCounter.java:6: cannot find symbol
    symbol : class Counter
    location: class foo.TestCounter
    Counter c = new Counter();
    ^
    2 errors
    what could be the problem. Is it possible to access a class file outside the package?

    ya that's fine..if we have two java files where both resides in the same package works fine or two java files which donot have a package statement also works fine. But my doubt is, i have a Counter.class which does not reside in a package and i have a TestCounter.class which resides in a package "foo", in such a scenario, how do i tell to the compiler that "Counter.class resides in such a path, please look at that and give me TestCounter.class". i cannot use import statement to import Counter.class in TestCounter.java because i donot have a package for Counter.java.

  • How to include class files in no package?

    hi,
    I have a class file in a package called
    pack.Test
    and a class file not in a package called
    Library
    When I try to use Library from within pack.Test, it says theres no such class. I have my classpath setup correctly, and the files in the correct directories.
    ie. on windows if %DIR% is the base directory then
    %DIR%\Library.java
    %DIR%\pack\Test.java
    is how they are layed out.
    Is there a way to get Library imported to pack.Test?
    thanks,
    asjf

    What?!! It isn't considered legal to access a
    root-level class from a higher level package?Well it's not now because your code won't compile, but
    prior to 1.4 you could. I think the JLS has been
    updated to say you can't import from the unnamed
    namespace.Hmm! I must have missed that bit (not that I read it in any great detail, anyway!). I suppose it forces you to use packages, which is a good thing, IMHO.
    What I was wondering about was, is the directory structure of classes strictly necessary, given that a class contains information on its package anyway? I know some IDEs don't require the source files to be in the right directory - they will check on the package statement, and locate the class file accordingly - but is it absolutely necessary for class files to be located according to their directory structure? I know the JLS says they have to be, but could the JLS be relaxed on this point, without breaking anything?
    RObin

  • How to import an .csv file into the database?

    and can we code the program in JSP to import the.csv file into the database.

    It is better to use Java class to read the CSV file and store the contents in the database.
    You can use JSP to upload the CSV file to the server if you want, but don't use it to perform database operations.
    JSPs are good for displaying information on the front-end, and for displaying HTML forms, there are other technologies more suitable for the middle layer, back end and the database layer.
    So break you application into
    1) Front end - JSPs to display input html forms and to display data retrieved from the database.
    2) Middle layer - Servlets and JavaBeans to interact with JSPs. The code that reads the CSV file to parse it's contents should be a Java Class in the middle layer. It makes use of Java File I/O
    3) Database layer - Connects to the database using JDBC (Java Database Connectivity), and then writes to the database with SQL insert statements.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Keeping the above concepts in mind, first build a simple JSP and get it to work,
    then research on Google , for Java File I/O , discover how to read a file,
    Then search on how to readh a CSV file using Java.
    After researching you should be able to read the CSV file line by line and store each line inside a Collection.
    Then research on Google, on how to write to the database using JDBC
    Write a simple program that inserts something to a dummy table in the database.
    Then, read the data stored in the Collection, and write insert statements for each records in the collection.

  • How to import jar & exp file into the eclipse 3.1 + jcop

    hi, I am new to the javacard technology.
    I have implementing applet by using eclipse 3.1 + jcop plugin.
    recentlly, i got jar and exp file from someone. and I have to import given two files in the my applet.
    Q1. but i don't know how to use(import) two files into the elipse.
    and...
    I have tried to put the export file structure in the build path, but I am still getting the same error:
    Q2. "resolving constant-pool of clazz cash/ccash; failed: no such clazz cash/ccash;", what means?
    anyone help me~plz!
    many thanks..
    lsh.
    Message was edited by:
    neonoble

    1) In the Package explorer right-click the project you want to import the jar files into.
    2) Click import
    3) Select Archive file in the Import dialog box and click next
    4) Browse to the jar file and select it
    Socx

  • Is there a way to import a .csv file into Numbers?

    Can I import a .csv file into Numbers?

    Yes, you can import csv (character-separated-values) into Numbers.
    If the csv file is comma-separated, then in Numbers you can try File > Open and navigate to the file and open it.
    If you don't get the results you want, then try this CSV to Tabs on Clipboard Automator Service (Dropbox download) instead.
    To install, double-click the .workflow package and, if necessary, click 'Open Anyway' in System Preferences > Security & Privacy.
    Thereafter to use:
    In Finder (not Numbers) navigate to the .csv file.
    Right-click on the file and choose 'CSV to Tabs on Clipboard' under Services in the contextual menu.
    Follow the prompts (trying different separators if needed).
    Click once in a Numbers cell.
    Command-v to paste.  The Numbers table will expand automatically as needed.
    These steps are quicker and easier than they sound. Just a few clicks and a keyboard entry.
    SG

  • Bizarre problem trying to import .MTS (AVCHD) files into PSE7 Organizer

    Hi
    b Summary of problem:
    *I recently upgraded to PSE 7 / PRE 7
    *I am trying to import .MTS (AVCHD) files into the PSE7 Organizer
    *I get a "...did not contain any supported file types..." error on attempted import
    b HOWEVER...
    *I can edit same footage in PRE7
    *This footage is automatically added to the Organizer
    *I can play this footage in the PSE7 organizer but generating thumbnails takes ages
    *Camera: Sony HDR SR12 producing .MTS files (full 1920x1080i HD)
    *PC: Intel Core i7 940 CPU, 6GB RAM, RADEON HD 4870 512MB
    *OS: Vista 64 bit
    b Detail:
    I have recently upgraded my PRE/PSE bundle to ver 7 primarily because the new version of PRE boasts support for AVCHD.
    Having installed the new software I quickly tried editing footage in PRE7 with video taken on my Sony HDR SR12 camera (footage taken in full 1920x1080i HD) and it works! Hoorah! I can now finally edit AVCHD footage in it's native format using PRE. Thank you Adobe!
    But my joy was very shortlived because when I tried to import some other footage from the same batch into my PSE7 Video Catalog it wouldn't work. I got a pop up box containing the following error:
    i "Nothing was imported. The file(s) or folder(s) selected to import did not contain any supported file types, or the files are already in the catalog."
    Under this message is a list of the files that I tried to import. Next to each one there is a reason (it's the same reason for each clip):
    i "Reason: The file is damaged or is a format that cannot be included in the Organizer."
    To import files I use the following method: File / Get Photos and Videos / From Files and Folders
    HOWEVER, the files that I imported directly into PRE7 in order to edit them have (surprise, surprise!) automatically been added PSE7 Organizer's Catalog. It takes a quite a while to generate a thumbnail for each clip but it does eventually do it and when it does I can play that footage in PSE7.
    Just in case you're confused by this stage... If I try and manually add files to the PSE7 Organizer it doesn't work BUT if I edit that footage in PRE7 and then load the PSE7 Organizer I see the footage has been automatically added. This makes no sense whatsoever!
    Am I doing something really stupid here? Why oh why will the PSE7 Organizer not import .MTS (AVCHD) files?!
    NB: While searching for a solution to this problem I have, thanks to this Forum, found out about the K-Lite Codec Pack. I downloaded and installed the Basic pack v4.4.5 and now I can, at least, play my .MTS video files in Windows Media Player... I wish I had found out about that a couple of months ago because it would have saved me from buying Cyberlink PowerDVD 8!
    Please someone help before I lose the plot.
    Thanks
    Patrick
    b PC: Intel Core i7 940 CPU, 6GB RAM, RADEON HD 4870 512MB, Vista 64 bit
    b Camera: Sony HDR SR12 producing .MTS files (footage in full 1920x1080i HD)

    Hi
    I'd just like to add an update to this post.
    b Summary:
    *K-Lite Codec Pack clashes with Sony's Picture Motion Browser (PMB) software
    *Analysis of video in Sony's PMB is well worth doing!
    *You can Drag and Drop clips from Sony's PMB into PRE7
    b Detail:
    As you've probably gathered I have now settled on using Sony's Picture Motion Browser (PMB) to Catalog all my video. Sorry Adobe to talk about someone elses product but the Adobe Organizer just can't cope with AVCHD footage no matter how you manage to import it! It's far too sluggish and my PC has an Intel Core i7 940 CPU with 6GB RAM and a 10,000 RPM HDD!
    Anyway, in my first post you'll have read me raving about the K-Lite Codec Pack but sadly I've had to uninstall it because it kept on causing PMB to crash. PMB runs much smoother and quicker WITHOUT that codec pack. Something about it clashed with PMB. The once agile PMB became sluggish and unresponsive.
    Having now removed the codec pack PMB is back to being agile and generaly lovely.
    To view AVCHD footage outside of PMB I have reverted to using Cyberlink's PowerDVD 8 - there's always a pregnant pause between double-clicking on the clip and it playing but that's the only drawback.
    If you are going to use Sony's PMB for cataloging your video collection (and I recommend you do so BUT only if you have AVCHD footage - otherwise stick to Adobe's Organiser) then I can fully recommend "Analyzing" all of your footage. This takes time and a bit of patience because it kept stopping for no apparent reason but would readily start up again (without having to do anything else) BUT once it's done it'll reward you with the following:
    *Filter on any combination of Scenery, People, Smiles - e.g. with a click of a button you can isolate footage that contains smiles, etc
    *Face Search - if you select some or all of the footage in the right-hand pane it will then put a small thumbnail for all of the different faces in that selected footage in the bottom "Face Search" pane. If you then click on one of those thumbnails it will jump to the clip(s) that contain that face and grey out all the other clips
    *Expand Videos - This tool is brilliant! In normal viewing mode you get a thumbnail of the video whether you're in Folder view, Calender view or Detail List view. If, however, you select "Expand Videos" from the tool bar it will show you a series of frames contained within that clip. You can choose from "Highlights" or various regular intervals (5 secs, 10 sec, 30 sec, 1 min, etc). The Highlights option does a pretty good job of picking out the significant changes within the clip
    Lastly, I have discovered that you can drag a clip from Sony's PMB into PRE7. It won't let you put it directly onto the Timeline but it will let you drop it into the Project file list (found under the Edit tab).
    I do hope that this info has helped others like me who are trying to get to grips with editing and cataloging AVCHD footage.
    Patrick

  • How to convert a .class file into .java file without .jad using DeJDecompil

    Hi all,
    I am using DeJDecompiler and working with swing applications.If I try to convert a .class file into .java file,it is converting into .jad file only.Fine but if I try to save that file into .java file,It is giving lot of errors in that program.When I went into that program the total style of the program is changed and TRY-CATCH block is not recognised by the dejdecompiler,hence If I try to include some methods in the existing .java file thus got,I could not do.Kindly help me.
    If I get the .java file without error then I can process the rest of the functionality.
    Thanks in advance
    With kind Regs
    Satheesh.K

    Not so urgent today then!
    http://forum.java.sun.com/thread.jsp?thread=553576&forum=31&message=2709757
    I'm still not going to help you to steal someone�s code.

  • Conversion of a .jar OR a .class file into a .exe  file

    Can anyone tell me as how to convert a .jar OR a .class file into a .exe file
    I need to know as soon as possible.

    Okay I will tell you the steps:
    Look in the top right hand corner of the page.
    There should be a box with a red title line. Inside the
    title should be the letters 'S E A R C and H'.
    In the white part of th box should be a smaller line, in which you can type.
    type in "conversion .jar .class .exe" or some similar string.
    Then click on the button next to the text box.
    Read the page of results you get.
    Click on the first link and read what is said on the connecting page.
    If that doesn't help, use your browser's back button and click on the next link, and repeat util your question is answered.

  • How do I import one xml file into 3 separate tables in db?

    I need to utilize xslt to import one xml file into 3 separate tables: account, accountAddress, streetAddress
    *Notice the missing values in middleName, accountType
    sample xml
    <account>
    <firstName>Joe</firstName>
    <middleName></middleName>
    <lastName>Torre</lastName>
    <accountAddress>
    <streetAddress>
    <addressLine>myAddressLine1</addressLine>
    <addressLine>myAddressLine2</addressLine>
    </streetAddress>
    <city>myCity</city>
    <state>myState</state>
    <postalCode>mypostalCode</postalCode>
    </accountAddress>
    <accountId>A001</accountId>
    <accountType></accountType>
    <account>
    I need the following 3 results in 3 separate xml files in order for me to upload into my 3 tables.
    Result #1
    <rowset>
    <row>
    <firstName>Joe</firstName>
    <lastName>Torre</lastName>
    <accountId>A001</accountId>
    <row>
    <rowset>
    Result #2
    <rowset>
    <row>
    <addressId>1</address>
    <city>myCity</city>
    <state>myState</state>
    <postalCode>myPostalCode</postalCode>
    <row>
    <rowset>
    Result #3
    <rowset>
    <row>
    <addressId>1</addressId>
    <addressLineSeq>1</addressLineSeq>
    <addressLine>myAddressLine1</addressLine>
    <row>
    <row>
    <addressId>1</addressId>
    <addressLineSeq>2</addressLineSeq>
    <addressLine>myAddressLine2</addressLine>
    <row>
    <rowset>

    Use XSU to store in multiple tables.
    "XSU can only store data in a single table. You can store XML across tables, however, by using the Oracle XSLT processor to transform a document into multiple documents and inserting them separately. You can also define views over multiple tables and perform insertions into the views. If a view is non-updatable (because of complex joins), then you can use INSTEAD OF triggers over the views to perform the inserts."
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14252/adx_j_xsu.htm#i1007013

  • I can't import my iTunes files into pages, how can i fix the privileges problem?

    when i try to import any mp3 file into a pages document, i get an access privileges error saying it is either corrupt, damaged or "can't be used" because I don't have access privileges. This has happened since I moved my iTunes library to an external drive.  Anyone have any solutions?  The privileges on both the library folder, and all its files are set to read and write for sharing and permissions.

    If you do not have done so, set the "Ignore Ownership" flag on the external drive. YOu can set this flag from the "File > Get Info" panel for the drive.
    How is your external drive formatted?
    Can other applications open these mp3 files? QuickTime? Do they play in the Finder preview?
    Do the filenames contain special charcters?
    Léonie

Maybe you are looking for

  • Elements 8 on Windows 8.1: Backup throws Error

    My trusted Photoshop Elements 8 and Elements Organizer with a catalog of 38,566 photos lives on a Windows 8.1 machine, all updates current. When trying to make a full backup to an external hard disk, it writes 65,426 files before throwing a simple er

  • Is it possible to view external hardrive space in GB instead of TB

    Hi, Is there a way of checking external harddrive space in GB instead of TB ? Finder says "1.6TB available" on the bottom bar. Is there a preference when changed could make it say "1600GB available" ? Thanks !

  • Photoshop and Illustrator CS6 updates fail

    I have subscibed to Creative Cloud and the uodater tells me I have updates to apply to Photoshop and Illustrator CS6. I would like to have these updates as there is no guarantee I shall be able to afford the CC subscription forever. However every tim

  • Code snippet for JAXM

    Plz Guide me how can i use JAXM API for mailing that too with an attachment. Do i have to install SAAJ for the above. I f any Code snippet is available for it then plz send it to me . soi that i can refer to it. Thanks and regards Kumar Anupam

  • Delta documentation for SEM BCS/CPM 6.0

    Hi Team, Please let me know the link or document for SEM 6.0 delta changes compared to SEM 4.0 In BCS componet and CPM component. Regards Naveen.KV