 }
 
 get_field_from_offset = (rs, cls, offset) ->
+  classname = cls.this_class.toClassString()
   until cls.fields[offset]?
-    throw "field #{offset} doesn't exist in class #{cls.this_class}" unless cls.super_class?
+    unless cls.super_class?
+      util.java_throw rs, 'java/lang/NullPointerException', "field #{offset} doesn't exist in class #{classname}"
     cls = rs.class_lookup(cls.super_class)
   cls.fields[offset]
+
+get_value_from_offset = (rs, obj, offset) ->
+  if obj.type instanceof types.ArrayType
+    return obj.array[offset.toInt()]
+  f = get_field_from_offset rs, rs.class_lookup(obj.type), offset.toInt()
+  return rs.static_get({class:obj.type.toClassString(),name:f.name}) if f.access_flags.static
+  obj.fields[f.name] ? 0
+
+set_value_from_offset = (rs, obj, offset, value) ->
+  o = offset.toInt()
+  if obj.type instanceof types.ArrayType
+    obj.array[o] = value
+  else
+    f = get_field_from_offset rs, rs.class_lookup(obj.type), o
+    if f.access_flags.static
+      rs.push value
+      rs.static_put({class:obj.type.toClassString(),name:f.name})
+    else
+      obj.fields[f.name] = value
 
 stat_file = (fname) ->
   try

            throw new util.YieldException (cb) ->
              setTimeout(cb, millis.toNumber())
      ]
      Throwable: [
        o 'fillInStackTrace()L!/!/!;', (rs, _this) ->
            # we aren't creating the actual Java objects -- we're using our own
            # representation.
            _this.fields.$stack = stack = []
            # we don't want to include the stack frames that were created by
            # the construction of this exception
            for sf in rs.meta_stack.slice(1) when sf.locals[0] isnt _this.ref
              cls = sf.method.class_type
              attrs = rs.class_lookup(cls).attrs
              source_file =
                _.find(attrs, (attr) -> attr.constructor.name == 'SourceFile')?.name or 'unknown'
              line_nums = sf.method.get_code()?.attrs[0]
              if line_nums?
                ln = _.last(row.line_number for i,row of line_nums when row.start_pc <= sf.pc)
              else
                ln = 'unknown'
              stack.push {'op':sf.pc, 'line':ln, 'file':source_file, 'method':sf.method.name, 'cls':cls}
            _this.ref
      ]
    security:
      AccessController: [
        o 'doPrivileged(L!/!/PrivilegedAction;)L!/lang/Object;', doPrivileged

        o 'staticFieldBase(Ljava/lang/reflect/Field;)Ljava/lang/Object;', (rs,_this,field) ->
            rs.set_obj rs.get_obj(field.fields.clazz).fields.$type
        o 'getObjectVolatile(Ljava/lang/Object;J)Ljava/lang/Object;', (rs,_this,obj,offset) ->
            get_value_from_offset rs, obj, offset
        o 'getObject(Ljava/lang/Object;J)Ljava/lang/Object;', (rs,_this,obj,offset) ->
            get_value_from_offset rs, obj, offset
        o 'putOrderedObject(Ljava/lang/Object;JLjava/lang/Object;)V', (rs,_this,obj,offset,new_obj) ->
            set_value_from_offset rs, obj, offset, (new_obj?.ref or 0)
      ]
    reflect:
      NativeMethodAccessorImpl: [
