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)

Similar Messages

  • Any Tutorial / Sample to create Single PDF from multiple source files using PDF assembler in a watched folder process.

    Any Tutorial / Sample to create Single PDF from multiple source files using PDF assembler in a watched folder process. I have a client application which will prepare number of source files and some meta data information (in .XML) which will be used in header/footer. Is it possible to put a run time generated DDX file in the watch folder and use it in Process. If possible how can I pass the file names in the DDX. Any sample Process will be very helpful.

    If possible, make use of Assembler API in your client application instead of doing this using watched folder. Here are the Assembler samples :  LiveCycle ES2.5 * Programming with LiveCycle ES2.5
    Watched folder can accept zip files (sample : Configuring a watched folder to handle multiple input files and write results to a single folder | Adobe LiveCycle Blog ). You can also use execute script to create the DDX at runtime : LiveCycle ES2 * Application Development Using LiveCycle Workbench ES2
    Thanks
    Wasil

  • Howto deal with multiple source files having the same filename...?

    Ahoi again.
    I'm currently trying to make a package for the recent version of subversive for Eclipse Ganymede and I'm almost finished.
    Some time ago the svn.connector components have been split from the official subversive distribution and have to be packed/packaged extra. And here is where my problem arises.
    The svn.connector consists (among other things) of two files which are named the same:
    http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/features/org.polarion.eclipse.team.svn.connector_2.0.3.I20080814-1500.jar
    http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/plugins/org.polarion.eclipse.team.svn.connector_2.0.3.I20080814-1500.jar
    At the moment makepkg downloads the first one, looks at its cache, and thinks that it already has the second file, too, because it has the same name. As a result, I can neither fetch both files nor use both of them in the build()-function...
    Are there currently any mechanisms in makepkg to deal with multiple source files having the same name?
    The only solution I see at the moment would be to only include the first file in the source array, install it in the build()-function and then manually download the second one via wget and install it after that (AKA Quick & Dirty).
    But of course I would prefer a nicer solution to this problem if possible. ^^
    TIA!
    G_Syme

    Allan wrote:I think you should file a bug report asking for a way to deal with this (but I'm not sure how to fix this at the moment...)
    OK, I've filed a bug report and have also included a suggestion how to solve this problem.

  • Java.lang.NoClassDefFoundError when compile SQLJ source file

    Always got error message java.lang.NoClassDefFoundError: sun/io/CharToByteConverter
    when using sqlj to compile SQLJ source file.
    The CLASSPATH (partial) .:$ORACLE_HOME/sqlj/lib/translator.zip:$ORACLE_HOME/sqlj/lib/runtime.zip
    I am able to compile the demo TestInstallCreateTable.java and TestInstallJDBC.java but not TestInstallSQLJ.sqlj in the same directory.
    I am using Oracle 8.1.6 R2 client in Linux Intel on Red Hat 6.0. Can anyone explain why this happened ?

    From the forthcoming new version of the SQLJ FAQ:
    "NoClassDefFoundError: sun/io/CharToByteConverter"
    (This is likely a general configuration issue, not something specific to your code.)
    Running sqlj results in the following error message.
    java.lang.NoClassDefFoundError: sun/io/CharToByteConverter
    at sqlj.tools.Sqlj.initializeErrors(Sqlj.java:519)
    This happens if you are running under a JRE environment, and not a full JDK environment. You need to download and install a full JDK environment. Note that the Oracle
    database installation will only set up a Java Runtime Environment. Oracle does not distribute the Java Development Kit - you have to get it from http://java.sun.com
    If that did not help, you'd need to give us a fuller picture of your environmnet (JDK versions, PATH, CLASSPATH settings, etc.).
    Thanks!

  • StackOverflowException compiling 8000 source file

    I am trying to compile a source file with ~8000 lines. It has many (hundreds) of static members (instances of that class), and methods containing conditional statements to take a string and return the instance of that name. This is generated code, so I do not think I can change it.
    Every time I try to compile it with Maven (Sun JDK 1.4.2_05) I get a java.lang.StackOverflowException. I have tried giving Maven more stack memory via the -Xss option (as much as 10m per thread), but that didn't help at all.
    I commented out 90% of the code and it works fine, so I know it is the size that is the problem.
    Has anyone had to deal with something like this before? If so, how did you fix it?

    Thank you to everyone who has replied. After some experimentation I discovered that the problem is not the 800+ static objects being created - it was the 1000's of lines of nested conditional statements. The generator has been modified to make if, if, if... instead of if, else-if, else-if, ... and all is well. :)
    I do not believe any sort of hard limit was reached, b/c Eclipse had no problem with the file. Also, one of our projects has a source file with 12k lines, and it works fine (though it has a different structure).
    I find it interesting that people are being so critical about the generator, especially since this is only one small piece of its modelling. The generator does far more than just create the key types and values.
    Furthermore, I don't understand the criticism of the code as-is. No, it's not something I'd write myself, nor would I wish to maintain such code - but no one has to! That's what the generator is for. If I want to add or delete a key type/value, I do so in the generator, and then regenerate the code.
    I also don't understand why anyone thinks this code is not object-oriented. Perhaps I just didn't explain it well. All classes representing key types extend AbstractDiscreteValue, so there's inheritance. The reason why all the values exist as static (and final) instances is b/c we never need more than one instance of each value, the values are known at generation time, and all instances are immutable.
    How would any of you construct such a class? Keep in mind that maintenance is not an issue, and most key types (probably 95% or more) have fewer than a dozen values.
    Anyway, thanks again for the help.

  • Best Practive - One mapping reading multiple source files

    I want to develop a solution for one single mapping reading multiple similar source files that are stored on different directories on my OWB server. I want to be able to determine on runtime of my mapping from what location to load the source file from.
    Example:
    Mapping: Load_test_data
    source file 1: c:\input\loc1\test.dat
    source file 1: c:\input\loc2\test.dat
    When I run the mapping I would like to use an input parameter specifying the location loc1 or loc2. I would also like to use this input parameter in my mapping to populate one column in my target table with the value of this input parameter. This design would make it possible to dynamically load source files from different directories and also being able to see after loading where the data came from.
    Questions:
    - Is there a way to create such a design
    - If not, what alternative would be appropriate.
    Thanks in advance for the feedback

    Thanks for the feedback. Unfortunately I do not use workflow together with my OWB.
    I now indeed specified the file name and file location in the configuration of my mapping. However I am not able to change then upon executing the mapping. Data file name and file location are empty and greyed out when I execute my mapping. It always takes the values I specified in the configuration of my mapping
    What I would like to do is specify the location upon runtime when I execute my mapping, but I don't know if this is possible. In addition I'd also want to use the data file location as an input parameter for one of the columns I populated in my target table.
    Then in the end I would be able to use one mapping and read multiple sources files from different locations and also be able to check in the end where the data was loaded from.
    Hope you can give me some more feedback on how to set this up in OWB.
    Many Thanks!
    data file name parameter to ma

  • FTP to IDOC : multiple source files

    Hi experts,
    I finished designing my File-FTP to idoc scenario.
    I still have one question left, I did tests with my FTP by putting one file in the directory called test.xml
    In the case I would have multiple source files (i.e. test2.xml, test3.xml, ...testn.xml), how can I handle these different files to be sent to SAP ???
    Thanks a lots, any help would be appreciated.
    Regards,
    Jamal

    hi,
      If you want to process all the ".xml" files in the folder then just give the file name "*.xml".It will process all
      the xml file in the folder.
      Advanced Selection for Source File:
       If you want to process only the file name will start "a" , "b" and extension is xml then,
       ".xml" is the file name and "a" ,"b*" is the Exclusion Mask.
    Regards,
    Prakasu
    Edited by: prakasu on Aug 7, 2008 12:15 PM

  • How to create a blu-ray disc with multiple source files

    Hello,
    How is it possible to create a blu-ray disc, AVCHD recordable DVD with multiple source files from Final Cut Pro 10. Is it possible to create a menu with several chapters corresponding to the sequences (source files)?
    Thank you in advance for your support.

    Assume you're talking about using the Create Blu-Ray batch template. It's not possible to do with multiple source filles. But if I understand your objectives, you could pretty much get what you think want – discrete movie segments on a single disk with navigation.
    The way I'd approach it is by making multiple projects in FCP and then copying the finished versions into a new project, separated by gaps. (You could also use compound clips but I'm not a fan except for very short sequences, which is why I'm suggesting the copy route.) Then export and bring into Compressor.
    In Compressor mark your chapters at the gaps between your individual sequences. Then choose the AVCHD option in job actions.
    Bear in mind that you'll have to keep the recording time under roughly 30-35 minutes @a5 Mbts/sec
    Good luck.
    Russ

  • How do you compile multiple class files in a unix cmd prompt?

    I have been using Java for a few years now, but for some reason I have a course that requires us to compile/run and hand-in our java assignments using Unix...
    I know how to compile a simple program on unix with a single source file, but how the heck do you compile and run a program with say... 2 or more sources files linked together?
    I really doubt the answer is just type
    javac java1.java
    javac java2.java
    javac java3.java
    and then running the source file with the main in it.
    Hopefully someone here can help me.
    Thanks
    Roger

    okay, well I took some time to read up online how to do this and I guess i'll answer my own post just in case someone else wants to know the answer.
    2 ways I found were:
    1)For example, you can list all of the source file names in a file named sourcefiles. This file might look like:
    MyClass1.java
    MyClass2.java
    MyClass3.java
    You could then run the compiler with:
    % javac @sourcefiles
    2)Or if all the files are in the same directory you can do this:
    This example compiles all the source files in the package greetings.
    % ls
    greetings/
    % ls greetings
    Aloha.java GutenTag.java Hello.java Hi.java
    % javac greetings/*.java
    If that is confusing to read I found all the answers from this webpage:
    http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javac.html

  • Stuck with compiling a source file

    Hi,
    I'm stuck with this strange problem and i desperately need some help.
    My source file is in the D drive inside the package named objectwrite. The source file X.java is extending an abstract class named Y. When i'm trying to compile the files using the command javac objectwrite\ x.java y.java from D drive, it's giving the follopwing error
    javac: invalid flag: ObjectWrite/
    Looking forward for the solution
    Thnks
    Rompom_1

    You have a space between '\' and 'x'

  • Compiling multiple java files present in different packages simultaneously

    Hi,
    I have multiple java files which are present in different folders.
    In some cases, files are importing classes from other packages i.e. some kind of inter-dependency
    How do I compile these java files simultaneously?
    Any help would be highly appreciated.

    Pawan_Anand wrote:
    Hi,
    I have multiple java files which are present in different folders.
    In some cases, files are importing classes from other packages i.e. some kind of inter-dependency
    How do I compile these java files simultaneously?
    Is it circular?
    Thus the dependency is A => B => C => A?

  • Multiple source files to 1 source structure

    Hi Gurus,
    Is grouping of multiple souce files to create one source structure possible?
    EX.
    AAA.csv
    BBB.csv
    CCC.csv
    Then the contents of these files will be merged into one source structure. Can this be done without BPM?
    Thanks!

    Check the wiki page below in addition to above replies.
    http://wiki.sdn.sap.com/wiki/display/XI/MessagemergeusingtheBPM

  • Failed to compile J2EE source files

    Hi all, I'm learning J2EE these days. When I followed the tutorials on how to compile source files,
    eg. 1. In a terminal window, go to the j2eetutorial/examples directory.
    2. Type the following command:
    ant converter
    I got a message with title "16 bit MS-DOS Subsystem" and content
    "C:\WINDOWS\system32\ntvdm.exe
    Error while setting up environment for the application. Choose 'Close' to terminate the application."
    Could anyone tell me what's going on?
    Thanks very much

    The documentation on the javac command has information on the options it provides:
    [http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html]
    Otherwise you could use a tool like Ant to manage the build.

  • Multiple source files

    Hi,
    My client has given me two files for HEADER and ITEM as source
    and receiver has only one structure . can anyone guide my how to  proceed with mapping .Please help me
    FULL POINTS WILL BE AWARDED
    thank u
    Bhasker

    Hey,
        According to your scenario you have two source and one target.
    This is N:1 mapping.
    You need to have a BPM for this.Because without BPM you would be able to configure your message mapping and interface mapping successfully but you will face problem in iterface determination in ID.
    what you need to do is create two DT(structures) for the two source files.
    create two message type.
    refer to both of them in you message mapping(i.e. your message mapping will have two source structure)
    create  a  DT and MT for target file.
    refer to this structure as target in your mapping.
    Do your mapping.
    Now create a BPM.
    you must have two recieve steps.one for each source file.
    you must have a trasnformation step for your mapping (as your mapping is in the transformationstep you dont need an interface determination.)
    then you must have a send step for target file.
    As you have two recieve step you should have a correlation between them.
    refer to this link for correlation.
    /people/sravya.talanki2/blog/2005/08/24/do-you-like-to-understand-147correlation148-in-xi
    i hope the other configuration steps need not be explained.
    reward points if useful,
    regards,
    milan.
    Edited by: Milan Thaker on May 23, 2008 6:15 AM
    Edited by: Milan Thaker on May 23, 2008 6:26 AM

  • Compile multiple mxml file at same time

    hi
    i am working in flex with java.
    i am using more one flex file in my flex project.
    when i execute the project the ant compiled .mxml file only executed.
    the other .mxml files are not executed.
    i have use the destination id  same of two mxml files.
    the ant target is
    <target name="appcompile" depends="install">
      <mxmlc file="${flexsrc.home}/UserRegistration.mxml" context-root="/Reg" keep-generated-actionscript="true" services="${web.home}/WEB-INF/flex/services-config.xml" output="${catalina.home}/webapps/${app.name}/UserRegistration.swf">
       <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
        <include name="${web.home}/WEB-INF/lib/" />
        <include name="${flexsrc.home}/example/" />
       </compiler.library-path>
       <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
       <source-path path-element="${FLEX_HOME}/frameworks" />
      </mxmlc>
    </target>
    <target name="createHtmlWrapper" depends="appcompile">
      <html-wrapper application="${APP_ROOT}/UserRegistration.mxml" height="1000" width="1000"  output="${catalina.home}/webapps/${app.name}" swf="UserRegistration" />
    </target>
    the destination id is camp;
    the error is
    MessagingError message='Destination 'camp' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']
    anyone can help me
    regards
    athi

    It turned out that my Captivate file exceeded 50MB (the
    working “.cp” file) and this causes problems when
    outputting, they tell me at Captivate support, that weird
    corruptions happen. I tried removing the audio from the Flash after
    synchronizing the audio to screen activity, then saving a non-audio
    version, then importing it into Captivate, then importing the audio
    into Captivate. Make sure to check Options/Synchronize to project
    when you import the .swf. That solved the problem for me. Good
    luck!
    Lorin

Maybe you are looking for

  • Making small video "e-mail" with built in iSight

    I am very new to the discussions and I apologize for the newbie question... I travel a lot. I have a new MacBook Pro that has the built in iSight camera. I would like to make little five minute "movie postcards" that I can e-mail to my family to stay

  • MacMini Intel and LG L1915S

    Dear all, I just moved from Mac Mini G4 to Mac Mini Intel Core Solo with 512Mb. I was using with my G4 Mini a 19" LCD Display from LG (model L1915S). I managed to get easily resolution like 1280 * 1024. But since I am on my new Intel Mini I cannot go

  • Mybt history disappeared, duplicate profiles and a...

    Anyone else having problems with their account holder status. got in touch with online chat more than 2 weeks ago, no longer the primary account after hours trying to fix another problem with my account. Pin doesn't work, spent another hour trying to

  • Hour of text?

    When I go to bed, turn off the phone and somebody, during this period that my phone is offline, send me a text,  the hour of the text that I receive is the same when i turn on the phone, not when it was sent? Somebody can help me?

  • Oracle BPM - process correlation

    Hi, I need to model a process in BPM which: checks if other process with certain correlation id exists if yes then send message to that process if not start new process Can anyone tell me how should I check if the process with certain correlation id