I'm not able to compile my programs

From the beginning i write the program and then i save it in C:\jdk1.3.1_02\bin\ as FirstApplet.java. I then go to dos and type: javac FirstApplet.java I get the above error. I dont know what to change.

is it FirstApplet.java or My Applet.java? What exactly are you typing in? You can't have a class name with a space in it and a public class must be save in a file with the same name.
If you are using Notepad to create the source code, Notepad might be saving your file as FirstApplet.java.txt instead of FirstApplet.java. You might not be able to see this if you look in a Windows folder if the folder is configured to not display file extensions. Go to a DOS window and use the dir command to see if your .java file exists where you think it is. (You need to CD to the directory where the .java file is before using javac, or you need to give javac the path to the file.)

Similar Messages

  • I am not able to compile a program  on my mac...

    I am not able to compile a program  on my mac; i am getting the following message :"Class names, 'ClassName.Java', are only accepted if annotation processing is explicitly requested".  I am new to programming, and I am using a MAC. Any suggestions?  I am typing: "Javac ClassName.Java" at the command prompt.

    You might want to be posting to the developer forum here:
    https://discussions.apple.com/community/developer_forums

  • Not able to compile my program

    Sorry to post a very basic question in this forum, but I am very new to java, and I have just installed J2SDK in my system, which is having Windows 2000 Professional (OS). My question is in which directory (path).... we need to save our (.java) programs... if we have to compile it at C prompt ?, as it is not compiling my program with javac command. I included the bin path in control panel > environments tab, but it didn't help me.
    Many thanks in advance
    Manish

    ahhh simple... windows processes pick up the PATH (et al) a process creation time... close cmd and try again.
    ... and you DO NOT put .java programs in the java system bin directory. That's just sooooo silly it's not funny!
    append :. (colon dot) to the CLASSPATH... classes with no package will compile and run in the present working directory.
    When you get into packages see: The K-Zone: Mastering the Java CLASSPATH

  • Not able to compile java program

    Hi
       I a using Netweaver to deelope the java code.I have written a javaprogram .But when choose the option Run as
    a javaApplication it giving the following error
    Source locator  doesnot Exist:org.eclipse.jdt.debug.ui.javaSourceLocator

    Hi,
    I am able to compile and run perfectly Java programs. The steps goes as:
    1. File --> New --> Project --> Java --> Java Project --> give a <project name> --> Finish
    2. File --> New --> Class --> give a classname, and package name.
    3. Put main method and give a System.out.println("Hello");
    Source code:
    package com.i3l.trg;
    public class HelloWorld {
         public static void main(String[] args)      {
              System.out.println("Hello");          
    4.Goto Run --> Run As --> 2 Java Application.
    5. You will get a output as "Hello" in java console.
    Cheers!!!
    Sukanta Rudra
    PS: Liberally donate points.
    The full source code is

  • I am not able to compile this program because it has an compile error.

    Please identify the problem and offer and/or correct the problem.+_
    Thank you very much for helping a new java wana_be programmer!+_
    Below is the source code:+_
    *===================*_
    import java.awt.*;
    import java.awt.MediaTracker;
    import java.awt.event.*;
    import com.sun.image.codec.jpeg.*;
    import java.awt.image.BufferedImage;
    import java.awt.image.DataBuffer;
    import java.awt.geom.GeneralPath;
    import java.io.*;
    import javax.swing.*;
    import javax.imageio.*;
    import java.net.URL;
    public class JavaPicture{
    public BufferedImage bimg;
    public JFrame shower = new JFrame();
    public ImageIcon imgIcon;
    public Canvas canvas;
    public Image image;
    * Constructor
    public void JavaPicture(){
    //No picture, no values
    public int getWidth(){
    return bimg.getWidth();
    public int getHeight(){
    return bimg.getHeight();
    * Load image
    public boolean loadImage(String filename){
    try{
    /*bimg = null;
    filename = "file://" + filename;
    URL u = new URL(filename);
    File f = new File(u.getPath());
    bimg = ImageIO.read(f);
    Toolkit toolkit = Toolkit.getDefaultToolkit();
                   image = toolkit.getImage(filename);
                   MediaTracker mediaTracker = new MediaTracker(shower);
                   mediaTracker.addImage(image, 0);
                   try
                        mediaTracker.waitForID(0);
                   catch (InterruptedException ie)
                        //The file did not load
                        System.err.println(ie);
                   bimg = new BufferedImage(image.getWidth(null), image.getHeight(null), bimg.TYPE_INT_RGB);
                   Graphics g = bimg.getGraphics();
                   g.drawImage(image, 0, 0, null);
    return true;
    catch (Exception e) {return false;}
    public void createNewImage(int width, int height){
         bimg = null;
         bimg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    public void repaintImage(){
    if (shower.isVisible()){
    imgIcon.setImage(bimg.getScaledInstance(bimg.getWidth(), bimg.getHeight(), Image.SCALE_FAST));
    shower.repaint();
    public void showPictureWithTitle(String s){
    if (shower.isVisible()){
    imgIcon.setImage(bimg.getScaledInstance(bimg.getWidth(), bimg.getHeight(), Image.SCALE_FAST));
    shower.setTitle(s);
    shower.repaint();
    else {
    shower = new JFrame(s);
    imgIcon = new ImageIcon(bimg.getScaledInstance(bimg.getWidth(), bimg.getHeight(), Image.SCALE_FAST));
    shower.getContentPane().add(new JLabel(imgIcon));
    shower.setResizable(false);
    shower.pack();
    shower.show();
    * Saves the image represented by the JavaPicture object onto disk.
    * @param newfilename the file name to save to
    * @exception java.io.IOException raised if the save fails
    public boolean saveImage(String newfilename) throws java.io.IOException
    FileOutputStream out;
    JPEGImageEncoder jpeg;
         File filen;
    try {
         filen = new File(newfilename);
         //if (filen.canWrite()){
              //return false;}
    out = new FileOutputStream(filen);
    catch (Exception e){
    System.out.println("Sorry -- that filename ("+newfilename+") isn't working");
    return false;
    try {
    jpeg = JPEGCodec.createJPEGEncoder(out);
    catch (Exception e) {
    System.out.println("Unable to create a JPEG encoder");
    return false;
    JPEGEncodeParam param = jpeg.getDefaultJPEGEncodeParam(bimg);
    param.setQuality(1.0f,true);
    jpeg.encode(bimg,param);
    out.close();
         return true;
    * Returns the pixel value of a pixel in the picture, given its coordinates.
    * @param x the x coordinate of the pixel
    * @param y the y coordinate of the pixel
    * @return the pixel value as an integer
    public int getBasicPixel(int x, int y)
    // to access pixel at row 'j' and column 'i' from the upper-left corner of
    // image.
    return bimg.getRGB(x,y);
    * Sets the value of a pixel in the picture.
    * @param x the x coordinate of the pixel
    * @param y the y coordinate of the pixel
    * @param rgb the new rgb value of the pixel
    public void setBasicPixel(int x, int y, int rgb)
    bimg.setRGB(x,y,rgb);
    * Returns a JavaPixel object representing a pixel in the picture given its coordinates
    * @param x the x coordinates of the pixel
    * @param y the y coordinates of the pixel
    * @return a JavaPixel object representing the requested pixel
    public JavaPixel getPixel(int x, int y)
    return new JavaPixel(this,x,y);
    * Test Main
    *@param String[] argvs
         public static void main(String[] args)
              JavaPicture p = new JavaPicture();
              //p.createNewImage(100,100);
              //p.showPicture();
    p.loadImage("D:\\public_html\\Apache2\\webroot\\webpage\\atlanta_skyline.jpg");
    p.showPictureWithTitle("Test");
         }

    Try this.
    import java.awt.Canvas;
    import java.awt.Graphics;
    import java.awt.Image;
    import java.awt.MediaTracker;
    import java.awt.Toolkit;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.net.URL;
    import javax.imageio.ImageIO;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGEncodeParam;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
         public class JavaPicture{
         public BufferedImage bimg;
         public JFrame shower = new JFrame();
         public ImageIcon imgIcon;
         public Canvas canvas;
         public Image image;
         Constructor
         public void JavaPicture(){
         //No picture, no values
         public int getWidth(){
         return bimg.getWidth();
         public int getHeight(){
         return bimg.getHeight();
         Load image
         public boolean loadImage(String filename){
         try{
         bimg = null;
         filename = "file://"+ filename;
         URL u = new URL(filename);
         File f = new File(u.getPath());
         bimg = ImageIO.read(f);
         Toolkit toolkit = Toolkit.getDefaultToolkit();
         image = toolkit.getImage(filename);
         MediaTracker mediaTracker = new MediaTracker(shower);
         mediaTracker.addImage(image, 0);
         try
         mediaTracker.waitForID(0);
         catch (InterruptedException ie)
         //The file did not load
         System.err.println(ie);
         bimg = new BufferedImage(image.getWidth(null), image.getHeight(null), bimg.TYPE_INT_RGB);
         Graphics g = bimg.getGraphics();
         g.drawImage(image, 0, 0, null);
         return true;
         catch (Exception e) {return false;}
         public void createNewImage(int width, int height){
         bimg = null;
         bimg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
         public void repaintImage(){
         if (shower.isVisible()){
         imgIcon.setImage(bimg.getScaledInstance(bimg.getWidth(), bimg.getHeight(), Image.SCALE_FAST));
         shower.repaint();
         public void showPictureWithTitle(String s){
         if (shower.isVisible()){
         imgIcon.setImage(bimg.getScaledInstance(bimg.getWidth(), bimg.getHeight(), Image.SCALE_FAST));
         shower.setTitle(s);
         shower.repaint();
         else {
         shower = new JFrame(s);
         imgIcon = new ImageIcon(bimg.getScaledInstance(bimg.getWidth(), bimg.getHeight(), Image.SCALE_FAST));
         shower.getContentPane().add(new JLabel(imgIcon));
         shower.setResizable(false);
         shower.pack();
         shower.show();
         Saves the image represented by the JavaPicture object onto disk.
         @param newfilename the file name to save to
         @exception java.io.IOException raised if the save fails
         public boolean saveImage(String newfilename) throws java.io.IOException
         FileOutputStream out;
         JPEGImageEncoder jpeg;
         File filen;
         try {
         filen = new File(newfilename);
         //if (filen.canWrite()){
         //return false;}
         out = new FileOutputStream(filen);
         catch (Exception e){
         System.out.println("Sorry -- that filename ("+newfilename+") isn't working");
         return false;
         try {
         jpeg = JPEGCodec.createJPEGEncoder(out);
         catch (Exception e) {
         System.out.println("Unable to create a JPEG encoder");
         return false;
         JPEGEncodeParam param = jpeg.getDefaultJPEGEncodeParam(bimg);
         param.setQuality(1.0f,true);
         jpeg.encode(bimg,param);
         out.close();
         return true;
         Returns the pixel value of a pixel in the picture, given its coordinates.
         @param x the x coordinate of the pixel
         @param y the y coordinate of the pixel
         @return the pixel value as an integer
         public int getBasicPixel(int x, int y)
         // to access pixel at row 'j' and column 'i' from the upper-left corner of
         // image.
         return bimg.getRGB(x,y);
         Sets the value of a pixel in the picture.
         @param x the x coordinate of the pixel
         @param y the y coordinate of the pixel
         @param rgb the new rgb value of the pixel
         public void setBasicPixel(int x, int y, int rgb)
         bimg.setRGB(x,y,rgb);
         Returns a JavaPixel object representing a pixel in the picture given its coordinates
         @param x the x coordinates of the pixel
         @param y the y coordinates of the pixel
         @return a JavaPixel object representing the requested pixel
         public JavaPixel getPixel(int x, int y)
         return new JavaPixel(this,x,y);
         Test Main
         @param String[] argvs
         public static void main(String[] args)
         JavaPicture p = new JavaPicture();
         //p.createNewImage(100,100);
         //p.showPicture();
         p.loadImage("D:\\public_html\\Apache2\\webroot\\webpage\\atlanta_skyline.jpg");
         p.showPictureWithTitle("Test");
         } Rasa

  • Could not able to RUN Java Programs in JRE 1.5.08

    hi
    I am using Jdk 1.5.8.
    I don�t have any problem in compiling the files.
    but i could not able to run the program through windows cmd prompt.
    Say name of the java file is newFile (no packages).
    When i try to run the program by using java newFile it raises a ClassNotFoundException.
    it s the same case when try to set any JDBC drivers ..
    is there any problem in my class path settings? Please help me out to fix this problem

    if your current directory is not in the classpath,you should include it in the classpath.
    To do that you can include .(dot) to your classpath variable.
    http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html

  • Not Able to compile Servlet from ?

    Hi All,
    I am not able to compile Servlet from my package:
    1) I Have set the CLASSPATH Variable using below line in System Variables:
    C:\CC4\prog\jakarta-tomcat-4.1.30\common\lib\servlet.jar
    2) Also Set the CATALINA_HOME with value
    C:\CC4\prog\jakarta-tomcat-4.1.30
    as per above setting servlet should be compiled but still i m getting error message:
    1) C:\CC4\prog\jakarta-tomcat-4.1.30\project\classes\com\example>javac ListenerTest
    er.java
    ListenerTester.java:17: cannot resolve symbol
    symbol : class Dog
    location: class com.example.ListenerTester
    Dog dog = (Dog) getServletContext().getAttribute("dog");
    ^
    ListenerTester.java:17: cannot resolve symbol
    symbol : class Dog
    location: class com.example.ListenerTester
    Dog dog = (Dog) getServletContext().getAttribute("dog");
    ^
    2 errors
    2) Error while compiling other file:
    C:\CC4\prog\jakarta-tomcat-4.1.30\project\classes\com\example>javac MyServletCon
    textListener.java
    MyServletContextListener.java:12: cannot resolve symbol
    symbol : class Dog
    location: class com.example.MyServletContextListener
    Dog d = new Dog(dogBreed);
    ^
    MyServletContextListener.java:12: cannot resolve symbol
    symbol : class Dog
    location: class com.example.MyServletContextListener
    Dog d = new Dog(dogBreed);
    ^
    2 errors
    So what could be the posible solution here :
    do reply !!!
    please
    Thanks
    prabhat

    I have added servlet.jar in the classpath. But the program is not compiling.The error message says that it can not find classes like ServletConfig, ServletException, Cookie etc. Please help.

  • Not Able  to Compile Java code

    Hi Java Gurus
    I am not able to compile this code Pl help
    class For {
    public static void main (String [] args) {
    int I = 0;
    show:
         if (I < 2) {
    System.out.print("I is " + I);
    I++;
    continue show;
    }

    class For {
    public static void main (String [] args) {
          for(int i = 0; i < 2; i++){
                  System.out.print("I is " + i);
    }this does the same as your program: the for loop is the best for this, but i agree with the others read some tutorials on loops in java. As posted before java has no concept of the GoTo syntax, loops or recursion are your only options

  • Not able to compile servlet

    Hello
    I would like some one to help me.
    I have WindowsXp professional on my Laptop. I downloaded jdk and I am able to compile and run the core java files.
    I downloaded j2sdk1.4.2_10 from the website www.java.sun.com. and then set the path in the environment variables. But in the command promt I was not able to compile the servlet.
    Could you please guide me about what more has to be done so that The servlet can compile.
    Thanking you

    **MAJOR SPAMMING SCUM BAG ALERT**
    I was puzzled in that you asked a SQL Server question in one post and then in another thread asked a Oracle related question... and then I noticed you had cross posted one of your questions at JavaRanch and I was more annoyed....
    and then I found this....
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=10&t=002447
    You sir -> Michael Byrd -> are a scum sucking dirtbag.
    To quickly explain. Mr. Byrd posts his messages (which he copies wholesale from other posters) so that he can get better google caching for the website listed in his profile.
    This is such scummy behaviour I don't even know what to say. Other than basically everyone that has ever helped you had totally wasted their time.
    You are scum. Your company is scum. I hope you rot in hell.

  • Not able to compile wrapped package bodies.

    Hi All
    Can anybody pls help me finding me the reason why I m not able to compile .plb (wrapped package body). There are no compilation errors. But when I run the .plb file (as @xyz.plb), sqlplus window hangs. No error shown. Everytime I had to close the window after waiting for 8-10 minutes.
    This is happening only with 11 files out of 200.Rest were compiled.
    Any ideas? Do we have any other way to wrap than using pl/sql wrap utility or pl/sql plug-in for wrapping(which is actually the same as former)??
    ThanksInAdvance!!
    Keep striking the iron until it's hot!

    yes, I did check for locks from pl/sql developer only. No Locks.
    I waited for 10 minutes for a 6 kb .plb file to get compiled. But had to close the session after that.
    I am using oracle 10g, pl/sql developer 7.1.0.1337
    sql*plus Release 10.2.0.2.0

  • NOT able to compile servlet and EE java files

    hi
    i am not able to compile java files of servlet
    it is showing cannot resolve symbol for servlet classes
    since i have installed tomcat j2sdk1.4.2_06 and also facing problem with the classpath since i have to set the classpath everytime as i have already created it in environment variables
    show me the way out

    **MAJOR SPAMMING SCUM BAG ALERT**
    I was puzzled in that you asked a SQL Server question in one post and then in another thread asked a Oracle related question... and then I noticed you had cross posted one of your questions at JavaRanch and I was more annoyed....
    and then I found this....
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=10&t=002447
    You sir -> Michael Byrd -> are a scum sucking dirtbag.
    To quickly explain. Mr. Byrd posts his messages (which he copies wholesale from other posters) so that he can get better google caching for the website listed in his profile.
    This is such scummy behaviour I don't even know what to say. Other than basically everyone that has ever helped you had totally wasted their time.
    You are scum. Your company is scum. I hope you rot in hell.

  • Latest Lithroom 5.6 does not recognize my .cr2 raw file format and Windows 7 it asociates with my older raw plug in in Ps CS5.5. I am not able to change default program for .cr2 in the properties pannel...

    Latest Lithroom 5.6 does not recognize my .cr2 raw file format and Windows 7 it asociates with my older raw plug in in Ps CS5.5. I am not able to change default program for .cr2 in the properties pannel...
    every new released update of Lr from v 5.2 changed somethin in my Windows 7 Professional settings. I am stucked. Can somebody help me please? Many thanks. Andrej

    Hi Jim,
    yes after I imported my .cr2 raw files into new catalog it started to work. Windows 7 still does not recognize them but I can edit them as you said within the Lr5.6 and then export them into .psd or .dng files...as needed.
    I bought Lr5 only because I got present - my new camera Cannon 70D and because my older Photoshop CS5.5 raw plugin does not recognize. cr2 files.
    Many thanks for your help.
    Andrej.

  • I am not able to see any program EXE's (eg: AfterEffect.exe) to run the file

    I have installed software from adobe creative cloud. After installing i am not able to see any program EXE's (eg: AfterEffect.exe) to run the file.
    I am not able to install it again since it shows "installed" in my creative cloud account.
    Please help me out ASAP.

    I have installed software from adobe creative cloud. After installing i am not able to see any program EXE's (eg: AfterEffect.exe) to run the file.
    I am not able to install it again since it shows "installed" in my creative cloud account.
    Please help me out ASAP.

  • I was subscribed to Adobe CC, it ended, i subscribed again and now im not able to open any program, but adobe already charged my credit card

    I was subscribed to Adobe CC, it ended, i subscribed again and now im not able to open any program, but adobe already charged my credit card

    Since this is an open forum, not Adobe support... you need to contact Adobe staff to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"
    -or by telephone http://helpx.adobe.com/x-productkb/global/phone-support-orders.html

  • APP-ALR-04050 Alert was not able to submit concurrent program

    Hi Friends,
    Can someone please help me in solving the below issue?
    I'm using Event alert for submitting a concurrent program based on insertion/updations on po_requisition_headers_all table. This alert is not working when I am creating a Purchase Requisition manually in Requisitions screen, it is not invoking the concurrent program. Check event alert is failing with the error 'APP-ALR-04050 Alert was not able to submit concurrent program'.
    But when I am creating a PR using an interface then the alert is working fine and submitting program.
    oracle version is R12.
    Alert SQL query:
    Select prh.segment1,
              prh.org_id
    into &p_in_pr_num,
            &p_in_org_id
    from po_requisition_headers_all prh
    where prh.authorization_Status IN ('APPROVED','CANCELLED')
    and prh.attribute_category = 'Sales Driven'
    and prh.org_id = :ORG_ID
    and orh.rowid = :ROWID
    Kindy help me in resolving this issue. Thank you in advance.
    Thanks
    Sravana

    Hi Sravana,
    Are you running on 12.0 release? Please provide you environment details.
    Please see:
    Oracle Applications Technology Software Updates, Release 12.0.4 (Doc ID 466974.1)
    Search for: ALERT WITH CONCURRENT REQUEST ACTION ERRORS WITH APP-ALR-4050
    I suggest you raise an SR for the respective issue.
    Thanks &
    Best Regards,

Maybe you are looking for