Eclipse: Referencing Class Files

I have an Eclipse project A that references another project B (ie, files in project A have import statements which import classes in B). Project B is explicitly referneced in the properties of project A.
However, Eclipse is not recognizing the import statments. The files in project B are class files only (no source). But I didn't think that should matter.
Any ideas about what could be going wrong?
Thanks,
John

This is precisely what I meant by "project reference."
This is thing that has always worked for me too but
is not working in this current situation.
Thanks,
John
So, did you put the classes on Project B's classpath and then export them on the "Order and Export" tab in the Java Build Path properties? If not, then adding Project B to Project A's build path won't add the class files you want.
If you have already done this, then how about telling us more about your setup? - What does your folder structure look like in project B? What does your classpath look like in both projects? What classpath elements have you exported from Project B and in what order? Can Project A find the imports if you copy some of Project B's source code to Project A?

Similar Messages

  • Applets: location of class files

    Can applets use classes from a directory other than the one holding the applet?
    I want to have some common classes used by applets that are scattered about in different directories. Anyone know if this is possible?

    I would assume it would be possible but you would have to set your class path to point to those directories containg the class file. If you are using eclipse a good idea is to put all of those class files that will be used more then once into one project (a util project) then when you create a new project just have the new project reference the util project. Then when you go to create the jar for you applet it will create it will all of the class files used in the util project as well as all the referenced class files in the new project.
    Just ideas..... hope they help

  • RMI Classloading and referenced classes

    Hi All,
    I am trying to develop an application that uses a thin client methodology using RMI. What I mean by thin client is that there will only be several classes to start the client side application and invoke the rmi server. The rmi server will return the class files (mainly Swing/Charva JFrame and JPanel classess, which I refer to as the UI classes), which will be instantiateds and referenced by an interface that all the classes implement. Many of the UI classes also instantiate classes for control and presentation (i.e. extended JText Fields and other java classes). It seems that because RMI uses the URLClassLoader, the referenced class types do not have to reside on the client side on disk. I believe this is because RMI automatically loads both the classes that were requested by the client and any additional classes that are referenced by the requested classes. My first question is:
    1. Are the referenced classes loaded at the same time the called class is loaded, or when the called class is instantiated?
    2. We store the rmi requested .class files in a hash table the first time they are requested. We do this so we do not need to go accross the network the next time we need to reference and instanitiate the class; we just get if from the hash table. My question is, if we instantiate the class file from the hash table, does RMI reload the referenced class files (the classes that are instantiated within the object I am instantiating, i.e Extended JText and UI Controller classes) from the RMI server or are the loaded from memory on the client side?
    Any responses are greatly appreciated.
    Elliott Gonshor
    QuestDiagnostics

    Hi,
    I remembered that some of the AWT components have
    their corresponding Serializable form. I am not too sure
    if Swing components has such a form. But since you
    have make it happened, I think that it should be yes.
    I found some words in the book, Java Enterprise in a
    Nutshell. I excerpt some of them in the book as follows :
    ========================
    java Djava.server.rmi.codebase=-http://objhost.org/classes/ Regaccount
    We've setting the codebase to http://objhost.org/classes/,
    so we have to make sure that an htpp server is running on
    the objhost.org machine and that the necessary class files
    (eg, the AccountImpl stub class) are in the classes
    directory of that http server's document root
    Now we can run the AccountClient class on the remote
    client as before, but the client's host machine doesn't
    have the stub class for the Account remote object
    available locally. WHEN THE AccountClient TRY TO
    LOOK UP THE REMOTE Account OBJECT, we want
    the stub class to be loaded remotely. ......................
    ===================================
    You may notice that I uppercase one sentence !
    So if I believe the description, then I think those
    referenced class files should be loaded when the
    called class is instantiated. Since it happens at the
    time when the action of look it up.
    Since it has been load into the client, I think that it should
    loaded those reference class on the client side. Although
    it just said that
    but the client's host machine doesn't
    have the stub class for the Account remote object
    available locally. ...........
    it seems to mean that it does not have it locally so it
    start loading it from remote. So it might be the case if
    it existed in local, it should be cached and without
    reloaded from remote.
    It is my assertion. I could not promise ii it is right
    or not. In fact, Try it might be better.
    For the first question, you may try to insert some
    flag in the code which is downloaded firstly and
    observe if it happen in which phase, loaded at
    the same time, or when the called class is instantiated
    For the second question, You may try to make it
    work, that is, all classes have been downloade to
    the client side and works smoothly. Consider that
    remove those reference class file stored in the remote
    side. and request again.
    if it works, it means that local class is reference firstly.
    if not, it means that it reloaded from the remote side
    without considering the copy in local.
    if all of them are wrong , Well ..... God bless you !
    hahaha
    good luck,
    Alfred Wu

  • Edit a class file in Eclipse

    I am new to Java and Eclipse and Weblogic.
    I was give a .war file and told to simply edit a parameter that they thought was in one of the .jsp pages in the war file.
    the only occurance of the parameter name "SearchProvider" is in the Search.class file located deep in folders under the WEB-INF folder.
    the only way i could even find the parameter "SearchProvider" was with the use of an Effective File Search trial software.
    I opened (barely) the Search.class file with windows notepad and its mostly jibberish but I can find the reference to "SearchProvider" in the class file.
    I need to change this parameter.
    When I import this into eclipse, I get the message there is no source file attached to the class file Search.class.
    I added the entire class folder into the library. I tried to change the class source but all I have are just the files in the .war package.
    I have tried changing the extension to .jar and this will let me add these files as a project, but I cannot edit this Search.class file no matter what I try.
    My basic question is, Am I missing files from the client? Do I need more than just a war file?

    Most likely you are searching the wrong place, on an web application the first place to start searching is the web.xml, it is the core configuration file it will tell everything about your application including which other tecnologies are being used, like struts, it is very likely that the answer to your question lies in the web.xml file.

  • Java - referencing external jar and class files

    When compiling (loadjava) a Java class, how can an externally referenced '.jar file' be resolved please? Using '-resolve' doesn't do the job in this case.
    Many thanks.

    I think I've seen an option for this with manifest files (or was it something that had to do with the java plug-in). There was something about the version and only download a new version if it was newer than the one on your local computer. This version thing is something you define in the manifest file at least. Take a look at jar and manifest files, there might be something there.

  • .class files in eclipse

    Hello,
    I am developing a web application in eclipse.After development i need to deploy the changed .class files to the server..
    but i am not getting the .class files in my eclipse are are only .java file present in my application.
    Can any tell me how to get the .class file for the modified .java file.
    Thanks in Advance

    Maybe this is just an issue with the view? The build folder in "Project Explorer" does not display the class files by default. However, it can be customized to display the .class files. Follow these steps...
    http://stackoverflow.com/questions/4163923/what-can-i-do-to-make-display-the-bin-folder-on-eclipse
    The "Navigator" view (open it using "Window" -> "Show View" menu option) also displays the .class files in your project.
    If you're using OEPE and deploying to a WebLogic Server, this tutorial will offer additional information about deployment and the FastSwap configuration "to reload altered classes without disturbing running applications."
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/jdev/obe11jdev/11/eclipse_intro/eclipse_intro.html

  • What are "Name$1.class" files and how do I generate them in Eclipse

    I have the source code of a rather large java application and I want to set up an Eclipse project for it.
    After diffing the WEB-INF directory generated by Eclipse with the one generated by the original maven build script I noticed that there are several files of the form "Name$1.class" which do not exist in the Eclipse output.
    My questions are, what is the purpose of this $1 string in the class file name and how do I generate those in Eclipse?

    ok, but why are they generated in the Maven environment but not in the Eclipse environment?
    To be exact, Eclipse does create inner class files, however when diffing both output directories I have some extra inner class files generated by Maven that are not there in the Eclipse output.
    Maybe there are some java compiler settings for this?

  • Class file is referencing a type outside the classpath???

    Hi All,
    I'm developing a EJB project in NWDS.
    I'm getthing the below syntax error.
    This compilation unit indirectly references the missing type com.sap.exception.BaseException (typically some required class file is referencing a type outside the classpath)
    Can you please help me to resolve this?
    Thanks in advance.
    Sundar

    Hi Sundar,
    You need to add the ejb20.jar file to your Project classpath.
    If you are developing the project locally then the jar file can be directly added to the class path using the Project Properties --> Java build PAth --> Libraries tab --> Add External Jar.
    If it is a DC development, the ejb20.jar can be found under the SAP-JEE software component of your track.
    Hope it helps.
    Regards,
    Alka.

  • Separate folder for class files (eclipse)

    hello :)
    in eclipse how do i specify a different dir to output my class files to ?

    in eclipse how do i specify a different dir to output my class files to ?Project > Properties > Java Build Path: select a Default output folder.
    kind regards,
    Jos

  • Issue in .class file in imported archive ESR - after upload using eclipse

    Dear Friends,
    My requirement here is too change existing java mapping. Here I am exporting zip file from imported archive and after making changes in eclipse upload the .JAR file again. Here .class file is not opening after upload in Imported Archive.
    Error is
    Setup I am having on my system.
    -> JDK version on my system JDK 1.6_34
    -> JRE on my system – JRE 6
    -> Using eclipse SDK 4.2.2
    SAP PI servers settings.
    I searched online blogs but no help. Can anybody guide me what wrong am I doing here?
    Thanks.
    Sumeet.

    Thanks for reply..Hareesh.
    -> In Eclipse only 1 warning is coming and no error. I guess Eclipse automatically compile .class file. Is there any way in eclipse to see if compilation is done properly?
    -> I imported few external JAR files and already few JAR files are there in Eclipse(JRE1.6), as shown in fig below. Which JAR file is being user? How can I make sure?
    -> When using Run as option I am not getting any option. Is it normal or did I have to activate some option?
    Please give your views on this.
    Thanks.
    Sumeet.

  • I am able to compile a java file in eclipse inspite of compilation errors shown in eclipse and a .class file is generated

    Hi,
    I had a java file with compilation errors as shown in eclipse IDE.
    But the class file is still generated in the classes folder on building and pressing clean the project.
    I confirmed that the class file has an updated time stamp and also that a System.out.println() statement that i added was indeed printed out when this class was encountered during the running of a web application in which this class was called somewhere.
    (The java class has no subclasses and it is a single class with public modifier).
    How does it happen so?
    Regards,
    Karthik.

    As far as I know, the java code is compiled in Eclipse as soon as you save it. i.e. press CTRL+SHIFT+s
    as far as the build is concerned, in case you have a build file where you specify how to make a jar file, the location the jsr file is to be placed, only then you have to build the project. However again, as far as just simple compile is concerned as soon as you save the files are compiled. And show you the errors if any in the tasks window.

  • Adding .class files to your project and making them work.

    Ok, im fairly new to java and having trouble understanding how to make importing of .class files work. Im using eclipse 3.2
    I have the files in a directory and I have gone to project->properties->java build path->libraries->add external class folder and pointed it to the correct place.
    Now, I am trying to use some of the classes it provides. I get no errors when creating the object with this code:
    com.ECS.client.jax.ItemSearchRequest itemRequest = new com.ECS.client.jax.ItemSearchRequest();
    Before I did the add external class folder that code would error cause it didnt know what com.ECS was. Now it works fine. My problem is that when I try to use a class, it does not recognize it as a class. After doing the above code I have:
    itemRequest.setSearchIndex("Books");
    its giving me an error on the period, saying: "Syntax error on token(s), misplaced construct(s)". Its not seeing that it is a class, so I can't use it. But when I am creating the object I get no errors. For reference, here is the chunk of code:
    com.ECS.client.jax.ItemSearchRequest itemRequest = new com.ECS.client.jax.ItemSearchRequest();
    itemRequest.setSearchIndex("Books");
    the second line of which errors. So my question is, how do I get it to recognize that the itemRequest is a class when I have imported the .class files to my project already?

    It's working fine. It's just that you have to put your code in a method.

  • Unable to run a .class file w/ javaw

    I created a simple application which uses swing gui.
    This application works just fine when I click the "run" button in eclipse.
    But as soon as i copy the .class file from the eclipse project folder to somewhere else and try to run it with "javaw myclass" (the filename is myclass.class) nothing happens.
    No command not found error, no nothing.
    Its like javaw finds and executes the .class and then returns to the command prompt... But I dont see any windows or any sign of my program running.
    Thx in advance

    When run with just java I get this:
    C:\>java myclass
    Exception in thread "main" java.lang.NoClassDefFoundError: myclass$1
    at myclass.<init>(myclass.java:38)
    at myclass.<init>(myclass.java:28)
    But I Eclipse it works just fine...
    What does Eclipse do that I dont?

  • How to convert a .jad file to .class file in JAVA Swings.

    Hi all,
    Sorry for the interruption.I am also facing the same problem.I am using DEJDecompiler.But my application is not J2ME But J2EE.( a Swing application).I opened .class file and made some changes but I dont know how to convert into a .class file again.
    I tried saving .jad file to .java file.Then it is showing lot of errors in Eclipse Platform.I doubt if there are any errors in the .class file already,then how could the program would run.I put all the programs in the respective platforms only and then testing.It fails.
    (2) one more question,is if I do not need to disturb any existing coding and need to create a seperate java file which will do my customisation,then what should I do.I could not get any interfaces in the program.
    Please help me as the matter is most urgent.
    Thanks in advance
    With regds
    Satheesh.K

    I tried saving .jad file to .java file.Then it is
    showing lot of errors in Eclipse Platform.I doubt if
    there are any errors in the .class file already,then
    how could the program would run.I put all the programs
    in the respective platforms only and then testing.It
    fails.So who's Java program/library are you trying to steal?
    (2) one more question,is if I do not need to disturb
    any existing coding and need to create a seperate java
    file which will do my customisation,then what should I
    do.I could not get any interfaces in the program.
    Please help me as the matter is most urgent.Wow, you urgently need to steal someones program/library. The best person to give you advice urgently is the owner of the program/library you are trying to steal.
    Thanks in advancePlease don't thank me because I'm not going to help you!
    With regds
    Satheesh.K

  • How to compile and register a Java CFX tag with multiple class files?

    All-
    If this is the wrong forum for CFX questions, please let me
    know.
    I need to determine how to compile and register a Java CFX
    tag that contains multiple class files. One class file implements
    the CustomTag interface and the other class files implement various
    supporting classes. All of the documentation that I have found
    talks about using a single class file. I am assuming that a JAR
    file will be involved, but I am not sure of the specifics.
    Thanks in advance for your help.
    -Josh

    Yes, it will involve a jar. Use your java IDE (eclipse,
    etcetera ..) to create a jar containing all of the classes. Check
    your ide's documentation for how to create jar files. After you
    have created the jar, place the jar in the CF class path so CF will
    recognize it. For example the {cf_root}/WEB-INF/lib directory. CF
    must be restarted before it will detect the new jar. After
    restarting CF, register the CFX tag in the ColdFusion Administrator
    using the name of the class that implements the CustomTag
    interface.
    Though it is worth noting you can also instantiate java
    classes directly from ColdFusion (ie without using a CFX
    tag).

