Hello i am currently writing a java program that adds notes.app to the login items in startup for OSX

import java.io.*;
 
public class RuntimeExec {
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
 
 
 
       try{
           String command2= "osascript -e beep";    
           String command = "osascript -e 'tell application \"System Events\" to make login item at end with properties {path:\"/Applications/Notes.app\", hidden:false}'";
 
Process cmd = Runtime.getRuntime().exec(command);
 
 
 
 
       }catch(Exception e){}
 
 
    }
}

when i run command2 it works and gives me a beeping noise as it should however when i run command it does not add notes to the start up but executing the same command without the java formatting prior to " with a \" in terminal it works beautifully

could someone please shed some light on my situation

Many Thanks in advance