You should not use SYS for this.
With a regular user, you can simply provide the username/password@address.
To do this with SYS, without the password:
Create the class:
C:\Users\Administrator>copy con Hello.java
public class Hello
{
public static String world()
{
return "Hello World";
}
}
^Z
1 file(s) copied.
C:\Users\Administrator>type Hello.java
public class Hello
{
public static String world()
{
return "Hello World";
}
}
C:\Users\Administrator>set JAVA_HOME=O:\oracle\base\product\12.2.0\dbhome_1\jdk
C:\Users\Administrator>set PATH=%JAVA_HOME%\bin;%PATH%
C:\Users\Administrator>javac Hello.java
C:\Users\Administrator>jar cvf Hello.jar Hello.class
added manifest
adding: Hello.class(in = 273) (out= 209)(deflated 23%)
Connect to pluggable database without password:
C:\Users\Administrator>sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Fri Nov 9 16:18:34 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> alter session set container=pdb1;
Session altered.
Load the class:
SQL> exec dbms_java.loadjava('C:\Users\Administrator\Hello.jar');
PL/SQL procedure successfully completed.
SQL> select owner, object_name, object_type, status, created
from dba_objects where object_name = 'Hello';
OWNER OBJECT_NAM OBJECT_TYPE STATUS CREATED
---------- ---------- ----------------------- ------- ---------
SYS Hello JAVA CLASS INVALID 09-NOV-18
SQL> alter java class "Hello" compile;
Java altered.
SQL> select owner, object_name, object_type, status, created
from dba_objects where object_name = 'Hello';
OWNER OBJECT_NAM OBJECT_TYPE STATUS CREATED
---------- ---------- ----------------------- ------- ---------
SYS Hello JAVA CLASS VALID 09-NOV-18
Clean up the mess:
SQL> drop java class "Hello";
Java dropped.
core-1.7.jar??? I hope you are not trying to upgrade/downgrade the JVM that is inside the DB. Also, have you tried using SQL*Developer to load thejar?