Package, Import scope identifing.

This is a bit out of my league, but my question is concerning identifying classes available in a package given an import statement -- determining this information would then be useful for eliminating unneeded multiple imports ( " * " ), determining method, and member visibility, etc.
I would like to start by writing a simple command line tool that cleans up the import on a single file. Of course, determining the used methods and classes used and then isolating the import down from say:
import java.util.*; // TO:
import java.Vector; // OR SOMETHING ALONG THOSE LINES.
Without writing a full blown compiler, I was sort of wonderring if anyone had any ideas on where I might start researching the mean of getting this done.
L-
Student-

Why do you want to do this? A wildcard import statement does not mean that all those classes are loaded. Only the classes actually used by your program are. At least this is my understanding. Is there a performance penalty by using wildcards that I am not aware off?
Anyway have you looked at the Package and ClassLoader classes? You may want to start by looking at ClassLoader.getSystemClassLoader() and ClassLoader.getPackage().

Similar Messages

  • Package-Import statement problem

    Greetings JDC Community...
    This problem has been driving me insane for over an hour. It's a simple package-import problem. I have a file called DataAddingTest.java which is in my C:\Java\risk\tests\ directory and it has a package statement "package risk.tests;". Then I try to import all of the files I have in the risk directory by using "import risk.*;" and it whines in error that "package risk does not exist". I'm about ready to throw my computer... can someone help me? Thanks for your time.
    -Billy Mahabir

    Hello again everyone...
    It seems all of you have mistaken my problem to some degree. The beginning part of my DataAddingTest.java file reads like this:
    // This class tests adding data to the data structures in my Risk(c) game.
    package risk.tests;
    import risk.*;
    DataAddingTest.java is in my C:\Java\risk\tests\ directory. I am trying to import a whole bunch of files from my main risk directory, i.e., C:\Java\risk\. And it is just not working. I have no idea why. I'm pretty sure I have the correct syntax for what I'm doing; it should work. The exact error message I get at compile-time is this:
    DataAddingTest.java:5: package risk does not exist
    import risk.*;
    ^
    There is indeed a C:\Java\risk\ directory (of course), and it contains many java files, all of which have "package risk;" declared at the top. And yes, I have also compiled those before I try to compile this file. Someone please help! Thanks for everyone's time.
    -Billy Mahabir

  • Package import ncsa.j3d.*; does not exist

    Hi, i'm working on a 3d game for my fyp and am haveing trouble importing the package import ncsa.j3d.*; and the package import ncsa.j3d.loaders.*; Net Beans keeps giving me an error saying package import ncsa.j3d.*; does not exist and package import ncsa.j3d.loaders; does not exist!!!
    Any help would be terrific, I'm running under windows xp, amd mobile.

    I'm having the same problem, have you figured it out yet?

  • Package life scope?

    hi,
    I am newbie to PL/SQL package. I have known how to write and call it. but I always compare it with Java/C++ class. I want to know what is different between them, because PL/SQL package doesn't have >new< keyword. When I use a function/procedure in package, it seems that I have only one instance of my PL/SQL package. How about the package life scope?
    Any documents and examples for package life scope are welcome.
    Thanks.
    Wu JianHua.

    You can think of a session and a connection as the same thing. In this case, there would be two connections, so two sessions. Each session would have their own package variables.
    Note that it is probably a mistake to think of packages in terms of objects if you're coming from an object-oriented background. Oracle has an entire suite of object-oriented features if that is what you're interested in. Packages should be thought of more like libraries in other languages.
    The PL/SQL User's Guide and Reference will have more information if you're interested http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/toc.htm
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Package (import oracle.jdbc.driver.*) not found -----URGENT--------

    Hi All,
    i've been using oracle thin driver for oracle 9i server since a long. but now it gives error like
    package import oracle.jdbc.driver.* not found
    it seems some problem in classpath.
    but i've inludeed classes111.zip/classes12.zip to classpath and with this was working fine. dunno what's the problem . kindly mail me at the earliest to:[email protected]
    also i'm working with Tomcat server.
    to run the servlet i don't want to type the absolute url like
    http://localhost:8080/servlet/test rather http://localhost/test .so how to config it . can ne one tell me asap.
    with thanx abd rgds
    Sayed
    so can u tell me

    1. Copy classes12.zip to %TOMCAT_HOME\common\lib
    2. Go to %TOMCAT_HOME\common\lib dir, rename classes12.zip to classes12.jar
    I think someone else has reply same problem before, next time you can do a search before post your problem.

  • CIN packages - Import taking lot of time

    Hi,
    We are on SAP 46C, CIN 40A. While i am trying to import CIN suport package 10 in my server, the system is taking lot of time. I have updated my SPAM to the latest version.  As of now, the import has taken more than 4 hours. What will be the usual time for the CIN support package import. Is there any way to speed up the process. Please advise at the earliest.
    Thanx,
    subbu

    Check
    Note 532596 - FAQ: Country Version India (CIN)- Installation and SPs
    . How long does a CIN installation take ?
    The time depends on the hardware that is available. If 4 processors and 2 GB RAM is allocated to that instance then it takes about 40 minutes. The maximum time is about 1.5 hrs .
    Be also aware of the fact, that 40A is no more supporter after December 2006.
    Markus

  • Package/Import statements - javac gives errors while Netbeans does not

    I do not know why, but when I compile/run my code with the statements
    package TavisProject;
    import TavisProject.LabelAndButtonFrame;
    in Netbeans, everything works properly as it should. However, if I try to compile the SAME files with javac at the cmd line, I get the errors:
    C:\FinalProject\src\TavisProject>javac Main.java
    Main.java:22: cannot find symbol
    symbol : class LabelAndButtonFrame
    location: class TavisProject.Main
    LabelAndButtonFrame labelAndButtonFrame = new LabelAndButtonFram
    e(); // Instantiates/calls labelAndButtonFrame
    ^
    Main.java:22: cannot find symbol
    symbol : class LabelAndButtonFrame
    location: class TavisProject.Main
    LabelAndButtonFrame labelAndButtonFrame = new LabelAndButtonFram
    e(); // Instantiates/calls labelAndButtonFrame
    ^
    2 errors
    Also, if you comment out the statements in both files, everything compiles fine with javac. Also, please note that LabelAndButtonFrame.java is in the same folder as Main.java.
    I'm trying to get a batch file to work properly that will compile/create javadoc, but I can't get it to work without figuring
    out what the deal is with those package/import statments causing problems.
    Thanks,
    Tavis
    The main code is as follows:
    package TavisProject;
    import TavisProject.LabelAndButtonFrame;
    import javax.swing.JFrame;
      * @author Tavis Curry
      * @version 1.0
      * This Class is called MainMethod. It instantiates/calls labelAndButtonFrame.
      * Uses javax.swing.JFrame
    public class Main
           * Main method
              * This method will call labeAndButtonFrame, set the default close op,
              * set the size of the jframe, and set the jframe to visible
            public static void main(String args[]){
                    LabelAndButtonFrame labelAndButtonFrame = new LabelAndButtonFrame(); // Instantiates/calls labelAndButtonFrame
              labelAndButtonFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); // LabelAndButtonFrame will Exit when the X-button is clicked
                    labelAndButtonFrame.setSize( 550, 70 ); // Sets frame size - width by height
                    labelAndButtonFrame.setVisible(true); // Shows LabelAndButtonFrame
         } // End main method
    } // End class LabelAndButtonFrameMessage was edited by:
    TC10284

    Thanks much. That worked.
    I had EVERYTHING working except this little thing.
    I'm a little confused on why it makes a difference if
    I set this however. Why can the compiler not find the
    files if they're in the same dir?Because it doesn't find files - it finds classes.
    The fact that it can use directories to organize the hierarchy is misleading. That is an easy convention but it doesn't alter the fact that it uses the class path itself along with other rules to find classes (not files.)
    >
    Also, now that I have to set the classpath, how would
    I get this to work inside a batch file that uses env.
    variables to locate the base project?
    Both the java compiler and the java vm tools support a command line option which allows you to fully specify the class path.

  • Joone package importer...

    Currently I want to build a simple neural network example XOR.
    I want to import package import org.joone.engine.*;.
    When I compile, it shows that the package doesn't exist.
    I don't where the package is.
    I have installed the Joone editor. I think it should come along with that package.
    Anyone have solution for this?
    Thanks in adavance. : )

    Have you tried reading the joone documentation?
    If you installed it, you should know where the installed files are located. Search for a directory org/joone/engine containing .class files, or look for a .jar file.
    The jar file (with complete path) or the directory containing the org directory should be included in your classpath.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • App-V 5 SP2 ODT Office 2013 32bit Package Import error

    I have used ODT to package Office 2013/Project/Visio.  The package is created without any errors.  When I go to import the package using App-V Management Console i get the below error.
    "There were problems interacting with the database on the server.  The error was: String or binary data would be truncated.
    The statement has been terminated."
    There are no further errors and the import fails.
    I have successfully imported the 64bit version using the exact same steps without issue.  Can someone please advise?

    Thanks for the escalation Brandon.  Yes i have created the 32bit version without the Languages, and this has worked. so it looks as if there is a String that is being created which may exceed the limits of the Database.
    I was able to open the Appv file in Sequencer and just change the name using that.  I am now able to publish the App.  I still find it strange that ODT allows the file to be created with such a long string and then throw an error.

  • System shutdown during support package import

    We were importing a BASIS support package in our system. Then for other reasons the system shutdown in the IMPOR_PROPER phase so...the system now is corrupted.
    We try to launch the import of support package again from SAP GUI but we can not, a dump is generated everytime.
    Are there a posibility of launch the import from operating system to finalice the aplication of package?what are the commands to do that?
    We try to avoid the recovery from backup
    Regards

    Hi,
    I don't  think it is possible other than backup restore.
    But already you are at worst case..i will suggest you to check the data in PAT01 and PAT03 tables at database level.
    And delete all the contents from those tables then retry to login.
    *Open a support message
    Regards,
    Nick Loy

  • Packages, import and Inheriting with static

    Hello.
    I am programming a program, in which the main class (file: Main.java) uses objects declared in Components.java.
    The problem is, the import of the components only works if I explicitly make the main class inherit from the components class with whose objects being declared as 'static'. A simple import instruction, the way I learned it, in the main class such as 'import <project>.components;' does not work.
    Sample code:
    Current state; working
    Main.java:
    package <project>;
    public class Main extends Components {  
        public static void main(String[] args) {
            start();
    }Components.java:
    package <project>
    public class Components {
        public static void start() {
            // code
    }Desired:
    Main.java
    package <project>;
    import <project>.components;
    public class Main {  
        public static void main(String[] args) {
            start();
    }Components.java:
    package <project>
    public class Components {
        public void start() {
            // code
    }How to realize this idea into a working program?
    Thanks in advance!

    I apologize for not conveying my problem proberly, but you have to know I did not learn Java with reference material in the English language, therefore it might happen that some terms are not translated correctly (by me) and thus not equaling the standardised terms.
    Anyway, let me try to rephrase my problem.
    I want to use the object declared in Components.java in the main class/main methode of the file Main.java. In order to achieve this goal I used inheriting, concretely the main class inherits from the components class, as a makeshift to use Components.java's objects in the main class. However this is not the way I want to accomplish my objective with.
    To make a long story short I just want to utilise Components.java's object in Main.java's main method. The manner to achieve this does not matter, though I want to do it preferably with 'import'.
    Hope this clears things up. Thank you anyway.
    Edited by: Ikaragua on May 31, 2008 6:00 AM
    Solution found.
    package project;
    public class Main {  
        public static void main(String[] args) {
            Components.start();
    }

  • Package-import statement problem: Part II

    Hello again everyone...
    It seems all of you have mistaken my original problem to some degree. The beginning part of my DataAddingTest.java file reads like this:
    // This class tests adding data to the data structures in my Risk(c) game.
    package risk.tests;
    import risk.*;
    DataAddingTest.java is in my C:\Java\risk\tests\ directory. I am trying to import a whole bunch of files from my main risk directory, i.e., C:\Java\risk\. And it is just not working. I have no idea why. I'm pretty sure I have the correct syntax for what I'm doing; it should work. The exact error message I get at compile-time is this:
    DataAddingTest.java:5: package risk does not exist
    import risk.*;
    ^
    There is indeed a C:\Java\risk\ directory (of course), and it contains many java files, all of which have "package risk;" declared at the top. And yes, I have also compiled those before I try to compile this file. Someone please help! Thanks for everyone's time.
    -Billy Mahabir
    PS. Reply to http://forum.java.sun.com/thread.jsp?forum=31&thread=392985
    to earn some Duke Dollars for your trouble; if you can help me.

    Thank you for your help; you are the first one to
    successfully help me. I'll give you some DD's if you
    reply to my original post:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=39
    985
    Thanks again!
    -Billy MahabirHuh??
    Maybe you should go back to your original post and check the last two replies.
    Both tell you to do exactly that: Set your classpath!

  • How to find correct package import directive

    Hello,
    I would like to use the methods byteToHex02sString and hexStringToByteArray in the ToolkitUtility but now I have a really basic problem:
    How can I find the correct package name for import directrive to make the class available. The documentation says dgs.tlkt.ToolkitUtility;
    Regards, Rainer

    Hello,
    I think the classpath is found correctly, otherwise other import-files wouldn't be found as well. I checked the JRE lib folder and even unpacked all jar files, ther was no hint for my class ToolkitUtility.
    Below the jar-files in my environment. Is it possible that I need to install some add ons or JRE 1.5?
    Anyboddy out there who is able to resolve this class/package names.
    Regards, Rainer
    javaws\javaws-l10n.jar
    javaws\javaws.jar
    lib\applet\WMPNS.jar
    lib\ext\dnsns.jar
    lib\ext\ldapsec.jar
    lib\ext\sunjce_provider.jar
    lib\im\indicim.jar
    lib\im\thaiim.jar
    lib\jce.jar
    lib\jsse.jar
    lib\plugin.jar
    lib\rt.jar
    lib\security
    lib\security\US_export_policy.jar
    lib\security\local_policy.jar
    lib\sunrsasign.jar

  • Package importing problem from 1 package to another package.

    Hi All,
    I have made to package, "forum" and "utility". DBhandler java file is in "utility" package and Forumhandler is in "forum" package.
    I want to import DBhandler classes from "utility" package into "forum" package for this i write
    "import utility.*" in forum package's Forumhandler java file. But it is giving error.
    The error is -
    forum/ForumHandler.java:13: cannot resolve symbol
    symbol : class DBHandler
    location: class forum.ForumHandler
    DBHandler dbhand = new DBHandler();

    is the class DBHandler declared a public class in utitlity? Does it start with the line
    package utitility;
    Is it in the directory:
    %CLASSPATH%/utility/
    Have you read the tutorials and done a search for packages on these forums?

  • EP 6.0 SP 9 snack preview - Problens after  package import

    I just installed the EP 6.0 SP 9 snack preview. The installation was okay and the Portals used to work. Them I imported the MSS package and after that I can not launch the SAP Portal anymore.
    I already tried restart the server, the system but I have no luck.
    When I launch the SAP Manager Console, I can observe the system is not totality green. The JCONTROL.EXE on the process list is yellow and the status is Some Process Running. The Server0 (J2EE Server)  on the process table the status is Starting Application. When I open the developer trace from the jcontrol I can observe the following error:
    - [Thr 2672] Tue Mar 15 07:48:22 2005
    [Thr 2672] JControlMSReadMessage: NiPeek() returns -5 NIETIMEOUT
    Does anybody passed thought this situation before or have any idea how could I solve this problem?
    Thanks in advance for your help and time.

    Change the bootstrap.maxheap from 16 to 128 in the clusters/instance.properties file.
    Jai

Maybe you are looking for