File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes More help on java modifications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "More help on java modifications" Watch "More help on java modifications" New topic

More help on java modifications

Troy Johnson

Joined: Sep 24, 2003
Posts: 20
Hello. Thanks for everyones assistance on this problem. Again, I am working on making two modifications to the program. The first is to Ignore cases, which I have successfully completed. The second is to Use a command-line argument. I have utilized suggestions on using the command-line argument into the program and have implemented them into my program. My program compiles, but I get the following error message when I run the application: Exception in thread "main" java.lang.NoSuchMethodError: main. Could anyone offer any more suggestions or insight on this. Thanks.
Here is my code before using the command-line argument:

Here is my code after using a command-line argument, which I get the NoSuchError method when trying to run the application.

[ October 12, 2003: Message edited by: Troy Johnson ]
[ October 12, 2003: Message edited by: Troy Johnson ]
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Only the "Palindrome" class has a main(), so you can only run that class -i.e., "java Palindrome". If you try to run "problem" you'll get this error. (Not sure what the other class is for, actually.)

[Jess in Action][AskingGoodQuestions]
Wirianto Djunaidi
Ranch Hand

Joined: Mar 20, 2001
Posts: 210

Actually the second code does not compile, because the main() method is in Palindrome class and it was declared with default access modifier. Instead you have your problem class declared as public.
You should declare your Palindrom class as public instead of problem.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
You only need that part of code I posted in your other thread, and run it with an argument
Troy Johnson

Joined: Sep 24, 2003
Posts: 20
Michael, thanks for your help. I guess I am still a little unclear on running an argument to that code? Thanks.
I agree. Here's the link:
subject: More help on java modifications
It's not a secret anymore!