Add class without a source file in Jbuilder

I have a project with 10 classes. I have been given the source files of the seven of them and the final three class files of the rest. The thing is that when I am trying to compile one of the seven source files which need the already made class files they cannot be compiled because they cannot find the 3 class files.
I am using jbuilder 5 and it is a servlet project.I read somewhere that I have to add too the 3 class files in the libraries that the project uses?Is this correct and how can i do it?
It is not just enough to add the class files in the project?
thanks....

This may work...
Take a look at 'Project/Project properties', which will bring up a dialog box, containing 'paths' tab. Under this click on 'required libraries', then 'add', and then 'new' then add the directory of your class files. If this doesn't work, add the classes to a jar and add the jar to your required library path.
Hope this works, post back if not
Matt

Similar Messages

  • Why only one public class in a source file?

    why we have to write only one public class in a source file?

    PhHein wrote:
    Because the JLS says so.It does?
    From section 7.6 of the JLS (third edition):
    When packages are stored in a file system (§7.2.1), the host system may choose to enforce the restriction that it is a compile-time error if a type is not found in a file under a name composed of the type name plus an extension (such as .java or .jav) if either of the following is true:* The type is referred to by code in other compilation units of the package in which the type is declared.
    * The type is declared public (and therefore is potentially accessible from code in other packages).
    This restriction implies that there must be at most one such type per compilation unit. This restriction makes it easy for a compiler for the Java programming language or an implementation of the Java virtual machine to find a named class within a package; for example, the source code for a public type wet.sprocket.Toad would be found in a file Toad.java in the directory wet/sprocket, and the corresponding object code would be found in the file Toad.class in the same directory.
    >
    To my mind, it's strongly recommending, rather than mandating, this practice. All academic of course, merely shifting the answer from "Because the JLS says so" to "Because pretty much all Java compilers say so". I don't know of any that don't enforce this, but of course, that doesn't mean they don't exist

  • Can you code 2 classes into one source file?

    Can you have 2 classes coded in one source file? If so, do you end up with 2 .class files after the compile?

    yes you can code 2 classes in one source file. I
    believe that you have to reference one class is an
    "object" class of the class under which you save the
    file as.
    Example:
    File name is A.java
    class A{
    class B{
    When you want to refer to class B, you have to say
    A.B ( eg: A.B ab = new A.B() ). The class file(s)
    will be A.class and A$B.class.
    This is what I recall at best at the time. good luckI presume you mean when one is an inner class? Otherwise:
    public class one {
      one() { System.out.println("one");
      public static void main( String[] argv ) {
        new one();
        new two();
    class two {
      two() { System.out.println("two");
    }Will work fine, and will create one.class and two.class. But that does not mean it is a good idea to do it ;o)

  • Distributing classes over various source files

    Hi,
    Here are my 2 newbie java questions about :
    1) is it possible to split a single class up among several files,? I�ve tried taking my file foo.java and splitting it so that half the methods are in foo1.java and the other half are in foo2.java, just for convinience and readablity. Javac doesn't seem to like this. Is there something I shoudl be doing to make this legal or is it just not allowed?
    2) Similarly, is there a way have a private inner class in a seperate file from its outer class?
    I haven�t seen any references to how to do this � is it that javac is very dependant on the structure of the .java files, or just that all the examples I�ve seen so far have been?
    Thanks,
    Dan

    1) is it possible to split a single class up among several files,? Yes, but you'll have to glue them all back together again to get javac to process them.
    I�ve tried taking my file foo.java
    and splitting it so that half the methods are in foo1.java and the other half are in foo2.java,
    just for convinience and readablity. Convinience : doesn't seem very convenient to me to have one class split into two source files.
    Readability: as above, less readable.
    If your class seems incovenient or unreadable, its most likely too big and doing too many things.
    Javac doesn't seem to like this. Is there something I
    shoudl be doing to make this legal or is it just not allowed?Glueing the pieces back together.
    2) Similarly, is there a way have a private inner class in a seperate file from its outer class?Not without some preprocessor goo.
    is it that javac is very dependant on the structure of the .java filesMost likely by design.

  • Replacing the Header in rule file without changing source file(header defi)

    hi,
    i am loading the data using header in the Source file (.xls).
    I need to load the same file but for diff header (say instead of A1 i need A2) without any changes in source file.
    can someone please provide information that how to change the header in source file without opening/changing source file.
    Thanks in advance
    Anubhav Bisht

    HI SM,
    thanks for reply.
    the Problem is that there is two members in header defined in the source file that i need to change while loading the data.
    the load rule is picking header from the Source file, so replacing in the field is not working..
    do you have any other option/Suggestion.
    Regards
    Anubhav

  • Why we can have only one public class in one source file

    why we can have only one public class in one source file

    When the java compiler is run it looks for classes referenced by the classes you are directly compiling. When looking for these referenced classes it looks for source as well as class files and compiles them automatically if the coresponding class files are missing, or older than the source.
    In order to do this it must be able to work out the source file name for any given class which might be referenced from another (the rule also applies to package level access).

  • Two public classes in one source file

    Can anyone please explain what is the exact reason why the java source file name should be same as the only allowed public class name in the source file. Answer only if you know the correct answer. No gusses please. I read the other postings on this topic. None of the answers were correct.

    One reason is that some RISC processor architectures
    (like those Sun uses mostly) have hierarchical memory
    architectures. This hierarchy is divided into global
    modules and local (global-accessible) submodules. The
    advantage of this is that the processor needs lesser
    memory access "points" (handles), as the modules
    delegate CPU calls to the submodules.
    The java compiler can utilize this and increase
    performance by loading the entire source files into
    the memory and assign them a CPU handle (the module
    ID). It'll be later used for linking, e.g. The public
    class in a file will be loaded as a module and gets
    the handle, all other non-public classes in that file
    will be submodules.
    If there is no public class, a generic module will be
    used, so that's no problem. But if there are multiple
    public classes, you'd end up with several modules and
    just one handle to assign, thus having ambiguity. The
    CPU won't be able to address the correct module.
    This all only applies to RISC CPUs, but for obviuos
    cross-platform compatibility reasons it was added to
    the standard - it doesn't hurt the other
    architectures, but helps those with hierarchical
    memory management.Thanks, but the rooster explanation makes more sense to me.
    Now could someone please express it a la Majinda?

  • Can you place more than one class in a source file?

    If so how is this done because I get the following error when I try to.
    IPHunter.java:100: class Arguments is public, should be declared in a file named Arguments.java
    public class Arguments {
    Thanks in advance

    When having two classes in the same file, only one should be public, and the file should be named with the name of that class.
    Try removing public from the class Arguments, and if you have to use it from classes outside the file, you should have a file Arguments.java
    Hope that helps,
    Al

  • Does a member class have to be within the same source file?

    Hi there,
    I have this application that extensively uses two classes. The main class setsup the GUI, and the second main class is responsible for handling all of the actions that arise from the GUI.
    I could have done this by making all of my handler methods be of the first main class, but this class really is just for the GUI setup, the logic doesn't fit into this class' behaviour.
    The class that handles the GUI actions is required to use the fields of the main class e.g. to get values of a text field. The problem is that since the class that handles the actions is getting very big, I would kind of like to move this class into a different source file - because currently it is a member class of the first one, so that it can access all of its fields.
    Is there some way that I can move this handler class into another source file, and still have it access all of the fields of the main GUI class - without making the fields public, or using millions of get/set methods? Also, I can't use inheritance because the both the GUI class creates an instance of the handler class in its constructor, and so leads to an infinite loop when trying to instantiate the GUI class.
    Can I ask.. would a static class or something be of use here? Do they exist? I'm confused as to how to do this without getting the mother of all source files (in size that is - nothing to do with cooking or baking).
    - Anyway, thanks in advance for any help that you could give me -
    BYEE, Edd.

    You can't have an inner class that is not in the same source file. However, you could use package-protected (default) access to give another class in the same package access to things without making them public. Actually, that's how inner classes are actually compiled. Package-protected access is underused IMHO. It's a great tool that most people (including myself) are suspicious of at first.

  • Compile multiple source files

    sorry, this is maybe a newbie question.
    but iI have a problem compiling an application that use multiple sources files
    for exemple
    the class A is in the file 1
    the class B is in the file 2
    class A uses an instance of the class B
    class B uses an instance of the class A
    so i'm unable to compile these files coz each one tells me he doesn't know about the other
    Is there a way to define prototypes of class or fonctions before their use like in C/C++?
    Or is there another way i didn"t pay attention
    thanks all

    This is a minimal explanation of packages. For a full explanation of packages and how to compile and run Java programs, see this page:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/tools.html
    and read the Setting the Classpath and the How Classes are Found topics.
    Assume that your programs are part of a package named myapp, which is specified by this first line in each source file:
    package myapp;
    Also assume that directory (C:\java\work\) is listed in the CLASSPATH list of directories.
    Also assume that all your source files reside in this directory structure: C:\java\work\myapp\
    Then a statement to compile your source file named aProgram.java is:
    C:\java\work\>javac myapp\aProgram.java
    And a statement to run the program is:
    java myapp.aProgram
    (This can be issued from any directory, as Java will search for the program, starting the search from the classpath directories.)
    Explanation:
    Compiling
    A class is in a package if there is a package statement at the top of the class.
    The source file needs to be in a subdirectory structure. The subdirectory structure must match the package statement. The top subdirectory must be in the classpath directory.
    So, you generate a directory structure C:\java\work\myapp\ which is the [classpath directory + the package subdirectory structure], and place aProgram.java in it.
    Then from the classpath directory (C:\java\work\) use the command: javac myapp\aProgram.java
    Running
    Compiling creates a file, aProgram.class in the myapp directory.
    (The following is where people tend to get lost.)
    The correct name now, as far as java is concerned, is the combination of package name and class name: myapp.aProgram (note I omit the .class) If you don't use this name, java will complain that it can't find the class.
    To run a class that's NOT part of a package, you use the command: java SomeFile (assuming that SomeFile.class is in a directory that's listed in the classpath)
    To run a class that IS part of a package, you use the command java myapp.aProgram (Note that this is analogous to the command for a class not in a package, you just use the fully qualified name)

  • Java Source File

    I would like an explanation for the following:
    I have two public classes in one source file, one is nested inside another. Now, it was my understanding that you can only have one public class in one source file. Can somebody, please, explain me this?
    Thanks,
    Boris.

    ummm... the class is public and can be accessed from outside the class, the requirement is that there can be only one package level class in on source file. If the one of the public classes is nested, no problem :)

  • Loosing source location with separate source files

    Hi,
         I am compiling my code with g++ (version 2.8.1) using the -g option. When I use one large source file with all my classes and the main routine in it, I can browse the source in the analyzer GUI. If I split out all classes into separate source files (which I was hoping would help me maintain the code better), I am no longer able to browse the source files. Analyzer complains about the directory where all source files live not being accessible.
    thanks for any input anyone might be able to offer!
    h.

    In Windows XP the path should be
    c:\Documents and Settings\<username>\Application Data\com.adobe.formscentral.FormsCentralForAcrobat\Local Store\data
    You might notice that in that folder the images and forms are saved as separate objects and not all in one file like the FCDT file.
    For local file the FCDT contains all you need. If you ever move to online forms and start collecting data then you will notice that that FCDT doesn't contain the data recieved but only the design of the form. In the case you move the form online then we never save the form locally so there is no way to use a source control to save the form other again than just saving the design format (fcdt file) and not the data received.
    You can vote for a new request here http://forums.adobe.com/community/formscentral?view=idea (click on the "Create an idea" in the top right corner)
    hope this helps
    Gen

  • How can I put more than one source file when I am creating my installer from LV 7 Express

    Hi,
    I am creating my installer for my application and I would want to add more than one source file at once, how could I do it?
    Thanks,
    ToNi.

    Hi,
    I'm referring to the first executable. In other words, I have my application and I want to build and executable of it. Then I go to "Tools->Build application..." and then in the source files tab I can add my vi files but I want to add more than vi at the same time (at once) and not one by one. How can I do it?
    And my second question is: When I make the installer for my application I save the configuration in a build Script file (.bld) in order to use it whenever I want. Then If from another computer different from the one where I generate the .bld file, I load it, LV tells me that something is wrong (LV says there are some errors in some VIs but It doesn't tell me what files are). Why?
    Thanks in advance,
    ToNi.

  • *Added* code to existing source file, compiled it, and class file shrunk

    Another newbie here. Fortunately, my classpath is ok, so I'm able to compile a .java file.
    I added one line of code (System.out.println) to write the value of a variable to a log. After compiling with javac, I noticed that the resulting [new] class file was smaller than the existing class file. I looked at each of the class files with Textpad. It's gibberish, but I quickly saw that a large block of code was missing in the new class file, even though the size of the source file had been increased.
    There is a difference, however, between how the two class files were created. The existing class file was compiled (along with many others) by exporting an .EAR file from a development environment (WSAD) to the WebSphere Administrator Console. Conversely, I am now compiling the same source file with javac on my machine.
    I suspect that this is the reason why I can add code to a .java file, compile it, and have the resulting class file actually lose code. Even if I am correct, I don't know what to do about it.
    Does anyone have an idea?
    Regards,
    Daniel T.

    Thank you both for your replies. I've read many posts over the past few months, and I know how important it is to provide as much info as possible, when asking a question here. That said, I have another tasty tidbit...
    After replacing the existing (larger) class file with the new (smaller) class file, my application now produces this:
    "*Error 500: LinkageError while defining class*..." [name of class]
    *"...(Unsupported major.minor version 50.0) This is often caused by having a class defined at multiple locations within the classloader hierarchy. Other potential causes include compiling against an older or newer version of the class that has an incompatible method signature. Dumping the current context classloader hierarchy: ==> indicates defining classloader ==>[0] com.ibm.ws.classloader.CompoundClassLoader@6bd156d5 Local ClassPath:"*
    ...[the entire classpath]...
    Original exception--- java.lang.UnsupportedClassVersionError:
    I'm guessing that my focus should mostly be on the 'Original exception', and maybe I need to revisit the JRE or JDK or JVM (these terms are somewhat nebulous to me, so please forgive me using them interchangeably) on my machine. For now, I'll just keep trying stuff. Thanks again for the replies!
    Regards,
    Daniel T.

  • AS3 classes source file location?

    Can anyone tell where the AS3 package source files (*.as) are located?
    Besides for looking up class definitions in the AS3 framework in the Actionscript 3 Language Reference site, I'd like to open specific class files to look at them in their entirety. But I can't seem to find them, nor can I find any documentation specifying their location.
    Any information on where the core AS3 package files are located locally would be appreciated.
    Thanks.
    AS3 Reference
    ( http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html ) 

    Well Nick, I think you were right..
    The following summarizes add/modify classpaths (as2) and 'source path' (as3) :
    http://help.adobe.com/en_US/flash/cs/using/WS3e7c64e37a1d85e1e229110db38dec34-7fa4a.html
    Under Flash Preferences menu ->ActionScript->Language->ActionScript 3.0 Settings you find at the top level :
    Filed labeled "Flex SDK Path : $(AppConfig)/ActionScript 3.0/flex_sdk/4.0.0/"
    Found the flex_sdk folder in the Flash application folder (mac), Programs file on PC I imagine.
    Therein is a 'flex.swc' file, which I'm guessing has all the core classes.
    I'm guessing one needs to download the Flex SDK source code here; you may need to download & learn how to use a Subversion (versioning app) client ?? :
    http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK
    Seems like a lot of hoops to jump through just to access those source files for a beginner.
    Frustrated.

Maybe you are looking for