How to create own Java launcher
Hi, I need to create native launcher for Java in C, C++ or Objective-C. It doesn't matter, but C++ is preferred. I have Java application which access Keychain and I need to have my own process - not java or JavaStubApplication.
I have this code:
JavaVM *jvm = NULL;
JNIEnv *env = NULL;
jint err = JNI_OK;
JavaVMInitArgs vm_args;
JavaVMOption options[1];
options[0].optionString = "-Djava.class.path=LauncherTest.jar";
vm_args.version = JNIVERSION_14;
vm_args.nOptions = option_count;
// vm_args.options = options;
vm_args.ignoreUnrecognized = JNI_FALSE;
jclass startClass = NULL;
jmethodID mainMethod = NULL;
JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
startClass = env->FindClass("launcherTest/Main");
mainMethod = env->GetStaticMethodID(startClass, "main", "([Ljava/lang/String;)V");
jobjectArray array = NULL;
jsize size = 0;
jobject init = env->NewStringUTF("");
jclass clsString = env->GetObjectClass(init);
array = env->NewObjectArray(size, clsString, init);
if (array != NULL) {
JavaVMAttachArgs attach_args;
attach_args.version = JNIVERSION_14;
attach_args.name ="LaunchThread";
attach_args.group = NULL;
err = jvm->AttachCurrentThread((void**)&env, &attach_args);
env->CallStaticVoidMethod(startClass, mainMethod, array);
err = jvm->DetachCurrentThread();
err = jvm->DestroyJavaVM();
This snip of code works until I don't have any java.awt in java application. When I start to use awt, i get this error:
2009-10-21 09:36:18.292 launcher[1170:a0f] Apple AWT Java VM was loaded on first thread -- can't start AWT.
21.10.2009 9:36:18 launchertest.Main main
SEVERE: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at launchertest.Main.main(Main.java:51)
Caused by: java.lang.InternalError: Can't start the AWT because Java was started on the first thread. Make sure StartOnFirstThread is not specified in your application's Info.plist or on the command line
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1878)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1779)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29)
at java.awt.EventQueue.<clinit>(EventQueue.java:81)
at javax.swing.SwingUtilities.invokeLater(SwingUtilities.java:1264)
at launchertest.Test.main(Main.java:23)
Does anybode have a clue how to solve this? These steps work fine on Windows platform. Any help is appreciated. Thank you.
I found this: http://developer.apple.com/mac/library/samplecode/simpleJavaLauncher/index.html which seems pretty well. It's quite complicated, but works for me. Hope it will help to somebody else.
Similar Messages
-
How to create own evaluation path
Hi Experts
Can anyone of the HR experts let me know how to create own evaluation path to be used in Function Module 'RH_STRUC_GET'.
Thanx,
RahulHi
To maintain evaluation paths, choose the IMG activity SAP Web Application Server ® Business Management ® SAP Business Workflow ® Basic Settings (Organizational management) ® Number range maintenance ® Maintain evaluation paths. When the system is in operation, use transaction OOAW .
Here you will find the maintenance view Change evaluation paths: Overview.
Assign a name to the evaluation path (maximum of eight alphanumeric characters).
Go to the dependent view Evaluation paths (individual maintenance).
Describe the relationship chain to be used for the evaluation.
To establish the permitted relationships for an object type, use report RHRELAT0 .
REWARD POINTS -
How to create own customized screensaver on Windows 7 Embedded Standard sp1
Hi Support,
How to create own customized screensaver on Windows 7 Embedded Standard sp1 OS.
Regards
YASH PAL SINGHThis forum is for POSReady. wES7 forum can be found here:
http://social.msdn.microsoft.com/Forums/en-US/home?forum=quebecmisc
Create the screen saver in Windows 7 first and then put the file in the distribution share to be included in the image. There are tools that can help create a custom screen saver:
http://download.cnet.com/windows/screensaver-editors-and-tools
www.annabooks.com / www.seanliming.com / Book Author - Pro Guide to WE8S, Pro Guide to WES 7, Pro Guide to POS for .NET -
How to create own interface without .cpp file?
how to create own interface without using .cpp file ? To access the method inside the interface .
e.g. ILayoutTarget.
Should not be SDKFileHelper.h because they are using SDKFileHelper.cpp fileRathan,
PLz chk the below link (PDF file)
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d23cbe11-0d01-0010-5287-873a22024f79?quicklink=index&overridelayout=true
Mutti -
How to create own api documentation
hi
i am having my own classes. Is there any method to create the documentation for them in java format. I heard it is possible. If so how to create?
thanksYes, you have to use the "javadoc" binary in java classpath
PS: --help for help over the command -
How to create own site template in sharepoint 2013?
Hi All,
How to create a new site template in SharePoint 2013? Any suggestion please.Create a site the way you want it, then go to Site Settings -> Save Site as Template.
SharePoint - Nauplius Applications
Microsoft SharePoint Server MVP
MCITP: SharePoint Administrator 2010
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
How to create a Java Object dynamically
I want to convert a "DataObject (SDO) " into "Pure java object".
For this i want to create a java object with the fields in Dataobject, and this should be in generic way.I want to convert a "DataObject (SDO) "What is a "DataObject (SDO)"?
into "Pure
java object".What is a "Pure java object"?
For this i want to create a java object with the
fields in Dataobject, What is stopping you? Do you not know how do define a class? Do you think you can add fields to the Object class? If that's what you mean, you're out of luck.
and this should be in generic
way.What do you mean "in generic way"? "Generic" is a very generic term. There are lots of contexts in which it could apply and lots of different possible meanings for "generic way."
You'll have to explain your queston more clearly. -
How to create a .java file through a j2me program?
I am trying to develop a small application in j2me which needs dynamic creation of a .class file. For this purpose I tried to create .java file through my j2me code, but i could not do that..I want to know whether a java file can be created on a mobile phone or not..
I would be grateful to you on your help in this regard.....develop a program xyz.java using j2me which performs the following functionalities:
1.create a file called abc.java
2.extract its class file...For +1+ ie to create a file (any file, no matter java or not) from j2me, device need to support File Connection specified in [jsr 75|http://www.jcp.org/en/jsr/detail?id=75]. If you're interested, learn the jsr API on how to create and manage needed file.
For +2+ described as extract its class file one needs to have java compiler (javac) on device. *) If you're interested, ask for more details at [Java Compiler forum|http://forums.sun.com/forum.jspa?forumID=7]. Also, if the class file is for CLDC then javac needs to support "JDK 1.3-compliant" compilation. To create CLDC classes on device, one also needs to have a preverifier tool. Check this at Java Compiler forum if needed.
Good luck - I think you'll need a lot of it...
*) javac on device -- it should not only be present but also provide a j2me API allowing to invoke it for particular java file with needed options. Same applies to preverifier tool. -
How to create own button for closed captioning
Hi,
I have created my own buttons for play, pause, exit etc. But I do not know how to create button to show closed captioning. I tried few hours but I give up. What I need to do?:
First clik - closed captioning will appear
Second clik - closed captioning will disapear.
And so on appear/disapear/appear/disapear
Help please!
PoulHave a look at: Toggle Shape buttons - Captivate 6 - Captivate blog
Replace the system variable cpCmndMute by cpCmndCC and you'll have the choice between different scenarios. -
How to create own Frame?
Hello,
How to Create My Own Frame, store it as preset and use it any time?
Thanks
DhirajSteps to follow :
1. For creating a frame or theme, you would need to create a psd and a metadata file and place it @ the location : C:\Documents and Settings\All Users\Application Data\Adobe\Photoshop Elements\9.0\Photo Creations\frames for frames and C:\Documents and Settings\All Users\Application Data\Adobe\Photoshop Elements\9.0\Photo Creations\themes for themes.
2. Next you would need to delete the file ThumbDatabase.db3 from C:\Documents and Settings\All Users\Application Data\Adobe\Photoshop Elements\9.0
3. Relaunch Application.
The psd name and metadata file name should be same.
Let me know if this works out for you.
~V -
How to create own customization tree??? similar to 'SPRO' ?
Dear Experts,
Please, Can anyone describe, How to create our own customization tree??? similar to 'SPRO' ?
points will be rewarded.
Thanks in advance!
Warm Regards,
Rahul.You will build your tree IN SPRO (SPRO_ADMIN to be exact)
Look at <a href="http://www.google.fr/url?sa=t&ct=res&cd=2&url=http%3A%2F%2Fhelp.sap.com%2Fsaphelp_nw04%2Fhelpdata%2Fen%2Fc2%2Ff30e5861d411d395df00a0c930dcc1%2Fcontent.htm&ei=nrIHRorRIZjG-QLd5uGBBA&usg=__laIBVCsCn4XKxm6h5xagU0EKmqw=&sig2=fbWzFFnA69HsM_4spK8yiw">IMG Enhancement (SAP Library - IMG Structure Maintenance (BC-CUS))</a> remember it was my entry point some years ago...
Regards -
How to create own server account for servlet application
hi friends..
i have created a servlet page which recieve some data from a j2me program..
i am running this aplication on my pc using http://localhost:8080/mypage
now i want to deploy my j2me program on my mobile phone and need to get data in my servlet page
for this i need to create my own server account for apache but i dont know how to create my own sserver account
please help me out if anyone knows it how to do it...
thanx
kiran_aroraif you want to create your own webitem check out the link given by other sdner.
if you want to be able to execute BW query using abap you can check out the following weblog.
/people/durairaj.athavanraja/blog/2005/12/05/execute-bw-query-using-abap-part-iii
Regards
Raja -
how to create our own idoc ..
plz help me with detail steps and explanations...
thanks in advance.Hi Avi,
Please go through the blog updated by me.
http://theguruspeaksaboutsap.blogspot.com/2007/07/idoc-creation-steps.html
or go through this link
http://www.geocities.com/xplosion78/customised_ALE_IDOC_BY_SACHIN_DABHADE.zip
Reward if helpful.
Regards,
Harini.S -
HOW TO CREATE OWN USER & PASSWARD IN PC?
hi sap guru, i want my user name & my passward in pc, how to create plaez stepwise explain
thanksHi,
Go to SU01 transaction and create a user of you own. -
How to create own tags in JSF?
I am using xhtml, So I need to create own tags for retrieving data from database & query for data. So Just explain me the procedure for doing so. I m using hsql database...
Thanking you
--Mansingh Shitolems_shitole wrote:
I am using xhtml, So I need to create own tags for retrieving data from database & query for data. So Just explain me the procedure for doing so. I m using hsql database...It sounds to me that 1) using are using Facelets and 2) you are looking for a replacement for the JSTL SQL tags. If this is the case, I'll quote the J2EE Tutuorial:
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL7.html says:
The JSTL SQL tags for accessing databases listed in Table 14-8 are designed for quick prototyping and simple applications. For production applications, database operations are normally encapsulated in JavaBeans components.
Maybe you are looking for
-
in the previous version of Number, the menu table in table options, there is an option that gives me the option: the Return key moves to next cell. I do not see this option in the new number. can you help me please?
-
Protocols Monitor We need to develop an agent that is able to detect when a file's transfer using FTS starts and finishes to fire some events. How can we achieve this goal? null
-
Envy IPS 27 Monitor - Flickering
Graetful for any advice. Monitor now started flickering. Manifests as a black screen that flashes on/off each second with faint short coloured lines (based on the picture on the desk top) around the edge of the screen. No changes to system/wires/loca
-
Dear All, when i create complaints in CRM and save it. 1- it didn't replicate to ERP 2- when i try to change in the document. the system appear this error "Document is being distributed; changes are not possible"
-
Apple, are you listening?
I have to ask, what the heck is going on lately? - Not all artists appearing in iPad music player when using home sharing. - Wrong album are in iPad music player when using home sharing. - Wrong movie cover art in iPad video player when using home s