Results 1 to 6 of 6
- 01-21-2008, 05:47 PM #1
Senior Member
- Join Date
- Nov 2007
- Posts
- 111
- Rep Power
- 0
Main method throwing specific Exception
The following signature of main method works fine.
When I try to use some specific Exception, main method throws exception.Java Code:public static void main(String[] args) throws Exception {
Exception:Java Code:public static void main(String[] args) throws IOException {
Java Code:Exception in thread "main" java.lang.Error: Unresolved compilation problem: IOException cannot be resolved to a type
- 01-21-2008, 05:57 PM #2
Strange
Hello bugger
I find this very strange, but unfortunately I can't help you. I just want to know why you want your main() method to throw exceptions. You should catch and handle them ultimately in your main() method if you keep throwing them. ;)Eyes dwelling into the past are blind to what lies in the future. Step carefully.
- 01-21-2008, 07:06 PM #3
This works okay.
Java Code:public class Test { public static void main(String[] args) throws java.io.IOException { } }
- 01-22-2008, 03:08 AM #4
Yeah, whenever you see "(something) cannot be resolved to a type" you didn't import it, or it doesn't exist.
- 05-13-2009, 11:45 AM #5
Member
- Join Date
- Mar 2009
- Posts
- 52
- Rep Power
- 0
ofcourse import is the solution or use fully qualified name
- 05-13-2009, 02:34 PM #6
Similar Threads
-
Trouble with factory method - unhandled exception type Exception
By desmond5 in forum New To JavaReplies: 1Last Post: 03-08-2008, 06:41 PM -
Main method with throws Exception
By bugger in forum New To JavaReplies: 3Last Post: 01-07-2008, 02:48 PM -
throwing Exception
By bugger in forum New To JavaReplies: 3Last Post: 11-09-2007, 09:35 PM -
ERROR: Exception in thread "main" java.lang.NoSuchMethodError: main
By barney in forum New To JavaReplies: 1Last Post: 08-07-2007, 07:10 AM -
exception in thred main java.lang.nosuchmethoderror: main
By fernando in forum Java AppletsReplies: 1Last Post: 08-06-2007, 09:11 AM


LinkBack URL
About LinkBacks

Bookmarks