Importing class from different directory

Hi, Can anyone tell me how to import a class from a different directory? I have a DGenerator class in ./generator directory.
I have tried Import generator.DGenerator; to use the DGenerator class. However. I got the error:
cannot access generator.DGenerator
bad class file: ./generator/DGenerator.class
class file contains wrong class: DGenerator
Please remove or make sure it appears in the correct subdirectory of the classpath.
Help please.
Thank you!

I don't understand why this is a Swing question, but at any rate if you want your DGenerator class to be found in a particular directory, you must do one of two things:
1. Put that directory in your classpath and just refer to the class as DGenerator.
2. Make the class belong to the package "generator".

Similar Messages

  • Running a java application from different directory

    I have the file in my
    c:/Folder/Program.java
    I want to compile and run it from D:/ (drive)i.e from different directory.
    Thanks in advance,
    Praveen.

    javac -cp c:\Folder c:\Folder\Program.java
    java -cp c:\Folder Program

  • Importing classes from Jar files..?

    I've run into a problem that I am having some difficulty solving. I currently trying to port a two part Java UI project from Solaris to Windows. The first is a package of core classes out of which I (successfully) create a jar file. The second is a product-specific package that imports the core classes from the package created in the first. The problem is that the second package fails to build because javac says the package from part one does not exist. Here's what I know:
    - This UI (built via a Makefile) builds successfully under Solaris
    - The jar file that I created in the first part exists in the appropriate directory.
    - When I view the contents of that jar it appears as though everything is there.
    - The jar file is appropriately included in the classpath of the second build.
    Any suggestions you could provide, or resources you could point me to would be greatly appreciated

    jh.jar is a static, 3rd party component. Doesn't seem to be giving me any grief, at least not yet.
    Correct on your second point.
    This is interesting. When I open my "CoreConsole.jar"
    file, I DO NOT see any reference to the
    com.emc.avalon.core.server package, only a list of
    class files that make up that package. You should see the .class files on the left and the relative path on the right.
    Also, all of the class file listings have absolute paths according
    to the location on my machine they were built, for example:
    m:/xpe/CoreConsole/classes/com/emc/avalon/core/server/MessageLogUtility.class
    Is this a problem..?Yes, that should be a relative path, with the first entry being the first name in the package statement. So you should see an entry MessageLogUtility.class, and the path should be com.emc.avalong.core.server.
    If you can't see the class that's missing, that would explain why the class loader can't find it, either.

  • Can't import class from SWC

    I have created a swc file.  I can import most of the classes from it in my project, no problem.  One class, though, simply won't import.  I've tried copying the swc directly into the project, referring to the source folder of it, etc.  No dice.  The swc builds just fine so there's no error in the class.  The first few lines of the class look like this:
    package com.thismoment
        import flash.events.Event;
        public class TakeEvent extends Event    {
    I should be able to do import com.thismoment.TakeEvent; right?  It doesn't work.  I keep getting "1046: Type was not found or was not a compile-time constant: TakeEvent."
    How do I find out what's going on?  Is there a way to dump out all the classes in a swc?

    Jason San Jose wrote:
    In package explorer you can expand the SWC under the "Referenced Libraries" node. That will show you the classes in the SWC (except any that or overridden by other SWCs in the library path).
    A few more things to check:
    - Is build automatically on? Try cleaning the library project?
    - Is the class selected in the project properties > flex library build path > classes tab?
    Jason San Jose
    Software Engineer, Flash Builder
    What is "package explorer"?  I can't find a reference to it in the documentation.  I'm using Flex Builder 3 on Mac OS X if it matters.
    Build automatically is on.  I've cleaned every project multiple times.
    I don't have a Flex Library Build Path -> Classes tab.  I have a "Flex Build Path" entry in Project Properties, and on the Library Path it shows my library added to Build path libraries, link type: merged into code.

  • Running  sql scripts from different directory

    Hi
    I have sql scripts in different directories as follows:
    D:\myapp\sql
    - load.sql
    - init.sql
    D:\myapp\sql\schema
    -users.sql
    -structure.sql
    D:\myapp\sql\populate\
    - data1.sql
    - data2/sql
    load.sql call all the other scripts as below:
    @init.sql
    @schema\users.sql
    @schema\structure.sql
    @populate\data1.sql
    @populate\data2.sql
    All my scripts run correctly when I run load.sql from D:\myapp\sql on comand prompt.
    I need a way to run this script from a different directory say D:\ or C:\
    I am writing a installer which will execute from a different directory.
    Right now I get a file not found error for scripts within schema an populate folder.
    Please let me know how can I make this work from a different directory.
    Thanks
    kelvin

    Hi peter. i think you cannot run files spread across different locations.
    --the method which u specified always looks to the defined path                                                                                                                                                                                                                                                                                       

  • Import data from different Excel sheets to different tables

    I have an Excel file which has different sheets(S1,S2,S3) .The columns in the sheet are different. I want to import the data from different sheets to different tables(T1,T2,T3).
    S1 ---> T1
    S2 ---> T2
    S3 ---> T3
    I want only one Excel data source in my SSIS package.

    You need to have different DFT flows for that as the metadata is different. You need to map each sheets to corresponding destination tables and then it would work fine
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Keeping the album songs order, when importing songs from different sources

    Hello
    I imported lots of songs into my itunes library from various sources (itunes store, CD's, and audio files converted from my vinyl records) This way, songs from a specific artist, and sometimes from a specific album, could come from different sources.
    Now, I hope to arrange all the songs from a specific album to appear in the appropriate order, but I just can't find a way of doing this! The songs just appear in the way iTunes sorts them, without any relation to the original order of the album. Even more, in the iPod itself, the order changes once again with no appearant reason! (Interestingly enough, when I import all the songs of a specific album from one source, the order is kept)
    I tried changing the names on the files in itunes to include serial numbers (01, 02 and so on, at the names of the songs). but then again, for some reason, no order is kept.
    How can I sort the songs in the album according to the proper order? I don't want to use a special playlist for each album.
    Thank you in advance for your replies
    Zak.
      Windows XP  
      Windows XP  

    iTunes sorts things in thew following way (based on having the correct ID3 tag info)
    Album > Disc number > Track Number
    if you sort things by Album
    iTunes does NOT take anything from the file name unless no ID3 tag info is present in the file, then you will see the file name appear as the track name and all other fields blank. ID3 tags are the way most meta-data is handled noawadays.
    Hope that helps.

  • How do I import songs from different computers with home sharing?

    I am trying to share music from my Macbook Pro to my father's Mac Desktop. I was able to get the 'home sharing' to work; I can see and play my father's music and he is able to play mine too. I was trying to import the songs but I am not able to copy & paste and I do not see an 'import' button at the bottom right of our windows when selecting songs. Am I missing a step or is there something else I do not know?

    After researching through the forums, I figured it out. You have to make sure you are logged in under the same account on both computers. At first I was logged under my account on my computer and logged in under my father's account on my father's computer. You have to choose one account to log in under on both computers and then you will be abler to import songs from both computers. If you do not log in under the same account, you will be able to listen to both computers' music, but not import.

  • Including flash from different directory

    hi. I want to include swf file from another directory. I'm
    including flash in this way:
    *** file: flash/flash.cfm
    <script type="text/javascript"
    src="swfobject.js"></script>
    <div id="flashcontent"><strong>no
    flash</strong></div>
    <script type="text/javascript>
    var so = new SWFObject("flash.swf", "flash", "111", "200",
    "8.0.0", "#00000");
    so.addParam("allowScriptAccess", "sameDomain");
    so.addParam("menu", "false");
    so.write("flashcontent");
    </script>
    this file is located in directory flash with flash.swf file.
    Now, I wish to inlude the flash object into page from up
    directory. I try somthing like this:
    *** /test.cfm
    <cfinlude template="flash/flash.cfm>
    but i get message: no flash (from div). My question is: how
    to attach swf file from another directory?

    hi. I want to include swf file from another directory. I'm
    including flash in this way:
    *** file: flash/flash.cfm
    <script type="text/javascript"
    src="swfobject.js"></script>
    <div id="flashcontent"><strong>no
    flash</strong></div>
    <script type="text/javascript>
    var so = new SWFObject("flash.swf", "flash", "111", "200",
    "8.0.0", "#00000");
    so.addParam("allowScriptAccess", "sameDomain");
    so.addParam("menu", "false");
    so.write("flashcontent");
    </script>
    this file is located in directory flash with flash.swf file.
    Now, I wish to inlude the flash object into page from up
    directory. I try somthing like this:
    *** /test.cfm
    <cfinlude template="flash/flash.cfm>
    but i get message: no flash (from div). My question is: how
    to attach swf file from another directory?

  • Importing music from different computer

    I want to import music from a friend's computer (both her and my computer are macs). How do i a) do this without erasing all my music already on my ipod b) just select a few of her songs.
    Thanks,
    corinne

    Set the iPod to manage music manually, and then drag the songs from the second computer to the iPod; you can drag individual songs. You will then need to keep the iPod in manual mode to keep all the music from both machines on it.
    (8558)

  • How to import classes from an external actionscript file

    This is driving me crazy, I've been trying to resolve this on my own for ages, and I've reviewed a lot of different materials, but I still can't seem to just import some external actionscript classes correctly.
    I'm using Flash Builder 4 with the Flex 4 SDK on mac osx 10.6
    the class I'm trying to import (I'll call it DesiredClass) is in a folder like this
    /libraries/com/foreignproject/com/foreignproject/DesiredClass.as
    within the class itself, the package declaration looks like this (I left all the guts out for clarity):
    package com.foreignproject
        import flash.display.Sprite;
        public class DesiredClass extends Sprite
            public function DesiredClass()
    I'm working on a totally different actionscript file at
    /Users/username/Documents/Adobe Flash Builder 4/TestProject/src/TestProject.as
    in this file I try to import the DesiredClass:
    package
         import com.foreignproject.DesiredClass;
         import flash.display.Sprite;
         public class TestProject extends Sprite
              public function TestProject()
              var neatClass:DesiredClass = new DesiredClass();
    And then I try to add the class I want to the source path.
    I've tried adding each folder to the source path separately:
    /libraries/com/foreignproject/com/foreignproject/DesiredClass.as
    /libraries/com/foreignproject/com/foreignproject/DesiredClass.as
    /libraries/com/foreignproject/com/foreignproject/DesiredClass.as
    /libraries/com/foreignproject/com/foreignproject/DesiredClass.as
    /libraries/com/foreignproject/com/foreignproject/DesiredClass.as
    If I choose the libraries folder or either of the com folders then an error shows up in theTestProject.as file, saying:
    Definition com.foreignproject:DesiredClass could not be found.
    But f I choose either of the foreignproject folders then an error shows up in theDesiredClass.as file saying:
    a file found in a source-path must have the same package structure 'com.foreignproject', as the definition's package, ".
    What am I doing wrong? Please help. I bought a book on actionscript, started doing the flex-in-a-week series, read numerous online discussion boards, and I still can't import these classes.
    Thanks in advance.

    I don't know if this method is supported anymore but you can give it a try.
    If you backed up bookmarks in IE using the following directions, you should be good!
    *In IE, "File -> Import and Export -> Export Cookies".
    *Open newly exported "cookies.txt" in a text editor and put a period before every line that starts with a domain. So a line starting with <b>altavista.com TRUE / FALSE 1388491200 AV_ALL 1</b> will become <b>.altavista.com TRUE / FALSE 1388491200 AV_ALL 1</b>
    *Then, move the "cookies.txt" file to your profile folder.
    You can get to the Profile folder two ways
    *Help > Troubleshooting Information > Profile Directory > Show Folder
    or
    *Go to '''about:support''' and click Show Folder next to Profile Directory.

  • Jikes compiler problem when importing class from a jar

    hi everyone,
    I'm new there so please excuse me if i post a pb that have been already answered...
    I've a pb with jikes that is encountering a problem and so closing when compiling. I use ant to build my project.
    In my classpath I have, among others, a jar named 'kepler.jar' in which I use the following class 'WSResult;'
    In my java class I have the following import :
    'import com._4d.kepler.model.WSResult;'
    Do you think it is the character "_" that makes jikes to bug ?
    What else can be the problem of not compiling and stopping building the project ?
    Thank you very much for your help, looking forward to your answer...!
    Florence.

    Editing material is vastly different from just playing it.
    With Audio, a player is accessing the actual file on the HDD, and reading the info from there.
    The big difference is that with PrE (and PrPro), those files are not being used directly. When Imported, a couple of things happen:
    PrE creates links to those files, for later use, when one Exports/Shares
    PrE creates "proxy files," to display the Video on the Timeline, based on those links. It also creates proxy files for better display, when one Renders the Timeline, or portions of it.
    PrE creates a CFA (Conformed Audio) and a PEK (Waveform Display) file, that are used - the CFA is to allow for critical editing and the PEK is what one sees on the Audio Track. The actual files are NOT directly accessed - only the CFA file.
    For a bit more info on Conforming, see this ARTICLE.
    Now, there have been some problems reported, where the Audio was Linear PCM/WAV. I do not know what there is about the LPCM, that causes the issue, but the "plain vanilla" PCM/WAV's seem to be trouble-free. I would love to read, from an Adobe employee, or audio engineer, explaining on why there might be issues.
    For the red, and as there is some "earthiness" to it, I like the Acacia Carneros Pinot Noir. I pick it up at Costco for about US $22. It has proved to be about the best inexpensive PN, that I have encountered. Another, is the Peachy Canyon Incredible Red, which I have picked up "on sale" for around US $ 9. Their Peachy Canyon East Side Zinfandel, is even better, and I've found it as low as US $ 15. If you can find the Glen Carlou Grand Classique (South Africa), it is about the best cheap Bordeaux Blend, that I have ever found at ~ US $ 12.
    Good luck,
    Hunt

  • Wsimport failure as my wsdl import files from different sources

    I have tried to generate java code from wsdl using mtosi 1.1 example I ahve found in the Apache CXF sample.
    For the sake of knowledge wsdl2java of cxf was able to generate everything fine.
    wsimport fails.
    Unfortunately it's a pain to post all the wsdl, because each different WSDL imports other schemas and wsdl separately.
    The example is to be found in the cxf samples dir or at the following url.http://sourceforge.net/project/showfiles.php?group_id=153083
    Does wsimport work when the bindig files and schemas are defined explicitly?
    trying using the -b option with all the binding files and schemas does not change anything.
    This is the main wsdl:
    mtosi_1.1\wsdl\transport\http\ManagedElementMgrSOAP_HTTP.wsdl
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- TMF854 Version 1.0 - Copyright TeleManagement Forum 2005, 2006 -->
    <wsdl:definitions xmlns:tmf854WS="tmf854.v1.ws" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="tmf854.v1.ws" name="TMF854-ManagedElementMgr-SOAP-HTTP">
         <wsdl:import namespace="tmf854.v1.ws" location="../../binding/soap_http/ManagedElementMgrSOAP.wsdl" />
         <wsdl:service name="ManagedElementMgr">
              <wsdl:port name="ManagedElementMgr" binding="tmf854WS:ManagedElementMgrSoapHTTPBinding">
                   <soap:address location="http://127.0.0.1/mtosi/v1/ManagedElementMgr" />
              </wsdl:port>
         </wsdl:service>
    </wsdl:definitions>I get this message:
    [ERROR] invalid extension element: "soap:header" (in namespace "http://schemas.xmlsoap.org/wsdl/soap/")

    I have posted this issue even in the netbeans issuezilla ( the defect appears in netbeans wizard as well).
    http://www.netbeans.org/issues/show_bug.cgi?id=122505
    from this url you can download the zip file containing the WSDL MTOSI specification I have tried to use.
    Every file contained into the directory I have used the mtosi_1.1\wsdl\transport\http\ is fine.

  • Import classes from outside

    I have a .java file that needs methods from a .class file that is outside of the java SDK environment. I have 3 questions with respect to complie
    1. Can I use 'import outside.server.class.*' in my java code?
    2. when I javac, how to pass the -classpath parameter? if the .class file is located in a directory (like c:\app\classes\outside\server\?
    3. when I execute the final complied .java file, do I still need to pass the classpath again?
    thankx
    ku

    1. yes, you can do this, as long as you have a chain of directories matching your import statement descending from one of the directories in your classpath
    2. if, let's suppose, you're in the app directory, you can say '-classpath classes' which should then put your classes directory into the search tree.
    3. Normally, yes.

  • Importing class from default package of a JAR

    I want to create objects of a class contained in a JAR. The JAR has many classes in numerous packages, however the class that I want to use is in the default package. I'm using eclipse and have added the JAR to the build path, but eclipse complains that the class name cannot be resolved. Is there some way to specify an import statement to look in the default package of a particular JAR? Any advice is appreciated.

    jg2009 wrote:
    I was under the impression that classes without a defined package were technically considered to be part of the so-called default package. But, in answer to your question, yes this class does not appear to part of any package.
    Just to provide so additional information, the class that I want to instantiate is an Applet, so it is designed to be called from an html object tag, and have access to all of the other classes in its JAR. There is a system that provides access to underlying data via the following components: html form <-> javascript <-> applet <-> serverlets <-> data
    I want to automate certain data operations, but the only way to access the underlying data is via the applet. Am I out of luck, or is there some way that I can instantiate the applet?All jverd said is right, assuming it is your code and you can change it: basically move everything to a package. But I think your problem is that the jar is a 3rd party jar and you cannot change it. If this is the case, you can use the 'default package' (the terminology is correct) by having your own class(es) in the default package or by using reflection (last time I tried reflection would work). Both are rather bad solutions, but if you really, really want...
    Note: Java actively discourages the use of the 'default package' and more so recently, this is why I am not even sure that reflection would still work.

Maybe you are looking for