Maybe you are looking for

  • Something called My Start has just appeared and it screws up everything. How can I get rid of it?

    When I installed Firefox on my new computer, it came with a new thing called incredimail and My Start. It screwed up everything, making it impossible to restore my settings. I deleted Incredimail using the Control Panel but My Start continues to uplo

  • Bug in Calendar app

    There is a bug in my calendar app It is synced to facebook, and i have wp 8.1 After selecting 'not going' for an event, the event got deleted from the app, but it keeps on showing on the live tile I tried switching off and on many times, but w after

  • Very Low Disk Warning

    I recently received a Very Low Disk warning. I have seen this before on other macs when I perform a "Erase Free Space" operation on the Disk Utility. However, I was not doing that now. I appear to have about 45 gig of free space on my MacBook Pro. It

  • Where is the Serial Number 6-1091TX? + 0xc0000225 Error

    Ok, I have come across an issue and girlfriends laptop will not boot. It comes up with 0xc0000225 Error in Windows Boot Manager I did as it asked and placed a bootable USB with Windows 8.1 in the port and pushed enter to continue. It loops back to th

  • Javascript Questions Transfering code between docs

    Hello all, I am very new to this and I am trying to update a document that a person who is no longer with our company created.  He created an FDF for us that contains some Javascript and I would like to copy the it from his document into this new upd