Compile with javac

Hi,
I always use JBuilder to compile my programs. Now I tried to compile in the commandprompt. That didn't work so good. The project I tried to compile works fine in Jbuilder. When I compiled in the commandprompt I wrote:
javac Application.java
Application.java is my mainprogram.
I got this error message:
Application.java:42: cannot resolve symbol
Symbol: class MainWindow
location: class Application
MainWindow frame = new MainWindow();
^
Application.java:42: cannot resolve symbol
Symbol: class MainWindow
location: class Application
MainWindow frame = new MainWindow();
^
Isn't MainWindow.java found? The files are in the same folder and I'm standing in the folder when I'm compiling. What is wrong?
/M

search for the program MainWindow.java then change the MS DOS directory - cd:\ etc until this is in the same place
... javac >>>

Similar Messages

  • Compiling with javac

    Hi,
    I have a class: com/easypaygroup/UDF/employee/EmployeeUDF.java
    in directory: C:\dvl.home\env\jboss-4.0.3SP1\server\default\tmp\deploy\tmp43432easyweb-exp.war\WEB-INF\classes
    Now I want to compile my class with javac but i get the error
    error: cannot read: com/easypaygroup/UDF/employee/EmployeeUDF.java
    I'm using
    javac -sourcepath C:\dvl.home..... com/easypaygroup/UDF/employee/EmployeeUDF.java
    I need this to compile my classes on the fly with the command
    Runtime.getRuntime().exec("javac ....");
    Thx in adv,
    Pieter

    In Windows, you need to use the backslash (\) as a directory separator rather than the forward-slash (/)

  • JSP compilation with javac runs out of memory in WL 6.1

    Hello
              I have a problem with JSP compilation in WL 6.1. It throws OutOfMemory exceptions very often. I have set memory settings (-Xms128m -Xmx356m) and WL console shows that there is a lot of free memory, still is does not help.
              Can I use jikes instead of javac ? Latest jikes generates code which is not compatible for JDK 1.3, so it does not work for WL 6.1 either.
              Any suggestions ?
              Maris

    Hi.
    I have checked Java Doc for repeat tag on
    http://e-docs.bea.com/wls/docs61/javadocs/weblogicx/jsp/tags/RepeatTag.html.
    java.lang.Object
    |
    +-javax.servlet.jsp.tagext.TagSupport
    |
    +-javax.servlet.jsp.tagext.BodyTagSupport
    |
    +-weblogicx.jsp.tags.RepeatTag
    According to the API, it should be a tag pair with tag body. I also tried
    your code, I has the exactly the same Error message in browser. I understood
    it is an example from http://e-docs.bea.com/wls/docs61///////pdf/jsp.pdf.
    I strongly suggest you to post this message to news group
    weblogic.developer.interest.jsp instead.
    Thanks.
    BEA Weblogic Support
    "Hans Nemarich" <[email protected]> wrote in message
    news:3bcc8384$[email protected]..
    >
    Hi, I have the following problem when i try to use the weblogic-tags.jarincluded
    with wl6.1. I have copied the file and is referenced by the classpath. I`mtrying
    to run the example included in the docs:
    Parsing of JSP File '/HelloWeblogic.jsp' failed:
    /HelloWeblogic.jsp(15): no corresponding open tag for tag extensionclose: //[
    null; Line: 15]
    probably occurred due to an error in /HelloWeblogic.jsp line 15:
    </wl:repeat>
    ### this is the jsp file: ###
    <html>
    <head>
    <%@ taglib uri="weblogic-tags.tld" prefix="wl" %>
    <title>Hello Weblogic</title>
    </head>
    <body bgcolor="#FDF5E6">
    <h2>
    Weblogic Custom Tags
    </h2>
    <hr>
    <wl:repeat id="name" set="<%= new String[] { "sam", "fred", "ed" } %>">
    <%= name %>
    </wl:repeat>
    </body>
    </html>
    ### ...and this the web.xml file: ####
    <taglib>
    <taglib-uri>weblogic-tags.tld</taglib-uri>
    <taglib-location>
    /WEB-INF/lib/weblogic-tags.jar
    </taglib-location>
    </taglib>
    Someone can help me ?

  • Compiling with javac command gives error msg

    HI,
    I'm working on a linux based system and I need java for programming projects but when i want to compile a project, I get the error:
    1. WARNING in Og05_08.java
    (at line 8)
            public class Og05_08 extends Applet implements ActionListener
                         ^^^^^^^
    The serializable class Og05_08 does not declare a static final serialVersionUID field of type long
    1 problem (1 warning)I think it has something to do with the compiler and not with the programming.

    It's a warning, not an error. From the API:
    The serialization runtime associates with each serializable class a version number, called a serialVersionUID, which is used during deserialization to verify that the sender and receiver of a serialized object have loaded classes for that object that are compatible with respect to serialization. If the receiver has loaded a class for the object that has a different serialVersionUID than that of the corresponding sender's class, then deserialization will result in an InvalidClassException. A serializable class can declare its own serialVersionUID explicitly by declaring a field named "serialVersionUID" that must be static, final, and of type long:
    ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;
    If a serializable class does not explicitly declare a serialVersionUID, then the serialization runtime will calculate a default serialVersionUID value for that class based on various aspects of the class, as described in the Java(TM) Object Serialization Specification. However, it is strongly recommended that all serializable classes explicitly declare serialVersionUID values, since the default serialVersionUID computation is highly sensitive to class details that may vary depending on compiler implementations, and can thus result in unexpected InvalidClassExceptions during deserialization. Therefore, to guarantee a consistent serialVersionUID value across different java compiler implementations, a serializable class must declare an explicit serialVersionUID value. It is also strongly advised that explicit serialVersionUID declarations use the private modifier where possible, since such declarations apply only to the immediately declaring class--serialVersionUID fields are not useful as inherited members.
    ~

  • Can't compile with Javac in jdk 1.2.1

    Hi all,
    I used javac to compile "helloworld.java" in jdk 1.2.1 but It didn't "helloworld.class" file and it also didn't alert.
    my system platform Is:Windows 2000 server
    Jdk:1.2.1
    anyone help me to resolve my problem.
    thanks a lot
    anhnt

    Anhnt,
    If I understand you correctly, you say that you tried to compile "helloworld.java" using "javac", and it didn't create a "helloworld.class" file and you got no error messages, right?
    Are you using an IDE? Or did you manually enter the "javac" command via a command window? What was the exact command you entered?
    Good Luck,
    Avi.

  • ER unable to compile using javac with java 1.3.1 library (JDEV 10.1.3.0.4)

    Hi !
    When I try to compile in JDev with javac and the java 1.3.1 library, I get the following error :
    Error: javac: invalid flag: -source
    The command line generated by JDev looks like :
    C:\jdk1.3.1_03\bin\javac.exe -J-mx512m -verbose -deprecation -source 1.3 -target 1.3 -encoding Cp1252 -g -classpath [...] -sourcepath [...] -d [...] @C:\DOCUME~1\user\LOCALS~1\Temp\javac54193.tmp
    It seems that -source and -target flags do not exist in this version of javac.
    But it does not seem possible to remove these flags generated by JDev, so I'm unable to compile with javac 1.3.1 and JDev.
    So i'm looking for :
    - A workaround to prevent JDev from adding the -source and -target flags.
    - A future release of JDev where you could disable these flags, or, much better, where JDev automatically disables these flags when it detects a 1.3.1 library (there may be other incompatible flags I did not mention).
    Thank you for your answers :)

    Hi,
    when you open the project properties and choose the compiler option to tht the compiler to "javac" and then the "source" and "target" to 1.3, wouldn't this compile it for Java 3? I don't think that it is necesary to use JDK 1.3 for compiling the sources
    Cross-Compilation Options
    By default, classes are compiled against the bootstrap and extension classes of the platform that javac shipped with. But javac also supports cross-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation. It is important to use -bootclasspath and -extdirs when cross-compiling; see Cross-Compilation Example below.
    -target version
    Generate class files that will work on VMs with the specified version. The default is to generate class files to be compatible with the 1.2 VM in the Java 2 SDK. The versions supported by javac in the Java 2 SDK are:
    1.1
    Ensure that generated class files will be compatible with 1.1 and VMs in the Java 2 SDK.
    1.2
    Generate class files that will run on VMs in the Java 2 SDK, v 1.2 and later, but will not run on 1.1 VMs. This is the default.
    1.3
    Generate class files that will run on VMs in the Java 2 SDK, v 1.3 and later, but will not run on 1.1 or 1.2 VMs.
    1.4
    Generate class files that are compatible only with 1.4 VMs.
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html
    Frank

  • Compiles well with eclipse but not with javac

    Hello.
    I am using Windows XP and eclipse 3.0.2.
    I have j2sdk-1_4_2_07-windows also.
    I built class files from the code below with eclipse.
    On jre, It silently runs and exits as expected.
    But when compiled with javac, It does not.
    It dumps a stack trace.
    Which compiler is right?
    public class ANullPointerException {
         private Object o = new Object();
         private Sub sub = new Sub();
         private abstract static class Super {
              protected abstract Object access();
              private Super() {
                   access();
         private class Sub extends Super {
              protected Object access() {
                   return o;
         public static void main(String[] args) {
              new ANullPointerException();
    }the stack trace was as below
    java.lang.NullPointerException
         at ANullPointerException.access$200(ANullPointerException.java:1)
         at ANullPointerException$Sub.access(ANullPointerException.java:15)
         at ANullPointerException$Super.<init>(ANullPointerException.java:9)
         at ANullPointerException$Super.<init>(ANullPointerException.java:5)
         at ANullPointerException$Sub.<init>(ANullPointerException.java:13)
         at ANullPointerException$Sub.<init>(ANullPointerException.java:13)
         at ANullPointerException.<init>(ANullPointerException.java:3)
         at ANullPointerException.main(ANullPointerException.java:20)
    Exception in thread "main" I found 3 class files built by eclipse. They were
    ANullPointerException$Sub.class,
    ANullPointerException$Super.class and
    ANullPointerException.class.
    No missing or extra files found, I think.
    But I found 4 class files built by javac. They were
    ANullPointerException$1.class,
    ANullPointerException$Sub.class,
    ANullPointerException$Super.class and
    ANullPointerException.class.
    I do not know why ANullPointerException$1.class is needed.
    Thank you in advance.

    I found the answer myself.
    I have been setting the eclipse's .class file compatibility to 1.4.
    But it is not javac's default.
    So all I need to do is javac -target 1.4 ANullPointerException.java.
    Sorry for a noise

  • Finding javax package with javac

    Hi
    I have just installed j2sdk1.4.0_03 and Tomcat 4.1, using it as a JSP/servlet loocalhost. The installation wooks fine but when I try to compile with javac, the javax package can�t be found.
    This is the change I have made to autoexec.bat �
    set PATH=%PATH%;C:\j2sdk1.4.0_03\bin
    set CLASSPATH=.;C:\j2sdk1.4.0_03\src.zip
    Obviously the javax package is not included in src.zip but when I use, for example page import javax.servlet.* in a jsp-file that is compiled by Tomcat, it is found.
    So, how do I get javac to find the javax package?
    Thanks in advance / regards pg

    to run servlets you need to add the servlet.jar in your classpath. servlet.jar comes with most servlet runners like tomcat.

  • Compiling with Windows XP

    I've just installed J2SE 1.4.0 and am having problems with the classpath. I've tried setting it as explained in the Help section on the java.sun site, however I still get the error message:
    'javac' is not recognised as an internal or external command, operational program or batch file
    How exactly should I go about setting the classpath and what is the format that it should take?

    I have a same proplem when compiling with Windows XP.
    I set
    PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32
    Wbem;C:\j2sdk1.4.0_01\bin.Could you please tell me
    more about this problem. Thanks a alot!Open a console window.
    Type the following command
    set
    Verify that the PATH looks like what you think it does. If it doesn't fix it.
    Then do this
    cd C:\j2sdk1.4.0_01\bin
    set PATH=.
    javac -?
    If you still get the same error then something is wrong with the install. Examine the bin directory. There should be a number of exe files in it including javac.

  • NoSuchMethodError compiling with 1.4 and running on 1.3

    Hi community,
    I have a little problem with code like the following when mixing both JDK versions:
    StringBuffer sb1 = new StringBuffer();
    sb1.append(new StringBuffer());In 1.3 this is linked to append(Object) and in 1.4 to the newly added append(StringBuffer) which does not exist in 1.3. The code compiles fine with both versions, but if compiled under 1.4 and run in 1.3 this throws NoSuchMethodError(as it should, of course).
    I understand why it is so, the question is if there is an easy way to overcome this problem. I played with the target option of javac without success(javap shows it is always linked as stated), also I read a bit in the JLS to make sure I am right why the exception is thrown.
    I see the following choices:
    1. Compile with 1.3. Not a good idea because all other our products are developed and run in 1.4;
    2. Ask the customers to upgrade to 1.4. There is some their reason for which they still stick to 1.3 and don't want to upgrade, we can't force them do it;
    3. Find such places in code and explicitly cast. But who will know what other cases like the above exist in the code. I can find where append(StringBuffer) is used in the code, but what about other methods of other JDK classes? And it is a bad idea because somewhere in time it will anyway run with 1.4.
    My question is if there is another easier option that I am missing at the moment.
    Thanks for you time and cooperation
    Mike

    Why is option 1 bad? You will be able to run it in 1.4 even if you compiled it using 1.3, so I don't see the problem? It will never run in 1.3 if you can't compile it in 1.3.Because it will always be a source of errors. Always there will be someone that will not set up their project to use 1.3 for compile or will deconfigure it while working with the other projects. Besides that as I stated source compiles fine in both versions, I don't have a compiletime problem, but a runtime one.
    I know this is the most reasonable option, I know what I would choose among the three listed above, I needed some confirmation if I have missed an option.
    and you are correct about the target flagI only mentioned the target tag just as one of the directions of my search, we always whine for others not putting effort in their problems ;)
    Thanks for opinions
    Mike

  • How to determine if class was compiled with debugging information?

    How may I determine if class was compiled with debugging information? Aside from actually executing the class in a debugger.

    As known, when compiling "javac -g ..." the class
    files contain debugging information.
    my Naive question is WHAT is this information?
    could you please add any links to articles about this
    debugging information?http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#22856
    http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#5956

  • Use JAXP 1.3 with javac from JDK 1.4.2?

    I can use JAXP 1.3 with java from 1.4.2 SDK, by setting java.endorsed.dirs, e.g. java -DJava.endorsed.dirs=.... Is there a way to do the same with javac?
    Or, can I compile java with JDK 1.4 that makes use of classes from JAXP 1.3?
    Note that I can't rely on putting jars in the endorsed directory, it must be configurable.

    I was just apprehensive about the fact that my 3G turned into a very slow and almost useless device when I upgraded to 4.0 and later versions... and feared that the 3GS would be the same.

  • Compiling with two CPU cores

    Is it possible to compile with two or more CPU cores or just with one?
    As it seems, javac uses only one core when I compile with the Ant tasc "javac".

    I don't know of a way to do this, but I've never seen a need to do this either, since java compilation is never too slow for me (even for huge projects).
    If you seriously need faster compilation, you could switch to a faster compiler (jikes is seriously fast, ecj (the eclipse compiler) is even faster, sometimes).
    You might also try compiling seperate (independent) parts of your sourcecode with explicit parallel constructs in ant ('though I don't know if it's worth the overhead).

  • Compilation with packages is different in J2SE 1.4.1 ?

    Hi there !
    I've just installed J2SE 1.4.1_01 in my Win NT 4.0 computer.
    Some of the files that belong to packages compiled just fine with JDK 1.2.2 but don't compile with J2SE 1.4.1_01.
    The same is true when I try to compile Java2D in the demo\jfc directory.
    In project NumberFormatTest I have the following classes:
    =====================================================================
    d:\MyPrograms\Java\NumberFormatTest\NumberFormatTestFrame.java
    package NumberFormatTest;
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import java.text.*;
    import java.util.*;
    import tools.*;
    public class NumberFormatTestFrame extends Frame
    implements ActionListener, KeyListener, WindowListener
    =====================================================================
    d:\MyPrograms\Java\Tools\JCTextField.java
    package tools;
    import java.awt.*;
    public class JCTextField extends TextField
    =====================================================================
    d:\MyPrograms\Java\Tools\JCDecimalTextField.java
    package tools;
    import java.text.*;
    import java.util.*;
    public class JCDecimalTextField extends JCTextField
    d:\MyPrograms\Java>javac Tools\JCTextField.java
    compiles OK
    d:\MyPrograms\Java>javac Tools\JCDecimalTextField.java
    does not compile successfully with the error,
    Tools\JCDecimalTextField.java:67: cannot resolve symbol
    symbol : class JCTextField
    location: class tools.JCDecimalTextField
    public class JCDecimalTextField extends JCTextField
    pointing to the J in JCTextField
    d:\MyPrograms\Java>javac NumberFormatTest\NumberFormatTestFrame.java
    also doesn't compile with with "cannot resolve symbol" errors, when it tries to use JCDecimalTextField.
    It seems to me that classes defined by me to extend another class defined by me (JCDecimalTextField) and inside a package (tools) aren't being found by javac.
    However JCTextField is defined by me, extends TextField (from java.awt.*), is inside package tools and compiles OK.
    This stuff didn't happen in JDK 1.2.2.
    What the hell has changed with J2SE 1.4.1 ???
    My PATH has C:\Program Files\jdk\bin (among other directories)
    My CLASSPATH is
    D:\MyPrograms\Java;C:\Program Files\jdk\lib\tools.jar;C:\Program Files\Java\j2re1.4.1_01\lib\rt.jar;.;
    I strongly suspect that something has changed after JDK 1.2.2 in the way packages are handled by javac. I've tried searching in forums and other sun java documentation but couldn't find an answer to my problem.
    Can anyone please help me ?
    Any hint, suggestion or Internet site with appropriate documentation, would be highly appreciated as a means to end this 2 day nightmare.
    Thanks in advance,
    MGoncalv

    This issue has already been solved.
    J2SE 1.4.1 is case sensitive with regard to package directories.
    My tools package files must in subdirectory tools (but not Tools).
    This problem didn't happened with JDK 1.2.2
    For more details please take a look at
    Cannot resolve symbol
    from Feb 10, 2003 11:46
    by MGoncalv

  • -Xlint warning when compiling with command prompt.

    1 of the method i write in the program has a compilation warning when compiling with command prompt. When i compile the codes with the application i used to write the program has no error at all. Below is my code:
    private static ArrayList readNum(String NumFile)
    ArrayList key = new ArrayList();
    String keyAttributes = readInput(NumFile);
    StringTokenizer stk = new StringTokenizer(keyAttributes);
    while(stk.hasMoreTokens())
    key.add(stk.nextToken());
    return key;
    When i javac the program with -X;int, this errror occured:
    warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.ArrayList
    key.add(stk.nextToken());
    ^
    1 warning
    Anyidea how to solve this problem? Thanks for the help.

    A quick google for that message would have told you that you're not using generics and the compiler complains about that.
    Google for "Java Generics" to find out what all the fuss is about.

Maybe you are looking for

  • Mail server setup problems

    we are in the process of setting up a SL mail server and have pretty much everything running nicely, except mail. our setup is as follows: • previous email provider mx records are still active but have allocated higher priority to new server's mx rec

  • BPM Scenario: Message has error status on outbound side

    Hi All,         I am doing one BPM scenario. In my scenario i am collecting 12 different type of idocs in BPM and bundling these idocs and sending these to the 12 different files.         If i send 12 idocs from the R/3 then my scenario is working pe

  • Loading XML file using sql*loader (10g)

    Hi Everyone.... I have a major problem. I have a 10g database and I need to use sql loader to load a large XML file into the database. This file contains records for many, many customers. This will be done several times and the number of records will

  • Dreamweaver Help | Working with the Spry Menu Bar widget

    This question was posted in response to the following article: http://helpx.adobe.com/dreamweaver/using/spry-menu-bar-widget.html

  • Expdp fails with error ORA-39006: internal error writing on a windows share

    Hi! I need to get the following configuration working: Linux Server (CentOS 5 32 bits) with Oracle 11.2.0.1.0 Windows Server 2003 SP2 32 bits. On the windows server I have created a user called oracle, who is member of oinstall and dba groups. (On Li