Results 1 to 10 of 10
Thread: How do I call a 2nd script?
- 02-15-2011, 09:59 AM #1
- 02-15-2011, 10:05 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Do you have two classes for reading and writing your XML files?
- 02-15-2011, 10:29 AM #3
- 02-15-2011, 10:33 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
And do you know how to call a method in a class right?
- 02-15-2011, 11:10 AM #5
- 02-15-2011, 11:23 AM #6
I now got:
And file2 (test file) I try to read in here:Java Code:public class XMLwegschrijven extends Test { public static void main(String[] args) throws Exception {
But here I get the next error:Java Code:public class Test { public static void main(String[] args) { System.out.println("Hi"); } }
XMLwegschrijven.java:18: main(java.lang.String[]) in XMLwegschrijven cannot override main(java.lang.String[]) in Test; overridden method does not throw java.lang.Exception
public static void main(String[] args) throws Exception {
^
1 error./Test.java:2: <identifier> expected
System.out.println("Hi");
^
./Test.java:4: 'class' or 'interface' expected
}
^
./Test.java:4: 'class' or 'interface' expected
}
^
./Test.java:2: cannot find symbol
symbol : class out
location: class java.lang.System
System.out.println("Hi");
^
4 errors
copy output
Program exited with code #1 after 0.42 seconds.Last edited by Lund01; 02-15-2011 at 11:39 AM.
- 02-15-2011, 01:08 PM #7
Are you trying to put a main method inside a class that extends another with a main method? Don't do that. You should have only one main method. You can put it in a separate class to keep things organized.
- 02-18-2011, 11:24 AM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Did you investigate about this?
overridden method does not throw java.lang.Exception
- 02-18-2011, 12:09 PM #9
Having your main method to throw Exception is itself a bad idea. That way, if any exception occurs, it leads to JVM crash and you won't ever come to know what went wrong.
Better way, use try/catch blocks and handle the risks.
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 03-01-2011, 03:13 PM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
Jquery pop out script
By fOmey in forum New To JavaReplies: 1Last Post: 12-03-2010, 02:13 AM -
call by value and call by reference in java
By sandeepsai39 in forum New To JavaReplies: 7Last Post: 08-12-2010, 11:03 AM -
How to call php script using Java
By narik in forum New To JavaReplies: 2Last Post: 01-22-2010, 05:08 PM -
Call java Methods from Python Script
By hofsoc in forum New To JavaReplies: 1Last Post: 02-18-2009, 04:47 PM -
[B] How to call Perl script from Java [/B]
By JavaEmpires in forum Advanced JavaReplies: 7Last Post: 12-19-2008, 03:10 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks