1 message in net.java.dev.jna.usersRe: HELP on JNA
FromSent OnAttachments
Timothy WallJun 28, 2007 12:05 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: HELP on JNAActions...
From:Timothy Wall (twal@dev.java.net)
Date:Jun 28, 2007 12:05:51 pm
List:net.java.dev.jna.users

On Jun 28, 2007, at 12:56 PM, <edga@accenture.com> <edga@accenture.com> wrote:

I need to use JNA for a small java class for Oracle Applications, the problem I have is that Oracle Applications 11i uses Jinitiatior … and Jinitiator uses JRE 1.3 …. Is not possible to use higher versions…

JNA is for 1.4, is there a possibility to have something similar for 1.3?

The basic framework is not tied to 1.3. You could tweak the build.xml file to change the compatibility level to 1.3, compile, and see if it works for your needs.

There are a few things that are 1.4-only, but they are not critical to the functionality of the JNA library as a whole. Things like ByteBuffer and (maybe) JAWT linkage, but fundamentally the underlying principles are based on Java 1.2.

What I need to do is just execute an application located in the HD of the user …

Runtime.getRuntime().exec("Notepad") works fine to execute the application, but the problem is when I need to check is the application is already running because in that case what I have to do is set the focus to Notepad.. otherwise I have to execute the exec command…

My class is working for JRE 1.4.2_03, do you have some Idea of how I can use JNA in 1.3 or modify something to have the access to User32 functions without JNI?

My class is:

import com.sun.jna.Pointer;

import com.sun.jna.Native;

import com.sun.jna.win32.StdCallLibrary;

public class test {

public interface MiUser32 extends StdCallLibrary{

MiUser32 INSTANCE = (MiUser32 )Native.loadLibrary ("user32", MiUser32 .class);

com.sun.jna.Pointer FindWindowA(java.lang.String p1, java.lang.String p2);

boolean ShowWindow(com.sun.jna.Pointer p1, int p2);

}

public static void main(String[] args) {

try {

MiUser32 user = MiUser32.INSTANCE;

Pointer Win1 = user.FindWindowA("Notepad", null);

if (Win1 == null) {

Runtime.getRuntime().exec("Notepad");

} else {

user.ShowWindow(Win1, 2);

user.ShowWindow(Win1, 1);

}

} catch (Exception e) {

System.out.println("ERROR NO IDENTIFICADO");

}

}

}

Edgar Carranza

Spain Delivery Center

Accenture Technology Solutions Tel: +34 952 04 58 12 Fax: +34 952 04 78 68 edga@accenture.com