Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2008
    Posts
    4
    Rep Power
    0

    Default trouble with a class

    Hi:

    I have a problem with the following class:

    import java.io.*;

    public class CCadenas
    {
    //turn String into UpperCase chars
    static void LowecaseUppercase(char[] str)
    {
    int i=0, desp = 'a'-'A';
    for(i=0;1<str.length&&str[i]!='\0';i++)
    if (str[i]>='a'&&str[i]<='z')
    str[i]=(char)(str[i]-desp);
    }

    public static void main(String[]args)
    {
    char[]cadena=new char [80];//character String
    int car, i=0; //a character and subindex for matrix

    try
    {
    System.out.println("Type in a character string:")
    while ((car=System.in.read())!='\r'&&i<cadena.length)
    cadena[i++]=(char)car;

    \\turn Lowercase into Uppercase
    LowercaseUppercase(cadena);//calling method
    System.out.println(cadena);
    }
    catch(IOException ignorada) {}
    }
    }

    when I run it I get the following message:

    C:\PRUEBAS>javac CCadenas
    javac: invalid flag: CCadenas
    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 used
    -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

    It seems like an error in trying to find the class in my folder but my class is on the correct classpath and everything and my question is if you could give me an idea on what the problem might be considering this list of errors I get.

    Thanks in advance!!

  2. #2
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    7

    Default

    When you compile a Java program you have to include the .java:

    javac CCadenas.java
    Once it compiles without errors, you can run as follows:

    java CCadenas
    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  3. #3
    Join Date
    Jul 2008
    Posts
    4
    Rep Power
    0

    Default

    Thank you so much!
    Man! sometimes the answer is simply staring you in face isn't it?

    thank you for your words of encouragement studying java is really also about lots of motivation.

Similar Threads

  1. Here comes trouble... :-)
    By sargehendricks in forum Introductions
    Replies: 1
    Last Post: 04-23-2009, 03:18 PM
  2. Having trouble understanding Class Graphic
    By Bernard Robitaille in forum JCreator
    Replies: 1
    Last Post: 04-18-2009, 02:55 AM
  3. Trouble with ImageIO
    By sari in forum New To Java
    Replies: 1
    Last Post: 03-30-2009, 09:42 PM
  4. hi there got alittle trouble
    By justime8 in forum New To Java
    Replies: 7
    Last Post: 12-24-2008, 12:22 AM
  5. having some trouble
    By Unknown1369 in forum New To Java
    Replies: 13
    Last Post: 07-21-2008, 11:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •