error while editing a java action

0
I have simple java code to start notepad++ and close it. I had just inserted it between the \\BEGIN USER CODE and \\END USER CODE in one of the .java file.   The moment i do it a lot of java error pop up. Below is my code and the errors. Can someone help me plz.   @Override     public Boolean executeAction() throws Exception     {         // BEGIN USER CODE                  package test;         import java.io.IOException;         public class RuntimeExecTest1 {         public static void main(String[] args) {                 try {                     System.out.println("Opening notepad");                     Runtime runTime = Runtime.getRuntime();                     Process process = runTime.exec("notepad");                     try {                         Thread.sleep(5000);                     } catch (InterruptedException e) {                         e.printStackTrace();                     }                     System.out.println("Closing notepad");                     process.destroy();                 } catch (IOException e) {                     e.printStackTrace();                 }             }         }         // END USER CODE Errors 1. Illegal modifier for the local class RuntimeExecTest1; only abstract or final permitted.  2. IOException cant be resolved to a type 3. java.io.IOException cannot be resolved to a variable  4. Syntax error on token, ├»mport", throw expected  5. Syntax error token "package", byte expected 6. The method main cannot be declared static; static methods can only be declared in a static or top level type i have never worked in java before.
asked
2 answers
1

Read this and don't start executables from the server. In the rare cases you are allowed to do it  you will end up with a process somewhere in cloud-space.

answered
0
package test;

        import java.io.IOException;

        public class RuntimeExecTest1 {

        public static void main(String[] args) {

These statements cannot be between //BEGIN USER CODE and //END USER CODE. They need to be defined before that.

 

answered