very basic java programming question

Under Linux when I try to execute the following code:

import java.io.*;

public class c
{
public static void main(String[] args)
{
System.out.prinln("Some output...");
}
}

the java command prints the message: invalid class name.
under windows it gives an Exception. In both cases it compiles. Could someone help me, please?

Comments

  • Hey Buddy

    i compiled ur program under unix , all that it is missing is a t in the word prin_ln which will make it println . and the compiled class rund perfectly after that . Hope this helps . Incase u still have problem mail to me .

    Himschwet
  • : Under Linux when I try to execute the following code:
    :
    : import java.io.*;
    :
    : public class c
    : {
    : public static void main(String[] args)
    : {
    : System.out.prinln("Some output...");
    : }
    : }
    :
    : the java command prints the message: invalid class name.
    : under windows it gives an Exception. In both cases it compiles. Could someone help me, please?
    :

    Hi,

    Well there is only one small slip of typing (a.k.a tongue)
    change
    System.out.prinln
    to
    System.out.println

    The output method of PrintStream is println and not prinln

    Regards,

    G. Nagraj
  • Thank you, but I wrong typed when I posted the msg. Even with the well-typed name there is the problem. Under Linux/Windows compiles but does not run:under linux there is a message and under windows an Exception. Knows someone if there is a problem of configuration?
    Thank you!
  • : Thank you, but I wrong typed when I posted the msg. Even with the well-typed name there is the problem. Under Linux/Windows compiles but does not run:under linux there is a message and under windows an Exception. Knows someone if there is a problem of configuration?
    : Thank you!
    :
    Try this....

    Move into the directory where you have the java exe located(c:jdk1.4in or /usr/local/jdk1.4/bin),Then type this
    [code]
    java -cp [full path to your java class] [class name]
    [/code]
    I dont think java can find your class file. If this works you need to set the system classpath to point at the directory where you put your classes.

    Hope this works for you, if not let us know.

    Ken
  • : Under Linux when I try to execute the following code:
    :
    : import java.io.*;
    :
    : public class c
    : {
    : public static void main(String[] args)
    : {
    : System.out.prinln("Some output...");
    : }
    : }
    :
    : the java command prints the message: invalid class name.
    : under windows it gives an Exception. In both cases it compiles. Could someone help me, please?
    :
    hello
    well i dont haqve any knowledge abt linux but i jhave compile d ur program under windows and teh problem is in the println() method , in it "t" is missing and then it is giveing the same output as one can guess. the reason might be the imnport of java(if there is any) .For these kind of simply programs i never import java classes. Only when i need buffer input, i import them
    thanks
    fyne
  • Another way would be to run it like this...

    java ./classname

    in case you don't have permission to write in the /usr/local/jdk1.4/bin directory

    -Supergibbs

    : : Thank you, but I wrong typed when I posted the msg. Even with the well-typed name there is the problem. Under Linux/Windows compiles but does not run:under linux there is a message and under windows an Exception. Knows someone if there is a problem of configuration?
    : : Thank you!
    : :
    : Try this....
    :
    : Move into the directory where you have the java exe located(c:jdk1.4in or /usr/local/jdk1.4/bin),Then type this
    : [code]
    : java -cp [full path to your java class] [class name]
    : [/code]
    : I dont think java can find your class file. If this works you need to set the system classpath to point at the directory where you put your classes.
    :
    : Hope this works for you, if not let us know.
    :
    : Ken
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories