package jni.HelloWorld
public class HelloWorld {
private static native void writeHelloWorldToStdout();
public static void main(String[] args) {
System.loadLibrary("HelloWorld");
writeHelloWorldToStdout();
}
}
-------------jni_HelloWorld.h-----------------
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class jni_HelloWorld */
#ifndef _Included_jni_HelloWorld
#define _Included_jni_HelloWorld
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: jni_HelloWorld
* Method: writeHelloWorldToStdout
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_jni_HelloWorld_writeHelloWorldToStdout
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif
----------HelloWorld.c------
include <stdio.h>
#include "com_clarussystems_jni_HelloWorld.h"
JNIEXPORT void JNICALL Java_jni_HelloWorld_writeHelloWorldToStdout(JNIEnv
*env, jclass c)
{
printf("Hello World!");
}
---makefile [needs to change for cross compile] -----------
CC=gcc
JAVAINC =/cygdrive/c/java/jdk1.5.0_11/include
WIN32INC =/cygdrive/c/cygwin/usr/include/w32api
JAVAWIN32INC =/cygdrive/c/java/jdk2me/include/win32
INCLUDE = -I"${JAVAINC}" -I"${WIN32INC}" -I"${JAVAWIN32INC}"
CFLAGS=-mno-cygwin -shared ${INCLUDE} -Wl,--add-stdcall-alias
-L"/usr/lib/w32api" -L"/usr/lib"
DEPS = HelloWorld.c
OBJ = HelloWorld.dll
TARGET=../../../dll
%.dll: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
${OBJ}: $(DEPS)
gcc -o ${TARGET}/$@ $^ $(CFLAGS)
clean:
rm -f ${TARGET}/${OBJ}
so what this means is that you have HelloWorld.so in the system lib path
"/lib/shared" and then you bind to the methods using loadLibrary.
Clay
On July 12, 2:51 pm "ticrus00" <> wrote:
> This is great, but how do you use it? Can you lead me to a tutorial
> or guide that assumes you know nothing about phoneme? I read the
> website, do they not have an environment separate from the build?
> Compile java code and then run it on the tslinux board. I downloaded
> this software but I can't figure it out. I read the getting started
> guide, but it seemed more concerned about compiling it, didn't tell
> me how to run it.
>
> I got j2me that was in the files section, finally running, and it
> uses the command 'cvm HelloWorld'. I do I do this with phoneme? I
> would prefer to use phoneme because it uses java1.4.2 instead of
> 1.3.1. Sorry for all the questions I am new at this. Thanks
>
> Justin
>
>
>
> --- In "lua201068" <> wrote:
> >
> > The CDC Implementation is a fully compliant, Java 2 virtual
> > machine and supports JNI.
> >
> http://wiki.java.net/bin/view/Mobileandembedded/PhoneMEAdvancedCVMNati
> veMethods
> >
> >
> >
> >
> > --- In <cgraham@> wrote:
> > >
> > > I am a java developer so I am very excited by this, but clearly
> I would
> > > like to integrate with C also for all the system stuff. does JNI
> all
> > work
> > > for j2ME?
> > >
> > > Clay
> > >
> > >
> > > On July 12, 11:13 am "lua201068" <lua201068@> wrote:
> > > > J2ME from Sun is now open source. Look at:
> > > >
> https://phoneme.dev.java.net/content/phoneme_platforms.html#phonemeadv
> > > > anced
> > > > I use this successfully on ts7250
> > > >
> > > > Andreas
> > > >
> > > >
> > > >
> > > > --- In "ticrus00" <justin@> wrote:
> > > > >
> > > > > I found j2se 1.3.1 here:
> http://java.sun.com/products/archive/
> > > > > I'm still looking for J2ME cdc 1.0.1. I don't have to use
> j2me is
> > > > > there a way to get jamvm or some other java working in TS-
> linux.
> > > > > Any help is much appreciated.
> > > > >
> > > > > Justin
> > > > >
> > > > >
> > > > > --- In "ticrus00" <justin@> wrote:
> > > > > >
> > > > > > I downloaded the J2ME of the files section list on this
> site. It
> > > > > > worke great but I can't build any programs. It seems Sun
> has
> > > > > > taken down both J2SE 1.3.1 and J2ME CDC 1.0.1. Does
> anyone know
> > > > > > where I can find them? Or lead me to a newer port of
> J2ME of
> > > > > > the TS-7200?
> > > > > > Thanks,
> > > > > > Justin
> > > > > >
> > > > >
> > > >
> > >
> >
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|