Accessing class in other directory

how can i access and use class that is located in other folder??
for example my program is located in C:
and i want to use / access a class that is in C:\test\THECLASS.class
how can i refer to the THECLASS.class??

CLASSPATH
KBone's Mastering the Java Classpath http://www.kevinboone.com/classpath.html

Similar Messages

  • Possible to access classes in other folders without the use of packages?

    Hi,
    I'm trying to write a kind of connector application, and I have come across this stumbling block.
    I have a folder for my main program classes, which will not change. External to that folder( either in a subdirectory or another directory on the same level) I want to have my classes to "connect". The connected classes will be compiled dynamically, as they depend on something in the main classes folder for complilation... I trust I can satisfy that using javac -classpath...
    The problem is that I would like one of the main classes to be able to access the connected classes at runtime, from the other folder. The collection of connected classes will be changing, so that, coupled with the fact that one of the main classes will be required to compile each connected class seems to rule out the use of packages for the connected classes.
    Is there a way to get around this?
    Thank you,
    Jesse

    Are you trying to dynamically compile Java classes (in external folders
    without packages) via Java? Yes, I will be (hopefully) using com.sun.tools.javac. I haven't done that part yet, as I don't want to waste my time on a design that is fundamentally flawed :)
    Does each new 'application' get placed into its ownfolder? No. I will be building a collection of new apps that will all be contained in one folder.
    Once an application is compiled, must it beimmediately available to the process that compiled
    it? Yes. Once an application is compiled I need it to be accessable from that point on.
    Thanks,
    Jesse

  • How to use classes in other directory ?

    Hi,
    Sorry it's a total newbie question but i don't know how to do. I made a project, i have the main part of my classes in the root directory but i have somme classes in sub-directories , how can I use this classes , is there an equvalent of include in C ... ?

    search the forums for classpath.

  • Accessing class through other class objects:

    Hi,
    I've 3 classes A,B and C. In class A, I'm creating 1 instance of B, in B 4 instance of C. I want to access C in class A. Can anybody guide me how can I achieve this?
    Thanks,
    Santosh

    More of a c# than a wpf question.
    Which way I would approach this depends on what these classes do and how they are interrelated.
    A creates B so it can easily hold a reference to B.
    B creates C so it could put them in a public list and A can get them.
    I'm not clear whether that's what Joel meant to post.
    public class a
    private b myB;
    public a()
    myB = new b();
    c firstC = myB.MyCs[0];
    public class b
    public List<c> MyCs;
    public b()
    MyCs.Add(new c());
    MyCs.Add(new c());
    MyCs.Add(new c());
    MyCs.Add(new c());
    public class c
    Hope that helps.
    Recent Technet articles: Property List Editing;
    Dynamic XAML

  • Integrate other directory servers with access manager

    How to integrate other directory servers with access manager ?

    Please read the Access Manager admin guide at http://docs.sun.com/app/docs/doc/819-4670/6n6qardvq
    Any further questions regarding this integration, post them to the AM forum at http://forums.sun.com/forum.jspa?forumID=770

  • Question about access non-public class from other package.

    Hi, everyone!
    Suppose class A and class B are in the same java file of package pkg1
    -- A.java. So, A is a public class and B is a non-public class.
    If I want to access class B from another class class C and class
    C is in package pkg2. When compiling, an error occurs indicating
    that class B is not visible to class C.
    So, If I defined serveral classes in one java file and I want to
    access every class from other package. How should I do?
    (I think in one java file, there should be only one public class and
    only the public class can be accessed from other package.)
    Thanks in advance,
    George

    So, If I defined serveral classes in one java file and
    I want to
    access every class from other package. How should I
    do? As you already seem to know, there is at most one public class allowed per source file (at least, with javac and most popular compilers). So if you want more than one public class, you will need to use more than one file...

  • Cannot access class java.nio.ByteBuffer

    Hi All -
    I'm trying to compile a java sample code.
    I keep getting the error described in the subject line
    cannot access class java.nio.ByteBuffer; file java\nio\ByteBuffer.class not found
    I have un-ziped the java sdk 1.4.1 src.zip to a directory under c:\ and added the java\nio directory to the project setting and compile with jdk runtime 1.4.1 and yet get the same error....
    I've tried by redirecting to src.zip and didn't work either....
    I would appreciate your feedbacks and sorry for the lame question, consider it as a newcomer to Java world.
    thanks in advance

    You test it by running the following line....
    java java.nio.ByteBuffer
    If it says "main not found" then your problem has nothing to do with the java install nor the classpath. The code you are trying to compile is wrong.
    If it says class not found then you use this line next....
    java -version
    If this returns nothing then you are not using the Sun VM (you are using the MS one.) If it returns a version below 1.4 then your PATH statement is wrong (and you should uninstall all sun versions then reinstall.) You can fix the MS VM problem by altering the path so the java path is first.
    If it does say 1.4 then you need to uninstall and reinstall because something is messed up.

  • Cannot access class javax.jms.TextMessage;

    Hi,
    I am trying to run standard page from JDev and i am getting below error from EOImpl.java.
    " cannot access class javax.jms.TextMessage; file javax\jms\TextMessage.class not found "
    I tried to import javax/jms dir to my local machine but i could not find jms directory under javax in OS. Can you guys pls help me to resolve this.
    Thanks,

    Hi Scott,
    Not sure wht you wanted me to try...
    I have something like this in the code which is causing that error..
    BusinessEvent businessevent = new BusinessEvent(s1, s2);
    businessevent.setData("Opportunity " + s2 + "updated");
    ArrayList arraylist = new ArrayList(1);
    arraylist.add(oadbtransaction);
    businessevent.setObject(arraylist);
    businessevent.setStringProperty("pLeadId", getLeadId().toString());
    java.sql.Connection connection1 = oadbtransaction.getJdbcConnection();
    businessevent.raise(connection1);
    Its asking me to import jms..but ii could not find those files in Unix..is there anyway to import these files OR any other solution to fix this error?
    Please help..

  • Cannot access class javax.sql.RowSet

    Hello everyone,
    I had a question about this error I am receiving "cannot access class.javax.sql.RowSet". I have put the RowSet.jar file into my jdk/jre/lib/ext directory and when I compile I recieve this error. Can Anyone help? Thanks!

    I think you need to add one (or more) of the available libraries to your project, in your project's settings dialog, but I'm unsure which. If you can't find the correct one, you can always add a newly created one, which holds a reference to your jar file.

  • I moved my iTunes content to an external drive a few months ago; now I can't access it with other iWork/iLife applications.  Help please :)

    Between my external drive and my internal drive I have 3 Library.xml and Library.itl files. (There was a situation where I had to rebuild for some reason)
    Should the "Library" files reside on my internal drive or external drive?  In my ~/users/username/Music/iTunes/ directory?  If so, can I delete all current versions of the Library files and just rebuild by holding down the shift key when starting iTunes and choosing an option?  Which one? Would they end up in the correct directory? Sorry if this seems confusing but everything works fine with my iTunes EXCEPT I can't access iTunes in other iLife/iWork programs.
    I should mention I have the same problem with iPhoto (on external drive; not populating in iLife/iWork, but works fine by itself) I know, not the right discussion, just thought I'd mention it.

    If the iTunes Library.itl file is also on the external drive, try launching iTunes while holding down the Shift key, and when the dialog window opens that allows you to create a new library or open an existing one, choose to open an existing one, navigate to the folder that contains that library file and select it.
    If that works, note for the future that if you launch iTunes when that external drive isn't mounted, iTunes will default back to the normal location on the internal drive and you'll have to repeat the Shift-launch process.
    Hope this helps.

  • Unable to access classes in third party jar files packaged with my ejb.jar

    I have packaged some third party jar files in my xxx_ejb.jar file.  The third party jar file contains classes that are accessed by some custom classes which are in turn accessed by my bean classes.  I get the following error when my custom classes attempt to use any of the classes in one of the third party jar files:
    java.lang.NoClassDefFoundError: com/Ostermiller/util/CSVParser
    Shouldn't I be able to access classes in jar files that are packaged with my xxx_ejb.jar file?  I see the xxx_ejb.jar file as a resource of the application classloader that contains it but I don't see the third party jar files.

    As per the Java EE specification, additional JAR files should be packaged on the EAR level. Only WAR files' WEB-INF/lib folder is scanned for JAR files to be added to the classloader.

  • How to access code in other projects?

    Hi all,
    I ran into an issue in FlexBuilder I'm not sure how to resolve, hopefully someone here can help.  I have several projects in my workspace right now I'll call them project A and B.  I have one project in particular, call that project C, that needs access to code contained in a couple of other projects, A and B.  I don't want to copy all those files from the other projects into this one cause there's a lot of files, it's tedious, and unmaintainable.  I don't want to make all those files into a flex library either cause it's not really necessary.
    I tried adding the folders in project A and B into the source path of project C but when I tried to import those files it did not work.  So does anyone know of a way that I can access code from other projects in the same workspace?  If you could provide an example also that would be greatly appreciated.
    Thanks in advance.
    Additional info: The code complete for the import actually shows me the files in the source path are available.  In fact, when I hit F3 it points me to the proper file in the other project.  However, FlexBuilder keeps telling me the type was not found or it isn't a compile time constant.

    Michael Borbor wrote:
    I never said don't use OOP, Flex SDK is all about classes, and abstraction, but last time I check there wasn't polimorphism, so AS3 it's not yet a purely OO.
    No polymorphism? You should check again. Just because overloading is not supported that does not mean that polymorphism can't be applied. Polymorphism does not start or end with overloading, please read up on polymorphism ( http://www.adobe.com/devnet/actionscript/articles/oop_as3_05.html or find a more generic definition and see that polymorphic principles can be applied in AS 3.0 too ).
    No, ActionScript is not purely OOP, but what is? The only language I know of that is considered "a pure OOP language" is Java. Does that make other languages less good? Definitely not. Just because AS 3.0 does not support overloading it does not mean that OOP principles can't be applied and nor does it mean that it's not a valid OOP language.
    Michael Borbor wrote:
    Instead of learning this architectural stuff If I were new to Flex, first I'll learn what the heck is the Flex SDK, and obviously AS3, then I can move on to design patter, singletons, decorators, PureMVC, and so on.
    Well, sice I don't know ehwhoknows and I have no idea how new he is ( he may be new to Flex but that doesn't mean that he is new to programming ), I took "the risk" to add an additional opinion to his post saying that "sure what ntsiii said is totally cool but in the future, you might want to read up on OOP and design patterns because they offer much more than mixing projects in a barbaric manner".
    Obviously, if he is new to programming ( a detail that I don't see being mentioned in his post ) then he should stick to the simple things, but does that mean that we can't point out other solutions that may be more complex and harder to understand for a newbie at the moment. At least, he'll now know that there are other solutions out there too. Everything has it's time, but without telling him that "hey, solution A si ok, but solution B would be much better on the long run" then how do you expect him to find out about solution B? By accident?
    I wasn't trying to prove anyone wrong, all that I wanted to point out is that there are other solutions out there too that offer much more on the long run. If he can't handle OOP at the moment, no problem, but at least give him the chance to try it out.
    @ ATIF FAROOQ: I totally agree that it would be nice if the guys at Adobe would implement overloading and not only, abstract classes would be nice too ( and I mean "real abstract classes" like in Java, not workarounds ).
    @ Muzak: Totally agree, I said to use a Library mainly because that's what I use most ( beside simply pasting classes from a project into another; I do this occasionally and sometimes when I'm lazy ). In either case, the final goal is achieved: reusability.
    With best regards,
    Barna Biro

  • PDK 9.0.4 Error: cannot access class oracle.security.jazn.realm.RealmUser

    Dear Forum,
    we are developing portlets for Portal 3.0.9.8. We use the default JPDK version, that comes with the standalone Oracle OC4J 9.0.4 bundled with PDK.
    We want to improve our portlet by check the userid of the portal user. Therefore, we want to use oracle.portal.provider.v2.ProviderUser.getUser().getName()
    in a JSP.
    First - even before the method call - we included
    <%@ page import="oracle.portal.provider.v2.http.ServletProviderUser" %>
    But even this 1 statement gives in JDeveloper 9.0.4 with the libs pdkjava and ptlshare from the OC4J the following error:
    Error: cannot access class oracle.security.jazn.realm.RealmUser; file oracle\security\jazn\realm\RealmUser.class not found
    What is wrong here? What missing library we must include?
    Thank You in advance

    Problem solved. Need to include jazn.jar in project's lib-paths.

  • Urgent: how to really seperate business logic class from data access class

    Hello,
    I've this problem here on my hand and i really need help urgently. so please allow me to thank anyone who replies to this thread =)
    Before i go any futhur, let me present a scenario. this will help make my question clearer.
    "A user choose to view his account information"
    here, i've attempted to do the following. i've tried to seperate my application into 3 layers, the GUI layer, the business logic layer, and the data access layer.
    classically, the GUI layer only knows which object it should invoke, for example in the case above, the GUI would instantiate an Account object and prob the displayAcctInfo method of the Account object.
    here is how my Account class looks like:
    public class Account
    private acctNo;
    private userid;
    private password;
    private Customer acctOwner;
    the way this class is being modelled is that there is a handle to a customer object.
    that being the case, when i want to retrieve back account information, how do i go about retrieveing the information on the customer? should my data access class have knowledge on how the customer is being programmed? ie setName, getName, setAge, getAge all these methods etc? if not, how do i restore the state of the Customer object nested inside?
    is there a better way to archieve the solution to my problem above? i would appriciate it for any help rendered =)
    Yours sincerely,
    Javier

    public class AccountThat looks like a business layer object to me.
    In a large application the GUI probably shouldn't ever touch business objects. It makes requests to the business layer for specific information. For example you might have a class called CustomerAccountSummary - the data for that might come entirely from the Account object or it might come from Account and Customer.
    When the GUI requests information it receives it as a 'primitive' - which is a class that has no behaviour (methods), just data. This keeps the interface between the GUI and business layer simple and makes it easier to maintain.
    When using a primitive there are four operations: query, create, update and delete.
    For a query the gui sets only the attributes in the primitive that will be specifically queried for (or a specialized primitive can be created for this.) The result of a query is either a single primitive or a collection of primitives. Each primitive will have all the attributes defined.
    For a create all of the attributes are set. The gui calls a method and passes the primtive.
    For an update, usually all fields are defined although this can vary. The gui calls a method and passes the primitive.
    For a delete, only the 'key' fields are set (more can be but they are not used.) The gui calls a method and passes the primitive.
    Also keep in mind that a clean seperation is always an idealization. For example verify that duplicate records are not created is a business logic requirement (the database doesn't care.) However, it is much easier and more efficient to handle that rule in the database rather than in the business layer.

  • Cannot access class oracle.sql.BLOB;

    Hi,
    I am trying to save a .tif file into Oracle database. When I run the program in JDeveloper I get the following errors:
    Error(9,19): cannot access class oracle.sql.BLOB; file oracle\sql\BLOB.class not found
    Error(59,29): class BLOB not found in class mypackage1.ImageUpload
    package mypackage1;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.sql.*;
    import java.util.Properties;
    import oracle.sql.BLOB;
    Blob imgblob = rs.getBlob(1);
    OutputStream blobos = ((BLOB) imgblob).getBinaryOutputStream();
    ...................Any help is appreciated. Thanks

    What package do I need to include in my classpath for
    this. ThanksWhy don't you inspect your JAR files? Do you have WinZip? Open them with it and find the class.

Maybe you are looking for