Thanks again, i've tried this:

1. There were 2 Gateways listed on SMP, so i deleted both of them

2. Created a new Gateway using your code, named GW1 and port 7777 (that port was set on a third gateway as service, that  i deleted too, inside the production)

3. All settings on the new GW are correct, it result inactive at first.

4. I've created a completely new java app (with new names on package and class also), to test and copy/past my script class with edited methods

5. Build up the Jar with different name and put it into the folder ready to get uploaded on HS

6. When i call your "UploadJar" i get the following error when it try to connect:

%objlasterror="0 "_$lb($lb(5001,"Can't find the job that is monitoring Gateway 'GW1'",,,,,,,,$lb(,"CORSOESL",$lb("e^zCheckMonitor+20^%                        Net.Remote.Service.1^1","e^zStopMonitor+1^%Net.Remote.Service.1^1","e^zStartGatewayObject+18^%Net.Remote.Service.1^1","e^zConnectGateway+34^%Net                        .Remote.Service.1^1","e^zConnect+4^luigi.JavaGatewayTest.TestGW.1^1","e^zUpdateJar+7^luigi.JavaGatewayTest.TestGW.1^1","d^^^0"))))/* ERRORE #500                        1: Can't find the job that is monitoring Gateway 'GW1' */

7. So i decided to manually activate the GW, and redo your UploadJar and i get this when the code try to stopGateway:

%objlasterror="0 "_$lb($lb("<%ObjectErrors>OK",,,,,,,,,$lb(,"CORSOESL",$lb("e^GetOneErrorText+1^%apiOBJ^1","e^zGetOneErrorText+1^%                        SYSTEM.Status.1^1","e^zLogStatus+1^%Net.Remote.Service.1^1","d^zShutdownGateway+10^%Net.Remote.Service.1^1","e^zStopGatewayObject+22^%Net.Remote                        .Service.1^1","e^zStopGateway+4^%Net.Remote.Service.1^2","e^zUpdateJar+19^luigi.JavaGatewayTest.TestGW.1^1","d^^^0"))))

8. I go to check the namespace, and i see the new package name, with new class name, but inside i still see all the deleted methods.

Here's my current java class with only 2 methods "setAge"  and "getName"

package persona; /**

public class testPersona {     public int age;
    public String name;
    public String sex;     //constructor
    public testPersona (int startAge, String Name, String Sesso) {         this.age = startAge;
        this.name = Name;
        this.sex = Sesso;     }
    
    public void setAge(int newAge) {         age = newAge;
    }     public String getName() {         return name;
    }    /* public static void main(String []args) {         JavaPerson myPerson = new JavaPerson (5, "Tom","M");
        System.out.println(myPerson.getName());
        System.out.println(myPerson.getAge());
        System.out.println(myPerson.getSex());     }*/
}

and this is the HS imported class with all the older methods inside.

 Class persona.testPersona Extends java.lang.Object [ ProcedureBlock ]
{ Parameter IMPORTTIMESTAMP As STRING = "2020-01-16 16:04:52.0"; Method %OnNew(ByRef p0 As %ObjectHandle, ByRef p1 As %ObjectHandle, ByRef p2 As %ObjectHandle, ByRef p3 As %ObjectHandle) As %Status
{
Quit:'$D(p0) $$$OK
Quit:$D(p3) ..%Constructor(p0,"persona.testPersona",3,p1,p2,p3)
Quit:$D(p2) ..%Constructor(p0,"persona.testPersona",2,p1,p2)
Quit:$D(p1) ..%Constructor(p0,"persona.testPersona",1,p1)
Quit ..%Constructor(p0,"persona.testPersona",0)
} Method getName() As %ObjectHandle
{
Quit ..%IR("getName")
} Method setAge(ByRef p0 As %ObjectHandle)
{
Do ..%I("setAge",.p0)
} Method getage() As %Integer
{
Quit ..%Get("getage")
} Method setname(p1 As %ObjectHandle)
{
Do ..%Set("setname",p1)
} Method setsex(p1 As %ObjectHandle)
{
Do ..%Set("setsex",p1)
} Method getsex() As %String
{
Quit ..%Get("getsex")
} }

Ok i will try that, but there's a way to check how many Java Gateways are running? 

On the production i only see the EnsLib.JavaGateway.Service, don't know where to find the ones that i state with your code

Edit:

this is the error on step 4:

%objlasterror="0 "_$lb($lb("<%ObjectErrors>OK",,,,,,,,,$lb(,"CORSOESL",$lb("e^GetOneErrorText+1^%apiOBJ^1","e^zGetOneErrorText+1^%SYSTEM.Status.1^1","e^zLogStatus+1^%Net.Remote.Service.1^1","d^zShutdownGateway+10^%Net.Remote.Service.1^1","e^zStopGatewayObject+22^%Net.Remote.Service.1^1","e^zStopGateway+4^%Net.Remote.Service.1^2","e^zUpdateJar+19^luigi.JavaGatewayTest.TestGW.1^1","d^^^0"))))

Hi, thanks for sharing your code, anyway i still get the same problem. That's what i did :

1. Create a Gateway with your method "CreateGateway" 

2. Then i call the UploadJar method and i get my class import into namespace, i see it with all methods inside (till here it's Ok)

3. I edit my Java app (just removing 1 method) and build a new Jar.

4. Repeat Step 1 and 2 and i get my java class imported into namespace but with all the methods (included the one i've deleted)