--- /dev/null
+RT_JAR ?= /usr/lib/jvm/default-java/jre/lib/rt.jar
+
+all: api_user
+
+java_api.nit:
+ mkdir -p tmp
+ ../../bin/jwrapper -vv -u comment -o java_api.nit $(RT_JAR) \
+ -r "^(java|org)" -i ../../../../lib/java/collections.nit
+ echo "+ Disabled functions: `grep '#\s*fun' $@ | wc -l` / `grep '^\s*fun' $@ | wc -l`"
+
+api_user: java_api.nit
+ # Using --semi-global makes it much faster
+ time -f "%E k:%S u:%U" ../../../../bin/nitc -v api_user.nit --semi-global
+
+check: api_user
+ ./api_user > api_user.res
+ diff api_user.sav api_user.res
+
+check-generated-java: java_api.nit
+ # This may take a while...
+ time -f "%E k:%S u:%U" ../../../../bin/nitc -v api_user.nit --no-cc
+
+ # Don't compile the C only the Java
+ make -C nit_compile Nit_rt.class
+
+.PHONY: api_user java_api.nit
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import java_api
+
+# Get a Java string
+var str = java_lang_integer_to_string_int(5678)
+
+# Do some Java side printing
+var stdout = java_lang_system_out
+stdout.println_int 1234
+stdout.println_String str
+
+# Test a generic list
+var list = new Java_util_ArrayList
+
+print list.is_empty
+assert list.is_empty
+
+print list.size
+assert list.size == 0
+
+list.clear