Javac problems

Hello,
I'm not really that much of a new user, but I need to compile through javac and can't get it to work (I've been dependent on my programming environment before). It will not recognize my jar files. How do I get them to be included?

Also, one more thing: I'm having to use javac because
when I make my program an executable JAR file, it
does not work- I'm thinking this might be due to the
compiler's message:
"Note: Some input files use unchecked or unsafe
operations.
Note: Recompile with -Xlint:unchecked for details."
Could running javac -Xlint:unchecked help fix the
executable jar file problem, in the first place?That is not related to compilation problems. That does only mean that there are parts of the code wich doesn't use generics.
/Kaj

Similar Messages

  • Javac probleme: bad class file error

    I'm new to java
    I have two classes myPoint.jav and TestPoint.java, when I compile them, I error:
    in the command line I type:
    C:\otman\java>javac -g geometry\src\myPoint.java TestPoint.java
    TestPoint.java:8: cannot access myPoint
    bad class file: c:\otman\java\geometry\src\myPoint.class
    class file contains wrong class: geometry.src.myPoint
    Please remove or make sure it appears in the correct subdirectory of the classpa
    th.
    myPoint p = new myPoint();
    ^
    1 error
    Can some one help me Thanks
    //Here is the class c:\otman\java\TestPoint.java
    import geometry.src.*;
         Testing my class Point
    public class TestPoint {
    public static void main(String[] args) {
              myPoint p = new myPoint();
              System.out.println("thank you very much");
              System.exit(0);
    // And here is the class c:\otman\java\geometry\src\myPoint.java
    package geometry.src;
         class myPoint members and methods of a 3D point
    public class myPoint {
         private double m_x,m_y,m_z;          // the coordinates
         public double getx() {return m_x;}
         public double gety() {return m_y;}
         public double getz() {return m_z;}
         public void setx(double x) {m_x=x;}
         public void sety(double y) {m_y=y;}
         public void setz(double z) {m_z=z;}
         public void translate(double dx,double dy, double dz) {
              m_x += dx;m_y += dy;m_z += dz;
         // Constructor ------------------------------------------------------------
         myPoint(double x,double y,double z) {
              m_x=x;m_y=y;m_z=z;
         myPoint() {
              m_x=0;m_y=0;m_z=0;
         myPoint(myPoint p) {
              m_x=p.getx();m_y=p.gety();m_z=p.getz();
    // ---------------------------------------------------------------------------------

    Thank you for the reply but still have problem.
    I created a directory classes and the directories look like:
    C:\otman\java\
    TestPoint.java
    classes\
    geometry\
    src\
    myPoint.java
    When I compile using the line command:
    C:\otman\java>javac -g -d classes geometry\src\myPoint.java TestPoint.java
    I get the error:
    TestPoint.java:8: cannot find symbol
    symbol : constructor myPoint()
    location: class geometry.src.myPoint
    myPoint p = new myPoint();
    ^
    1 error
    Now the directories look like:
    C:\otman\java\
    TestPoint.java
    classes\
    geometry\
    src\
    myPoint.class
    geometry\
    src\
    myPoint.java
    I think that myPoint was compiled without problem but TestPoint was not compiled and it gives 1 error.
    Can you help me? Thanks.<!--Session data-->

  • JDev 10.1.3 and JDK1.2.2 use javac problem

    I have an old application that I need to compile in 1.2.2, and have tried the "use javac" checkbox on the project properties compile page. The compiler seems to run, but there is an intential error in the code. I put it there, because the class file didn't seem to get generated. I tried this on command line, and apparently '-source' is an invalid option in 1.2.2.
    E:\jdk1.2.2\bin\javac.exe -J-mx512m -verbose -source 1.2 -target 1.2 -encoding Cp1252 -g -classpath E:\jdk1.2.2\jre\lib\rt.jar;E:\jdk1.2.2\jre\lib\i18n.jar;E:\jdk1.2.2\jre\classes;E:\app\codebase;E:\oracle\jdev1013\j2ee\home\lib\ojsp.jar;E:\oracle\jdev1013\j2ee\home\jsp\lib\taglib\ojsputil.jar;E:\oracle\jdev1013\j2ee\home\oc4j.jar;E:\oracle\jdev1013\j2ee\home\lib\oc4j-internal.jar;E:\oracle\jdev1013\j2ee\home\lib\servlet.jar;E:\oracle\jdev1013\jdev\lib\ojc.jar -sourcepath E:\app\src -d E:\PTC\Windchill\codebase @C:\DOCUME~1\gteft\LOCALS~1\Temp\javac30279.tmp
    [1:53:55 PM] Successful compilation: 0 errors, 0 warnings.
    Has anyone else run into this?
    Any help or thoughts on how to adjust this behavior for 1.2.2's javac would be appreciated.

    Thank you for responding. I am aware of (and frustrated by) issues and limitations due to this application's dependancies on an aging platform, and would upgrade if it were my choice. The dependancy is in the vendor's API, and not in code that I can change.
    As the invalid option was not captured as a message or counted as an error, I thought that perhaps this could be a potential issue for using javac with any version.
    I was hoping to see if there were additional settings controlling the command line options that I couldn't find.
    Thanks,
    Greg

  • Javac problem

    After installing jdk 5.0 update 5 with net beans, I can't seem to get javac to work. If I go in a directory with several java source files and type "javac main.java" (or whatever class contains the main method), I get "cannot find symbol" errors for every other class in that directory, like it doesn't compile and link the rest of the classes. If I do the same procedure on my laptop, everything compiles perfectly. Any ideas?

    know using javac is super outdated, Uh? No it is not "outdated". I HIGHLY recomend NOT using an IDE (like netbeans) until you can compile using the command line (that is javac).
    I get "cannot find symbol" errors for every other class in that directoryTry javac -cp . Main.java
    As I guess it is down to the fact that you have . in your classpath on one machine, but not the other.

  • Javac problem due to a wrong classpath - WHY?

    Hi,
    this is the initial part of my classpath:
    luca@linux:~> echo $classpath
    :/java/jdk/jre/lib/rt.jar:/java/jikes/rvm/2.3.0.1/rvm.classes:
    As you can see the first entry is the rt.jar, while the second is a wrong path that leads to a directory tree where there are both classes and sources. In particular, under rvm.classes there is a structure similar to the java one, with the java directory, java/lang, etc.
    With this (wrong) classpath, when I try to compile an application, the compiler stops due to problems compiling java.lang.Thread under rvm.classes. I've solved the problem inserting the right classpath in the second entry, but I'd like to know why the compiler asks me to compile Thread since it should be already available from rt.jar (which is the first entry).
    Thanks,
    Luca

    You don't need to put rt.jar in the classpath, the compiler will automatically look there for classes. So perhaps you are confusing the compiler by putting it there. Take it out.

  • Javac Problems on Linux

    I have recently installed jdk1.3.1_01 on suSe Linux 8.0
    Having problems when a program refers to another class file in the same directory, it
    can't find it.
    e.g.
    I am revising an old uni project to create a Vector styled Stack, VectorStack implements the Stack interface.Stack.java, Stack.class, VectorStack.java are all located in the same directory,when compiling VectorStack.java with the verbose switch, it looks immediately to java.util for the Stack class file. In Windows it immediatley goes to the Stack.class file located in the directory. This is the same with all files located in the same directory.
    Can anyone help??

    It's okay, fixed it.
    Just incase anyone else has problems like this on linux:
    The class path was set incorrectly. Differs slightly from DOS, in that you need to tell it to look in the current directory, whereas this is implied with the ; in autoexec.bat
    export CLASSPATH=/javadirectory/classes:/.

  • Javac command in Command Prompt

    When I compile a .java file in Command Prompt I have to write the whole path to javac.exe - "C:\"Program Files"\Java\jdk1.5.0_07\bin\javac.exe PROBLEM.java"
    What do I have to do to so I could write just "javac PROBLEM.java" no mather in which directory I am?
    I also have to say that I can run java.exe from any directory but I can't do so with javac.exe
    Message was edited by:
    vedex

    I believe the location of "javac" inside jdk must be
    specified in systems variable so that he/she can
    compile it and run. His problem is that he wants to type javac MyClass.java rather than C:\jdk\bin\javac.exe MyClass.java In order to do this, he has to alter his PATH variable.
    This has nothing to do with Java. This is true of any executable you want to run without specifying the full path.

  • J Edit need help

    OK i have to type this over again because i looked at formatting help so i am kinda angry...
    I use Jcompiler in jedit during school. But when i tried at home it does not work, it is not tyhe system variables, I use WIndowsXP. The problem is gotten down to creating java bytecode files or .class files. When i create .java files, it does not repilcate a .class files. This is ehy i cannot use javac or java in the cmd prompt but the jcompiler works. Can anyone help me in telling me what i need to do for the jedit to make a .class file a s well. I made a 30sec program for this:
    class try {
         public static void main (String [] args) {
              System.out.println("Hello World");
    }The error i recieve when i try using java haha:
    D:\>java haha
    Exception in thread "main" java.lang.NoClassDefFoundError: haha
    Now i would ask for your help ASAP! thanks

    New news i think it amy be a javac problem even though j compiler works here is the error i recieve when i try javac
    D:\>javac haha
    javac: invalid flag: haha
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are us
    ed
    -classpath <path> Specify where to find user class files
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -d <directory> Specify where to place generated class files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release
    -target <release> Generate class files for specific VM version
    -help Print a synopsis of standard options
    Thanks

  • How can you detect (from a script file) that javac found problems?

    The subject line says it all, but the background is:
    I have a script file (.bat, since am stuck on windoze for the moment) which is doing some compilation using javac.
    I would like to skip all subsequent activities in the script file after the call to javac if any file failed to compile.
    So, what can I use as a signal from javac that it found a problem?
    I initially tried detecting an exit code from javac that was non zero, but javac does not seem to emit such an exit coe when it objects to a file (it still returns with 0 as an exit code).
    The only remaining strategy that I can think of is to pipe javac's output to a file, and if there is any content in it then assume that it indicates an error and use that as a signal.
    This is suboptimal because it will give false signals for mere warnings, so if anyone has a better suggestion, please post

    You are right: it appears that javac does exit with an exit code of 1 if an error is detected in one of the files being compiled, at least on the windows jdk.
    To prove this, create an arbitrary java source file called HelloWorld.java, and create a msdos .bat file in the same directory that looks like
    @echo on
    javac  -Xlint:deprecation  HelloWorld.java
    :handleError
    @if not errorlevel 1 goto finalActions
    @echo ERROR DETECTED: compile.bat will TERMINATE PREMATURELY
    :finalActions
    @echo compile.bat now terminatedBy playing around with what you put in the source file (totally clean code, stuff that should compile but issue a warning, and garbage that should not compile) as well as with the exit code value detected by the .bat file, for instance trying
    @if not errorlevel 2 goto finalActions(see http://www.robvanderwoude.com/errorlevel.html if you need some documentation on error codes in dos bat files), I have determined the following as javac's behavior on windows:
    If code is pristine, exit code = 0.
    If code causes javac to emit a warning but is compilable, exit code = 0.
    If code cannot be compiled, exit code = 1.

  • Problem in executing javac

    I installed jre1.3.1_09 version. when iam trying to execute javac, it says
    "Error: could not find Java 2 Runtime Environment.". i have set the classpath for all the jar files under lib directory. so please suggest me to get rid of this problem.

    This is quite surprising, as javac is not included in the JRE distributions...

  • Javac classpath problem

    I get this error when trying to compile a simple program:
    # javac -classpath .;/mnt/bdrive/MyData.class Test.java
    javac: no source files
    Usage: javac <options> <source files>
    where possible options include:
    ***snip***
    bash: /mnt/bdrive/MyData.class: Permission denied
    It seems to be a problem with specifying more than one thing for the classpath. If I remove the ".;", it works. (I don't need the . in the classpath but I should be able to specify it)

    probably :)
    I originally had just the path and was trying it different ways. If I use just the path instead of the permission denied message, I get this:
    bash: /mnt/bdrive/: is a directory

  • Getting Java set up - javac and PATH problems..

    Just as the title suggests, I am brand new to Java. I am getting the seemingly "classic" newbie Java error in comman prompt: " 'javac' is not recognized as an internal or external command, operable program or batch file." I have read help sites and threads, and I do believe it must be something wrong with my PATH environments, but I can't figure out what. Also, I have tried several different java versions, so I can only believe that my current version is jdk1.6.0_03 (According to the official website I have 6, Version 3). I am running Windows XP (Service Pack 2).
    Here is the exact text as listed in the variable PATH: C:\ WINNT; C:\ WINNT\ SYSTEM32; C:\ jdk1.6.0_ 03\ bin
    I also have another variable called CLASSPATH, which is: .;C:\Program Files\Java\j2re1.4.2\lib\ext\QTJava.zip
    A friend suggested that I learn with DrJava, because he said that is the way he learned, but of course that only helped with learning some basic code, and it only postponed the problem I am now having to face.
    I know I am utterly useless, and I am sure that whatever alien language I just put up there must be just way off base, but please bear with this poor beginner. Any help is useful, literally any, and I am going to wipe any previous thoughts of what I thought was correct away.

    Are you able to set the PATH without any errors on command line ? Or another best way is to set the path in the user and system variables.
    Go to
    MyComputers->Properties->Advanced (tab)and click the
    Environment VariablesAbove you will see
    User variables
    IF there is already a variable name PATH then add the
    C:\jdk1.6.0_03\binElse
    Click the
    New type PATH as the Variable Name
    and the C:\jdk1.6.0_03\bin as the variable value.
    Re-start your command prompt and check with the javac or java commands.

  • Javac command line problem

    Why might the javac.exe, java.exe, and javaw.exe command lines not stay open? When I open these files, the command line flashes open and immediately disappears.
    I tried opening these files using "Run as..." and unchecking the "Protect my computer from unauthorized program activity" option (as my first guess was and still is that I am running into some kind of Windows security settings problem), but this seemed to have no effect.
    I am using Windows XP Professional with all updates as of 06-21-2007.

    You always want to run executables like that and things like .bat files from a command window. To open a command window, follow jverd's post, reply #2.

  • Deployment problem on WLS8.1sp3: com.sun.javac.Main not found

    Hi,
    I have a curious problem, after adding some simple (logging) code to an Session Bean, the EAR file will not deploy. I get the message below concerning compilation problems. If however I restore the Session Bean to the previous state, and having build a new EAR file, the erro persists. What is this strange behaviour, has this to do with weblogic settings for the EAR file of whatever ?
    NB I also have tried to include the tool.lib jar in the projekt but that doesn't solve the problem.
    Any help would be appreciated,
    Harry van Rijn
    Exception:weblogic.management.ApplicationException: prepare failed for UasEJB.jar Module: UasEJB.jar Error: Exception preparing module: EJBModule(UasEJB.jar,status=NEW) Unable to deploy EJB: UasEJB.jar from UasEJB.jar: Compiler class: 'com.sun.tools.javac.Main', not found at weblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:274) at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:476) at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:407) at weblogic.ejb20.deployer.EJBDeployer.runEJBC(EJBDeployer.java:493) at weblogic.ejb20.deployer.EJBDeployer.compileJar(EJBDeployer.java:762) at weblogic.ejb20.deployer.EJBDeployer.compileIfNecessary(EJBDeployer.java:700) at weblogic.ejb20.deployer.EJBDeployer.prepare(EJBDeployer.java:1317) at weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:498) at weblogic.j2ee.J2EEApplicationContainer.prepareModule

    hi,
    i am migrating my application from wls7.0sp2 to wls8.1 sp3. i am using weblogic.ejbc to make my ear in my ant build script.
    My Classpath settings are > C:\bea8.1\weblogic81\server\lib\weblogic.jar;C:\j2sdk1.4.2_08\lib\tools.jar;
    My Path Settings are > C:\j2sdk1.4.2_08\bin;C:\j2sdk1.4.2_08\jre\bin;
    i am getting the error message>>
    [java] Compiler class: 'com.sun.tools.javac.Main', not found
    [java] java.lang.ClassNotFoundException: com.sun.tools.javac.Main
    [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
    [java] at java.security.AccessController.doPrivileged(Native Method)
    [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    [java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    [java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    [java] at java.lang.Class.forName0(Native Method)
    [java] at java.lang.Class.forName(Class.java:141)
    [java] at weblogic.utils.compiler.CompilerInvoker.compileMaybeExit(CompilerInvoker.java:406)
    [java] at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:328)
    [java] at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:336)
    [java] at weblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:270)
    [java] at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:476)
    [java] at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:397)
    [java] at weblogic.ejbc20.runBody(ejbc20.java:517)
    [java] at weblogic.utils.compiler.Tool.run(Tool.java:146)
    [java] at weblogic.utils.compiler.Tool.run(Tool.java:103)
    [java] at weblogic.ejbc.main(ejbc.java:29)
    [java] ERROR: Error from ejbc: Compiler class: 'com.sun.tools.javac.Main', not found
    [java] ERROR: ejbc couldn't invoke compiler

  • Problem wtih deploying EAR: com.sun.javac.Main NOT FOUND

    Hi,
    I have a curious problem, after adding some simple (logging) code to an Session Bean, the EAR file will not deploy. I get the message below concerning compilation problems. If however I restore the Session Bean to the previous state, and having build a new EAR file, the erro persists. What is this strange behaviour, has this to do with weblogic settings for the EAR file of whatever ?
    NB I also have tried to include the tool.lib jar in the projekt but that doesn't solve the problem.
    Any help would be appreciated,
    Harry van Rijn
    Exception:weblogic.management.ApplicationException: prepare failed for UasEJB.jar Module: UasEJB.jar Error: Exception preparing module: EJBModule(UasEJB.jar,status=NEW) Unable to deploy EJB: UasEJB.jar from UasEJB.jar: Compiler class: 'com.sun.tools.javac.Main', not found at weblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:274) at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:476) at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:407) at weblogic.ejb20.deployer.EJBDeployer.runEJBC(EJBDeployer.java:493) at weblogic.ejb20.deployer.EJBDeployer.compileJar(EJBDeployer.java:762) at weblogic.ejb20.deployer.EJBDeployer.compileIfNecessary(EJBDeployer.java:700) at weblogic.ejb20.deployer.EJBDeployer.prepare(EJBDeployer.java:1317) at weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:498) at weblogic.j2ee.J2EEApplicationContainer.prepareModule

    hi,
    i am migrating my application from wls7.0sp2 to wls8.1 sp3. i am using weblogic.ejbc to make my ear in my ant build script.
    My Classpath settings are > C:\bea8.1\weblogic81\server\lib\weblogic.jar;C:\j2sdk1.4.2_08\lib\tools.jar;
    My Path Settings are > C:\j2sdk1.4.2_08\bin;C:\j2sdk1.4.2_08\jre\bin;
    i am getting the error message>>
    [java] Compiler class: 'com.sun.tools.javac.Main', not found
    [java] java.lang.ClassNotFoundException: com.sun.tools.javac.Main
    [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
    [java] at java.security.AccessController.doPrivileged(Native Method)
    [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    [java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    [java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    [java] at java.lang.Class.forName0(Native Method)
    [java] at java.lang.Class.forName(Class.java:141)
    [java] at weblogic.utils.compiler.CompilerInvoker.compileMaybeExit(CompilerInvoker.java:406)
    [java] at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:328)
    [java] at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:336)
    [java] at weblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:270)
    [java] at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:476)
    [java] at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:397)
    [java] at weblogic.ejbc20.runBody(ejbc20.java:517)
    [java] at weblogic.utils.compiler.Tool.run(Tool.java:146)
    [java] at weblogic.utils.compiler.Tool.run(Tool.java:103)
    [java] at weblogic.ejbc.main(ejbc.java:29)
    [java] ERROR: Error from ejbc: Compiler class: 'com.sun.tools.javac.Main', not found
    [java] ERROR: ejbc couldn't invoke compiler

Maybe you are looking for

  • Remote Access VPN Query

    Hi All, I'm looking to setup a Remote Access VPN via my ASA 5510. The clients will be using Cisco Anyconnect (which I assume is compatible...?) When I use the wizard it only mentions Cisco VPN Client. When my clients connect up to the ASA via Anycone

  • How to sync my MacBookAir with my iMac?

    Using the Imac in the office, and MacBookAir for trvelling etc. Wondering if there is a smooth way to keep the 2 in sync (other than using cloud ... not allowed). Currently copying files the hard way (hard disk ...). There has to be a better way? Tha

  • Embed cid font

    i have installed the acrobat asian font pack. I have the stsong font. it is a cid font. Can anybody tell how to embed a cid font in a pdf. I couldn't find any online resources that would help me do this.

  • Logic Merchandise?

    Ok, I really love Logic. A lot. It's funny to feel a real intuitive connection to something like a computer program, but it really is the app I've been looking for, musically, for a very long time. And not only do I love the functionality and flow of

  • What happened to the battery indicator on my ipad's lock screen?

    I've noticed recently that the large green (or red, if low) battery indicator that used to appear on the lock screen when my iPad 2 was plugged in has disappeared.  I have searched in vain for a setting for this, could someone point me in the right d