rename java run tests from main to runme for consistency across the languages
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10932 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a5d91ce4f1
commit
9cf5256b93
34 changed files with 55 additions and 55 deletions
|
|
@ -353,9 +353,9 @@ The name of the module is specified using the <tt>%module</tt> directive or<tt>
|
|||
To load your shared native library module in Java, simply use Java's <tt>System.loadLibrary</tt> method in a Java class:</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
// main.java
|
||||
// runme.java
|
||||
|
||||
public class main {
|
||||
public class runme {
|
||||
static {
|
||||
System.loadLibrary("example");
|
||||
}
|
||||
|
|
@ -372,7 +372,7 @@ Compile all the Java files and run:
|
|||
|
||||
<div class="code"><pre>
|
||||
$ javac *.java
|
||||
$ java main
|
||||
$ java runme
|
||||
24
|
||||
$
|
||||
</pre></div>
|
||||
|
|
@ -394,12 +394,12 @@ You may get an exception similar to this:
|
|||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
$ java main
|
||||
$ java runme
|
||||
Exception in thread "main" java.lang.UnsatisfiedLinkError: no example in java.library.path
|
||||
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1312)
|
||||
at java.lang.Runtime.loadLibrary0(Runtime.java:749)
|
||||
at java.lang.System.loadLibrary(System.java:820)
|
||||
at main.<clinit>(main.java:5)
|
||||
at runme.<clinit>(runme.java:5)
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
|
|
@ -426,7 +426,7 @@ The following exception is indicative of this:
|
|||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
$ java main
|
||||
$ java runme
|
||||
Exception in thread "main" java.lang.UnsatisfiedLinkError: libexample.so: undefined
|
||||
symbol: fact
|
||||
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
|
||||
|
|
@ -434,7 +434,7 @@ symbol: fact
|
|||
at java.lang.ClassLoader.loadLibrary(ClassLoader.java, Compiled Code)
|
||||
at java.lang.Runtime.loadLibrary0(Runtime.java, Compiled Code)
|
||||
at java.lang.System.loadLibrary(System.java, Compiled Code)
|
||||
at main.<clinit>(main.java:5)
|
||||
at runme.<clinit>(runme.java:5)
|
||||
$
|
||||
</pre></div>
|
||||
|
||||
|
|
@ -3760,7 +3760,7 @@ will produce a familiar looking Java exception:
|
|||
Exception in thread "main" java.lang.OutOfMemoryError: Not enough memory
|
||||
at exampleJNI.malloc(Native Method)
|
||||
at example.malloc(example.java:16)
|
||||
at main.main(main.java:112)
|
||||
at runme.main(runme.java:112)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
|
@ -6168,9 +6168,9 @@ When this module is compiled, our wrapped C functions can be used by the followi
|
|||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
// File main.java
|
||||
// File runme.java
|
||||
|
||||
public class main {
|
||||
public class runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
@ -6196,7 +6196,7 @@ When compiled and run we get:
|
|||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
$ java main
|
||||
$ java runme
|
||||
argv[0] = Cat
|
||||
argv[1] = Dog
|
||||
argv[2] = Cow
|
||||
|
|
@ -6387,9 +6387,9 @@ The following Java program demonstrates this:
|
|||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
// File: main.java
|
||||
// File: runme.java
|
||||
|
||||
public class main {
|
||||
public class runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
@ -6414,7 +6414,7 @@ When compiled and run we get:
|
|||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
$ java main
|
||||
$ java runme
|
||||
1 12.0 340.0
|
||||
</pre></div>
|
||||
|
||||
|
|
@ -6474,7 +6474,7 @@ We get:
|
|||
<div class="code"><pre>
|
||||
Ambulance started
|
||||
java.lang.ClassCastException
|
||||
at main.main(main.java:16)
|
||||
at runme.main(runme.java:16)
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
This example runs the entire gifplot.h header file through SWIG without
|
||||
any changes. The program 'main.java' does something a little more
|
||||
interesting. After doing a make, run it using 'java main'. You'll have to go
|
||||
any changes. The program 'runme.java' does something a little more
|
||||
interesting. After doing a make, run it using 'java runme'. You'll have to go
|
||||
look at the header file to get a complete listing of the functions.
|
||||
|
||||
Note the differences in the main.java files between this example and the
|
||||
Note the differences in the runme.java files between this example and the
|
||||
'full' example. This example does not use shadow classes.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Plot a 3D function
|
||||
import java.lang.Math;
|
||||
|
||||
public class main {
|
||||
public class runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
This example uses the file in ../../Interface/gifplot.i to build
|
||||
an interface with shadow classes. After doing a make, run the program main, ie: 'java main'.
|
||||
an interface with shadow classes. After doing a make, run the program runme, ie: 'java runme'.
|
||||
|
||||
Note the differences in the main.java files between this example and the
|
||||
Note the differences in the runme.java files between this example and the
|
||||
'full' example. This example uses the shadow classes.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import java.lang.Math;
|
||||
|
||||
public class main {
|
||||
public class runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
This is a very minimalistic example in which just a few functions
|
||||
and constants from library are wrapped and used to draw some simple
|
||||
shapes. After doing a make, run the java program, ie 'java main'.
|
||||
shapes. After doing a make, run the java program, ie 'java runme'.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
public class main {
|
||||
public class runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
@ -489,7 +489,7 @@ java_cpp: $(SRCS)
|
|||
# -----------------------------------------------------------------
|
||||
|
||||
java_clean:
|
||||
rm -f *_wrap* *~ .~* *.class `find . -name \*.java | grep -v main.java`
|
||||
rm -f *_wrap* *~ .~* *.class `find . -name \*.java | grep -v runme.java`
|
||||
rm -f core @EXTRA_CLEAN@
|
||||
rm -f *.@OBJEXT@ *@JAVASO@
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
public class main
|
||||
public class runme
|
||||
{
|
||||
static {
|
||||
try {
|
||||
|
|
@ -88,7 +88,7 @@ Note: when creating a C++ extension, you must run SWIG with the <tt>-c++</tt> op
|
|||
|
||||
<h2>A sample Java program</h2>
|
||||
|
||||
Click <a href="main.java">here</a> to see a Java program that calls the C++ functions from Java.
|
||||
Click <a href="runme.java">here</a> to see a Java program that calls the C++ functions from Java.
|
||||
|
||||
<h2>Key points</h2>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// This example illustrates how C++ classes can be used from Java using SWIG.
|
||||
// The Java class gets mapped onto the C++ class and behaves as if it is a Java class.
|
||||
|
||||
public class main {
|
||||
public class runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("example");
|
||||
|
|
@ -20,7 +20,7 @@ to see a SWIG interface with some constant declarations in it.
|
|||
Click <a href="../../../Doc/Manual/Java.html#constants">here</a> for the section on constants in the SWIG and Java documentation.
|
||||
<p>
|
||||
|
||||
Click <a href="main.java">here</a> to see a Java program that prints out the values
|
||||
Click <a href="runme.java">here</a> to see a Java program that prints out the values
|
||||
of the constants contained in the above file.</p>
|
||||
<h2>Key points</h2>
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import java.lang.reflect.*;
|
||||
|
||||
public class main {
|
||||
public class runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("example");
|
||||
|
|
@ -21,7 +21,7 @@ See the documentation for the other approaches for wrapping enums.
|
|||
<ul>
|
||||
<li><a href="example.h">example.h</a>. Header file containing some enums.
|
||||
<li><a href="example.i">example.i</a>. Interface file.
|
||||
<li><a href="main.java">main.java</a>. Sample Java program.
|
||||
<li><a href="runme.java">runme.java</a>. Sample Java program.
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
public class main {
|
||||
public class runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("example");
|
||||
|
|
@ -17,7 +17,7 @@ class CEO extends Manager {
|
|||
}
|
||||
|
||||
|
||||
public class main {
|
||||
public class runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("example");
|
||||
|
|
@ -66,7 +66,7 @@ Here are some files that illustrate this with a simple example:
|
|||
<li><a href="example.c">example.c</a>
|
||||
<li><a href="example.h">example.h</a>
|
||||
<li><a href="example.i">example.i</a> (SWIG interface)
|
||||
<li><a href="main.java">main.java</a> (Sample program)
|
||||
<li><a href="runme.java">runme.java</a> (Sample program)
|
||||
</ul>
|
||||
|
||||
<h2>Notes</h2>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
public class main {
|
||||
public class runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
@ -30,7 +30,7 @@ certain C declarations are turned into constants.
|
|||
<h2>Running the examples</h2>
|
||||
Please see the <a href="../../Doc/Manual/Windows.html">Windows</a> page in the main manual for information on using the examples on Windows. <p>
|
||||
|
||||
On Unix most of the examples work by making the Makefile before executing the program main.java. The Makefile will output the swig generated JNI c code as well as the Java wrapper classes. Additionally the JNI c/c++ code is compiled into the shared object (dynamic link library) which is needed for dynamic linking to the native code. The Makefiles also compile the Java files using javac.
|
||||
On Unix most of the examples work by making the Makefile before executing the program runme.java. The Makefile will output the swig generated JNI c code as well as the Java wrapper classes. Additionally the JNI c/c++ code is compiled into the shared object (dynamic link library) which is needed for dynamic linking to the native code. The Makefiles also compile the Java files using javac.
|
||||
<p>
|
||||
Ensure that the dynamic link library file is in the appropriate path before executing the Java program. For example in Unix, libexample.so must be in the LD_LIBRARY_PATH.
|
||||
<p>
|
||||
|
|
@ -39,7 +39,7 @@ A Unix example:
|
|||
<pre>
|
||||
$ make
|
||||
$ export LD_LIBRARY_PATH=. #ksh
|
||||
$ java main
|
||||
$ java runme
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
public class main {
|
||||
public class runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
@ -18,7 +18,7 @@ This example compares wrapping a c global function using the manual way and the
|
|||
|
||||
<ul>
|
||||
<li><a href="example.i">example.i</a>. Interface file comparing code wrapped by SWIG and wrapped manually.
|
||||
<li><a href="main.java">main.java</a>. Sample Java program showing calls to both manually wrapped and SWIG wrapped c functions.
|
||||
<li><a href="runme.java">runme.java</a>. Sample Java program showing calls to both manually wrapped and SWIG wrapped c functions.
|
||||
</ul>
|
||||
|
||||
<h2>Notes</h2>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
public class main {
|
||||
public class runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
@ -144,7 +144,7 @@ extraction.
|
|||
<ul>
|
||||
<li> <a href="example.c">example.c</a> (C Source)
|
||||
<li> <a href="example.i">example.i</a> (Swig interface)
|
||||
<li> <a href="main.java">main.java</a> (Java program)
|
||||
<li> <a href="runme.java">runme.java</a> (Java program)
|
||||
</ul>
|
||||
|
||||
<h2>Notes</h2>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
public class main {
|
||||
public class runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
@ -121,7 +121,7 @@ Click <a href="example.i">here</a> to see a SWIG interface file with these addit
|
|||
|
||||
<h2>Sample Java program</h2>
|
||||
|
||||
Click <a href="main.java">here</a> to see a Java program that manipulates some C++ references.
|
||||
Click <a href="runme.java">here</a> to see a Java program that manipulates some C++ references.
|
||||
|
||||
<h2>Notes:</h2>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// This example illustrates the manipulation of C++ references in Java.
|
||||
|
||||
public class main {
|
||||
public class runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("example");
|
||||
|
|
@ -65,15 +65,15 @@ to create the extension <tt>libexample.so (unix)</tt>.
|
|||
|
||||
<h2>Using the extension</h2>
|
||||
|
||||
Click <a href="main.java">here</a> to see a program that calls our C functions from Java.
|
||||
Click <a href="runme.java">here</a> to see a program that calls our C functions from Java.
|
||||
<p>
|
||||
Compile the java files <tt><a href="example.java">example.java</a></tt> and <tt><a href="main.java">main.java</a></tt>
|
||||
to create the class files example.class and main.class before running main in the JVM. Ensure that the libexample.so file is in your LD_LIBRARY_PATH before running. For example:
|
||||
Compile the java files <tt><a href="example.java">example.java</a></tt> and <tt><a href="runme.java">runme.java</a></tt>
|
||||
to create the class files example.class and runme.class before running runme in the JVM. Ensure that the libexample.so file is in your LD_LIBRARY_PATH before running. For example:
|
||||
<blockquote>
|
||||
<pre>
|
||||
export LD_LIBRARY_PATH=. #ksh
|
||||
javac *.java
|
||||
java main
|
||||
java runme
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
public class main {
|
||||
public class runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
@ -85,7 +85,7 @@ Note that SWIG parses the templated function <tt>max</tt> and templated class <t
|
|||
|
||||
<h2>A sample Java program</h2>
|
||||
|
||||
Click <a href="main.java">here</a> to see a Java program that calls the C++ functions from Java.
|
||||
Click <a href="runme.java">here</a> to see a Java program that calls the C++ functions from Java.
|
||||
|
||||
<h2>Notes</h2>
|
||||
Use templated classes just like you would any other SWIG generated Java class. Use the classnames specified by the %template directive.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// This example illustrates how C++ templates can be used from Java.
|
||||
|
||||
public class main {
|
||||
public class runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("example");
|
||||
|
|
@ -16,7 +16,7 @@ This example shows how typemaps can be used to modify the default behaviour of t
|
|||
|
||||
<ul>
|
||||
<li><a href="example.i">example.i</a>. Interface file.
|
||||
<li><a href="main.java">main.java</a>. Sample Java program.
|
||||
<li><a href="runme.java">runme.java</a>. Sample Java program.
|
||||
</ul>
|
||||
|
||||
<h2>Notes</h2>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
public class main {
|
||||
public class runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
@ -38,7 +38,7 @@ example.set_foo(12.3);
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
Click <a href="main.java">here</a> to see the example program that updates and prints
|
||||
Click <a href="runme.java">here</a> to see the example program that updates and prints
|
||||
out the values of the variables using this technique.
|
||||
|
||||
<h2>Key points</h2>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import java.lang.reflect.*;
|
||||
|
||||
public class main {
|
||||
public class runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("example");
|
||||
Loading…
Add table
Add a link
Reference in a new issue