Compiling a seperate source file package

Hey everyone,
I've been trying to compile a package project for a university assignment for ages now but it just won't work. The assignment is purely about compiling the project in a certain way. The question says:
Create a sub-directory called 'src' which is a child of your main application directory and copy all the source files into this directory.
Which means that it wants this sort of structure:
./program name
./program name/src
./program name/classes
The problem is - no matter what i try it never compiles successfully. What would you suggest i try to compile it?

./program name
./program name/src
./program name/classesI always get an itchy feeling when I see spaces in
pathnames ...
kind regards,
JosSorry, the program name does not have spaces in.
I've also got it working now. Thanks for your reply!

Similar Messages

  • Forte compile error java source files must have a .java suffix

    Hello Guru's,
    I am using Forte for Java release 2.0 build 1160, and Java SDK 1.3.1.
    When I try to compile a project in Forte I get the following error :
    "fastjavac: java source files must have a .java suffix C:\Program"
    I have looked at the source files and they do hav .java suffix!
    If this is not the correct form can someone point me in the right direction. If this is a correct forum then help is very much appreciated.
    Cheers...Harki

    Hi,
    Try to compile like this:
    javac yourfile.java
    Hope this helps you.
    Cheers.....Dinesh

  • Error in compiling the ejb source files......

    hi all,
    it makes me to go mad...
    i have got error sometimes while compiling the ejb java source files and sometimes not...
    i would appreciate anybody for helping me in this problem
    i am using sun application server 8.1 and javac compiler
    i have got the following error
    D:\>path=%path%;c:\j2sdk1.4.2_12\bin;
    D:\>set classpath=%classpath%;d:\Sun\AppServer\lib\j2ee.jar;
    D:\>javac d:\Librarys\Library.java
    D:\>javac d:\Librarys\LibraryBean.java
    D:\>javac d:\Librarys\LibraryHome.java
    d:\Librarys\LibraryHome.java:8: cannot resolve symbol
    symbol : class Library
    location: interface Librarys.LibraryHome
    public Library create(String id, String name, String address, String phoneNo
    ) throws RemoteException, CreateException;
    ^
    d:\Librarys\LibraryHome.java:9: cannot resolve symbol
    symbol : class Library
    location: interface Librarys.LibraryHome
    public Library findByPrimaryKey(String id) throws FinderException, RemoteExc
    eption;
    ^
    2 errors
    D:\>

    hi,
    thanks for ur reply
    i haven't tried the thing given by you
    i will reply u soon after trying out that
    but when i compiled *.java instead of compiling individual files
    everything go fine....

  • 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)

  • *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.

  • Cannot compile source file with Ctrl-F7 in VS 2008

    I have added an existing .cpp file to my project.  When I want to compile
    only one file, I usually press Ctrl-F7, but that does not work on this file (it works on some other source files).  When I pull down the Build menu, the Compile option is missing, like it is when a header
    (*.h) file is active.
    When I right-click on the source file in the Solution Explorer, the context menu shows "Compile\tCtrl+F7"; I can compile a single source file that way, but Ctrl-F7 is so much easier and faster.
    I have tried resetting the keyboard shortcut, resetting the profile to the original C/C++ profile, and closing and reopening Visual Studio, but nothing corrected the issue.
    It feels like VS is not recognizing that my source file is a C++ file, despite its name (something.cpp).  Why has this started happening, and how can I get the shortcut (and Build menu) to reset?

    This happens in the following way.  You manually create a new C++ class in an existing project using the editor in VC++.  You then (with the editor still open) add the file to your project.  Visual Studio finds your class info
    and adds it intellisense, making it seem as though VC++ knows your file is in the project.  However, it does not and ctrl f7 will therefore not work.  Removing and adding the file does not help...unless you close the editor window...in which
    case VC++ will correctly add the file if you remove and add it to your project.
    This is not an uncommon way to create a new class - one does not always use the VC++ create class option.  The manual creation method may be preferable if you are not using automated features from VC++ and instead want to copy some code
    from another file, headers for example.   My view is that this is a VC++ bug that should be repaired; apparently VC++ thinks the file is already included if it is open in the editor rather than checking its file list.  But it is easy
    to work around once you know what is happening.

  • XML to Java source files

    Hi,
    I need to create classes and interfaces for certain elements in my node.xml ( along with a node.dtd).
    In my node.xml I have the following element:
    <exception name="XXNotLockedException">
    <description>The xxxx to be tested was not in administrative state LOCKED.</description>
    <exceptionParameter name="message">
    <dataType>
    <string/>
    </dataType>
    </exceptionParameter>
    </exception>
    from this I want to generate a java source file like below.
    Is it a possible and good way to do it? Or is it the old SAX with events that shall be used?
    I have managed to generate java files but they are only the default ones.
    All help appreciated from more experienced programmers.
    //Mikael
    Source file
    package se.company.xxx.bcm.iface;
    public class XXNotLockedException
    extends se.company.xxframework.XXAccessException
    * Constructor
    public XXNotLockedException()
    super("XXNotLocked");

    I would say using XSLT would be easier to understand than a SAX events program. And more flexible, too, if your requirements changed.

  • Problem compiling source file in package

    Hi, I have 5 source files which I have just packaged together and put in the same sub-directory, the problem is that when I try to compile the file with the main method I get the error message:"cannot read" then the name of the source file. I am compiling from the command line and setting the classpath as I compile with the statement:
    c:\j2sdk1.4.1\bin>javac -classpath c:\directory\package directory source file.java
    I'm not sure what I am doing wrong and the source files all compiled fine before I added the package statement to the files. Please any help would really be appreciated.

    It sounds like the java file your are trying to compile is not in the directory you are compiling from.
    Is this basically what you are doing?:
    Say the package name is mypackage.
    Assume we are O.K. with keeping source and class files together.
    Create a directory named 'mypackage' somewhere...C:\mypackage\.
    Put all the .java files in it (these .java files indicate that they are a member of the 'mypackage' package).
    At a command prompt, cd to the directory containing the 'mypackage' directory...'cd C:\'
    Compile the source files: C:\j2sdk1.4.1\bin\javac mypackage\*.java
    run the main class: C:\j2sdk1.4.1\bin\java mypackage.TheMainClass
    Basically, this says keep the files where you want them and point to javac, instead of moving everything under java/bin. btw it will save a lot of typing if you add java/bin to your PATH.
    Hope this helps.

  • Compiling a package from source files

    I am trying to install a package from source files. The installation instructions for this package say that I should just download the scripts to one directory, enter the correct paths in the Makefile (which comes with the package) and run "make".
    The problem is that while the g++ compiler is there on my computer
    (there is a binary called g++ located at
    /Developer/usr/bin/g++
    I am not sure if that is the real compiler. Or where the c header files are, for instance, I can't find math.h, or stdio.h or any of the other standard files.
    Any help will be greatly appreciated. I am very new to command lines, so please explain as you would to a five year old.
    To help with specifics, I edited the Makefile so that the first part looks like:
    #MATLABDIR ?= /usr/local/matlab
    # for Mac
    MATLABDIR ?= /Applications/MATLAB_R2008b.app
    CXX ?= g++
    #CXX = g++-4.1
    CFLAGS = -Wall -Wconversion -O3 -fPIC -I$(MATLABDIR)/extern/include
    Thanks a ton for the help

    Your compiler program is gcc. (/usr/bin/gcc).
    http://gcc.gnu.org/
    in terminal type (at the prompt):
    gcc --version
    (press return)
    should output the following:
    i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) (dot 1)
    Copyright (C) 2007 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    If it does, your compiler is alive and kicking and ready for action, if not, reinstall developer tools
    package from your SL install DVD.
    The usual ritual for compiling is to drag the directory containing the source code to your desktop,
    then, in terminal, change terminal path to the source directory using the change directory command
    "cd".
    example; say I have a program called cdrtools 2.0.1 and the source is in a folder I dragged to my
    desktop called cdrtools_2.0.1:
    In terminal i would type:
    cd /Users/kj/Desktop/cdrtools_2.0.1
    Follow the instructions that come with the package. Typically they will tell you to:
    ./configure
    ( Many packages have a configure script which will query your system and configure themselves
    appropriately. Not supported by all software).
    make
    ( Compile the software. Some require a file name to build such as make foo. make reads a file
    normally called Makefile for what commands to run).
    make install
    ( Install the software. Typically packages will put themselves in /usr/local. Run as root).
    That is the usual ritual, but you must follow the instructions that come with the software, as they
    may vary.
    Read documentation!
    Look for files called: INSTALL, README, SETUP, or similar.
    For more information see the following:
    http://luv.asn.au/overheads/compile.html
    Now beware that some source code written before Snow Leopard was released may not compile
    properly on SL, because of SL's 64Bit gcc extensions. If the source has not been updated to run
    under the Snow Leopard compiler, then the compilation may fail.
    IF the program fails to compile, or fails to run after compiling, then most likely, then the source
    may need updating.
    good luck, and don't pull all your hair out at once. Save some for later.
    The guys in the 'NIX forum can help you with all the grizzly details as you go on your quest.
    http://discussions.apple.com/forum.jspa?forumID=735
    Good luck,
    Kj ♘

  • 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'

  • Netbeans packages as source files

    Hi,
    I noticed that the Composer in NetBeans 6.9 creates (copies) new sources files in the project when some special components are used (like DataSource).
    For example if a JDBC data source component is added, several files .fx are added in the project under the package "org.netbeans.javafx.datasrc".
    Even if source files are instructive and interesting, I was expecting to have a dedicated components library and not sources file to be compiled.
    They just increase compilation time and final jar dimension (compared to a library released with the JVM).
    Can someone explain me the benefits of this choice ?
    Grazie,
    Gualtiero

    You wrote:
    c:\jarfiles> jar cfm jarfilename.jar c:\com\packages\
    import com.packages.classfilename;What do you notice? The "root" of your JAR is at class level, you forgot to include the directory structure com/packages. So these class files can never be found.
    Move your classes to c:\anemptydir\com\packages\ and run
    jar cfm jarfilename.jar c:\anemptydir
    (Be aware that the m option also requires you to name a manifest file.)
    Now gimme some dukes.

  • Compile source files from multiple subdirectories

    Hi. we know that we can compile multiple source files in a folder with the statement:
    javac -classpath . *.java
    How can we compile multiple source files that belong to different subfolders without using an IDE?
    Example:
    folder1, folder2, & folder3 all have .java source files, and all 3 folders belong to a folder named bigfolder;
    what is the shortest way to compile those source files in one statement like the one above?

    It should work withjavac -classpath your_classpath folder1\*.java folder2\*.java folder3\*.javaJust make sure that your_classpath allows all of the classes to be found.
    It might be better to use the -d option in your case.javac -d path_for_classes folder1\*.java folder2\*.java folder3\*.javaYou just specify the directory into which the .class files and their package directories should go.

  • Do we have to separate java source files and class files after compiled..

    Hi,
    I really confussed with this:
    I have compiled java source files into a package and tried to use but the classes can not be found. Should I separate class and source files after compiled with packages names. I hope you understand what i mean.
    Thank you
    So Jag

    You can choose to separate the source files or not. It sounds like your problem has to do with Classpath and packages.
    If the file c:\base\compute\engine\mysourcefile.java starts with the statement "package engine;" then the fully qualified name of the class is is engine.mysourcefile. If the file c:\base\compute\client\mysourcefile.java starts with the statement "package client;" then its fully qualified name is client.mysourcefile.
    In your source files, whenever you refer to a class from another class, the compiler needs the fully qualified class name. You can either import the class or use the fully qualified name. In order for the compiler to find the class, the c:\base\compute directory must be in the Classpath (assuming the package definitions from above).
    Finally, to launch an application given the above, the command would be "java client.mysourcefile" assuming the main method is in client.mysourcefile.

  • Finding errors in a Coldfusion source file at compile time

    My application is built using Coldfusion, Flex and MySQL as backend. I am using FlexBuilder 3 for editing/compiling the Flex source(MXML and Actionscript) files. For the Coldfusion(CF) source files(cfm and cfc files), I am using Coldfusion Builder to edit the source files since it is an IDE for Coldfusion so using that I can see the CF syntax highlighted and text which is commented. After, I complete editing the Coldfusion source files in Coldfusion Builder I close them in CF Builder. Then, the application is compiled using the Flex Builder, but I cannot see any syntax errors if they exist in the Coldfusion source files and I learn of the errors at run time that there is a tag nesting error.
    After, I edit the Coldfusion source files I close them in CF Builder so that Flexbuilder can compile the project and there is no issue of CF source file being locked due to being open in CF builder.
    1. What can I do to ensure I see the CF errors at compile time?
    2. Is there a better/another method than what I am doing to work on a project which has Flex/CF source files?
    Any advice would be appreciated.
    Thanks

    While you are 'compiling' your application since it has a FLEX front end that is compiled.  This actually does nothing with the ColdFusion files, or at least I can't imagine what it would be doing with those files.
    CFML is just-in-time compiled at run time.  And I do not believe using it in a Flex builder application would change this.
    What I would do in this situation is develop the back-end and front-end separately.  Build the CFML, test it with simple test cases run through direct browser requests of the CFML or some test harness CFML that executes your back-end logic and runs it through it paces.  Once that is built and tested.  Then attach the FLEX front end to it and test that.

  • 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!

Maybe you are looking for

  • New Nokia C5-03..need sol...

    i bought nokia c5-03 on 14-5-11...i want to know sol for few things.... 1.Hanging-whn i type msg and click add contact..it hangs...n if i try to edit any one pic from my gallary..again it hangs..either i hav to lock n lock or switch off it n on.. thn

  • Script does not work after download

    Hi,    I have build a form in SAP enviornment using Adobe Life Cycle designer, while designing I have been using XML datasource and wrote scripts for different events on the elements of the form, the script works perfectly fine while designing, but f

  • Cannot read image file in oracle 10g forms, getting error frm-47100

    I'm unable to read the image from the file location. But If I do re-save via MS-Paint the same image then I'm able to load successfully. I want to load image directly instead of re-save.  Error getting like "frm-47100 Cannot read image file". Need yo

  • Portal via browser 'Service temporarily unavailable' URGENT!

    Hi I've installed portal and its running OK, working through the tutorials when i can find the sample data. but now I can't connect to pls/portal30, or pls/portal30_sso, or pls/admin_/. i think its to do with the gateway settings or mod_plsql, but I

  • Trying to understand how to make a change to a SSIS package

    I was pretty familiar with DTS packages but SSIS packages have me completely lost. Let me start by saying we use TFS (Team Foundation Server) and Visual Studio 2010 for source control and development. I have to make a change which is very simple. I h