Calling JVM from outside

Hello!
A question of possibly not a common nature: are there any ways I can ask a JVM to run a specific Java code.
For example, when MS IE encounters an applet, it somehow instructs JVM to start up, provide an environment for applet's intercommunication with IE, and execute the applet.
How can I do the same thing in my WinXP program - i.e. to make JVM start up and execute something, possibly - applet, or a kind of bean, or...?
Or, a thinner task: there is a file 'CCC.class' with class CCC containing static member function bool LaunchAnthraxMissile(int targetX, int targetY);
Is there any way for me in my external program (possibly, in C++) to execute this function and examine a result? (without, of course, launching java interpreter with CreateProcess :) )
Thanks,
Slicer

Is there any way for me in my external program (possibly, in C++) You could use JNI.
However it is probably just easier to do a operating system call where the execution string is "java MyClass".

Similar Messages

  • Calling JVM from C native code

    I'd like to call JVM from C native call.
    I work in W2000 enviroment using GCC Cygnus compiler.
    I followed JNI instructions.
    I read in this forum there was a change in JDK, and instead of attaching javai.dll, jvm.dll must be attached.
    Then I made a test using invoke.c example from JDK.
    I built following .bat file:
    gcc -c invoke.c -Id:\jdk1.3.1\include -Id:\jdk1.3.1\include\win32
    DLLTOOL dllname jvm.dll def libjvm.def --output-lib d:\jdk1.3.1\jre\bin\classic\libjvm.a
    c++ -o invoke.exe invoke.o -Ld:\jdk1.3.1\jre\bin\classic -ljvm
    with libjvm.def :
    EXPORTS
    imp_JNI_GetDefaultJavaVMInitArgs@4
    imp_JNI_CreateJavaVM@12
    All seems to work fine, and invoke.exe is generated. But when trying to run it, I get a windows message telling me :
    invoke.exe doesn't find the entry point to imp_JNI_CreateJavaVM@12 in jvm.dll.
    What am I going wrong ?
    Any calling convention issue ?
    Thanks in advance. Ignasi Villagrasa.

    Have a look at http://www.xraylith.wisc.edu/~khan/software/gnu-win32/. It has examples of how to use gcc, java JNI on cygwin and should work on all versions of Windows. It has the command line options for using dlltool.

  • How can I access my Call Handlers from outside line (outside district)

    CISCO VoIP System Info:
    Cisco Unity Connection version: 8.6.2ES25.21900-25
    CM Admin System version: 8.6.2.21900-5 on C200M2 Servers
    Our engineer setup our Call Handlers so that in our to change the recordings on them, you diall 7800 from a phone inside the office, or as he put it in the procedures, from within the district.  Once you dial, you need to enter the user code, password, then the extension of the Call Handler, and we have no problems recording/changing any Call Handlers.  However, due to possible inclement weather approaching in the next few weeks, I was asked how we cna change them from an outside line (manager's home, etc.).  We cannot access from an outside line.  7800 is not a DID, it is simply the extension he assigned to access the call handlers.  I even went so far as to setup a dummy phone and forward it to 7800, but this does not work either.  It forwards to the extension's voicemail.  Is there a way we can access the Call Handlers from an outside line?  Any help would be gretaly appreciated.  Thank you in advance.

    Hey Joseph,
    Go Flames ....errrrrrrrrrrrrrrrrrr maybe not so much
    What you are trying to get to is really just the Greetings Administrator
    conversation and there are multiple ways to get there.
    For example, you can set up a Caller Input off any mailbox (Press 1-9) let's say 7 to
    go to Conversation> Greetings Administrator. So you could set this on the managers mailbox
    and when he calls his own number from home once his greeting
    kicks in he can press 7 to link to the Greetings Administrator conversation
    or
    You could set up a DID DN xxx-xxx-2345 as a CTI-RP and set Call Forward All to reach Unity Connection.
    In this case you will need to use the Forwarded Routing Rules = xxx-xxx-2345 route to
    Greetings Administrator. Make sure to move this rule to the bottom of the list!!
    Cheers!
    Rob
    "Why do the best things always disappear " 
    - The Band

  • Someone calling you from outside the United States

    If my friend calls me from Australia and they use either a land line or a cell phone. Am I going to get charged extra at all even if my plan is older on my cell phone? I only get 500 shared minutes a month at the moment for all types of minutes except M2M. Also what type of minutes am I going to eat (i.e: my everyday plan minutes or roaming) if I am currently in my home state in the US? Also is it going to show up on the bill differently then normal than any other type of call?
    Feedback and such would be much appreciated! Thanks

    Suemac wrote:
    If my friend calls me from Australia and they use either a land line or a cell phone. Am I going to get charged extra at all even if my plan is older on my cell phone? I only get 500 shared minutes a month at the moment for all types of minutes except M2M. Also what type of minutes am I going to eat (i.e: my everyday plan minutes or roaming) if I am currently in my home state in the US? Also is it going to show up on the bill differently then normal than any other type of call?
    Feedback and such would be much appreciated! Thanks
    As long as you are in the US when you receive their call, you will not get charged anything extra for receiving this call.

  • Call variable from outside method

    I have a method for a listSelectionListener with a variable in it called "results", I want to be able to get the information from this variable outside of this method. In my main class alled "gifts" I have a TextArea and I want "results" to be displayed in it but I can't get results into it because it's in a seperate method. Anyone know how I can do this?
    Heres some relevant code:
    public Gifts()
              super( "Spiritual Gift Database" );
              try
                   Class.forName(JDBC_DRIVER);
                   conn = DriverManager.getConnection(DATABASE_URL);
                   stat = conn.createStatement();
                   ResultSet rs = stat.executeQuery("SELECT heading1 FROM demo");
                   Vector vector1 = new Vector();
                   while(rs.next()) vector1.add(rs.getObject(1));
                   container = getContentPane();
               container.setLayout( new FlowLayout() );
                   nameListPanel = new JPanel();
                   statListPanel = new JPanel();
                   buttonPanel = new JPanel();
               nameList = new JList(vector1);
               nameList.setVisibleRowCount( 9 );
                   nameList.setPrototypeCellValue("XXXXXXXXXXXX");
                   nameList.addListSelectionListener(
                        new ListSelectionListener()
                             public void valueChanged(ListSelectionEvent event)
                                  try
                                       ResultSet resultSet = stat.executeQuery("SELECT * FROM demo");
                                       StringBuffer results = new StringBuffer();
                                       ResultSetMetaData metaData = resultSet.getMetaData();
                                       int numberOfColumns = metaData.getColumnCount();
                                       for(int i = 1; i<=numberOfColumns; i++)
                                       results.append(metaData.getColumnName(i) + "\t");
                                       results.append("\n");
                                       while (resultSet.next())
                                            for(int i = 1; i<= numberOfColumns; i++)
                                            results.append(resultSet.getObject(i) + "\t");
                                            results.append("\n");
                                  catch(SQLException sqlException)
                                       JOptionPane.showMessageDialog(null,sqlException.getMessage(),
                                       "Database Error", JOptionPane.ERROR_MESSAGE);
                                       System.exit(1);
                   statList = new JTextArea(results.toString());
                   add = new JButton("Add Entry");

    Declare you variable at the class level instead of the function level, then you can see if from any method in the class.
    Paul

  • Calling jvm from c++ code fails the secnd time

    Hi all,
    i have a dll which calls java code thru jni.
    for the first time i am able to successfully call the jvm.
    when i execute 2nd time jvm crashes
    though i destroy the jvm for the first time.
    looks like it doesnot load all native method.
    below i have listed the verbose of jvm loading secnd time.
    please advice me if i need to use any technique in loading the jvm.
    thanks in advance
    [Dynamic-linking native method java.lang.Float.intBitsToFloat ... JNI]
    [Dynamic-linking native method java.lang.Double.longBitsToDouble ... JNI]
    [Dynamic-linking native method java.lang.Float.floatToIntBits ... JNI]
    [Dynamic-linking native method java.lang.Double.doubleToLongBits ... JNI]
    [Dynamic-linking native method java.lang.Object.registerNatives ... JNI]
    [Registering JNI native method java.lang.Object.hashCode]
    [Registering JNI native method java.lang.Object.wait]
    [Registering JNI native method java.lang.Object.notify]
    [Registering JNI native method java.lang.Object.notifyAll]
    [Registering JNI native method java.lang.Object.clone]
    [Dynamic-linking native method java.lang.Throwable.fillInStackTrace ... JNI]
    # HotSpot Virtual Machine Error, Internal Error
    # Please report this error at
    # http://java.sun.com/cgi-bin/bugreport.cgi
    # Error ID: 455843455054494F4E530E43505000DE
    # Problematic Thread: prio=139238232 tid=0x84c9b58 nid=0x0 runnable
    #

    Hallo,
    if I understand your problem correctly, you are creating the JVM, doing something, calling DestroyJavaVM() and then creating the JVM once more. You cannot do that! See: http://java.sun.com/j2se/1.3/docs/guide/jni/jni-12.html#DestroyJavaVM . The solution is just to create the JVM once, when you first need it. You can then reuse it as offen as you want.

  • Calling JVM from C++

    My biggest dream at the moment is to start Java class "halllo world" from C++. Following environments are being used:Windows 2000, Visual C++ and JBuilder4.0
    I�m running out of ideas and it seems to me the more I look for a solution the more contradictory informations I get. In book CORE JAVA (Sun) they say that i need jni.h .O.K. Included...They also say for windows jvm.dll library is needed..I tried it too ..I have put path to this library in all possible paths in Visual c++..Doesn�t work..I have also made include of jvm.h but then I get errors in windows.h???? on a few pages in internet (ibm..) I have found that in this case for Windows javai.lib is needed..? What�s that suppose to mean???? This library doesn`t exist in JBuilder or anywhere else.
    I�m stuck with this problem for two weeks,working on my diploma and loosing nervs...So please if somebody has at least new ideas or even better knows the solution contact me...Thanks

    I forgot to add what is my biggest problem: Functions as JNI_CreateJavaVM...are not being recognized..I m getting linking errors :Unresolved symbol....JNI_CreateJavaVM...and so on and so on...
    Thanks again ...

  • Q: Calling Methods from Outside Object??

    I am an old VB programmer trying to convert to JAVA.
    I use a Jframe with a listbox to display and store general messages about the program status, etc. It is like a console or running log of events and messages. In VB, I know the form name and just call the function to add strings (frmDisplay.addString("HELP"). What is the best way in JAVA to send messages to this frame object even though the frame does not inherit or extend any of the other objects in the application? I must be missing something basic.
    Thanks,
    Scott
    [email protected]

    1) You can extend JFrame and simply add a method public void addString(String s)
    that does what you want to.
    2) If you want to add something to the list on the Frame you can keep the name of the listbox and directly add to it.
    3) You can extend Frame like in 1 but this time you add a variable
    public listbox (or whatever) lb;
    then you can access it via <framename>.lb and basically use 2) again.

  • Increase JVM heap size when calling it from C++

    I have a program that loads images and only works properly increasing heap.
    java McVImg
    gives me an Out of memory error.
    java -Xmx120M McVImg
    works fine.
    If I want to call JVM from a C++ program using Java native interface,
    How should I increase JVM heap ?
    Thanks in advance. Ignasi Villagrasa.

    I'm trying to do what you told me and it doesn't work.
    I show the C++ code I'm using:
    void JavaParam::LoadJVM()
         JavaVMInitArgs vm_args;
         JavaVMOption options[2];
    jint res;
         vm_args.version = JNI_VERSION_1_2;
    JNI_GetDefaultJavaVMInitArgs(&vm_args);
         if (res < 0)
    fprintf(stderr, " Requested version is not supported\n");
              fputs ("Requested version is not supported\n",traza);
              fflush(traza);
    exit(-1);
         //Establecemos classpath
         //Atencion el classpath ser� el jar
         //options[0].optionString = "-Djava.class.path=..";
         options[0].optionString = "-Djava.class.path=..\\mcjava.jar";
         options[1].optionString = "-Xmx120M";
         //Nuevos argumentos
    vm_args.options=options;
         vm_args.nOptions = 2;
         vm_args.ignoreUnrecognized = JNI_FALSE;
         //Creamos Maquina Virtual Java
    res = JNI_CreateJavaVM(&jvm,(void **)&env,&vm_args);
    if (res < 0)
    fprintf(stderr, "Can't create Java VM: %d\n",(int)res);
              fprintf(traza, "Can't create Java VM RES: %d \n",(int)res);
              fflush(traza);
    exit(1);
         jvm_creada = 1;
    Is that right ?
    Thanks in advance. Ignasi Villagrasa.

  • Webdynpro abap from outside

    Hi Folks,
    I have created a webdynpro abap and it works very well, when I call ist from the application server or inside the network.
    Now I want to call it from outside and I get error " can not display the page".
    The url from inside  is http://server.sap.com:8002/sap/bc/webdynpro/sap/wdt_master_detail?sap-language=DE
    and from outside http://server.sap.com:8002/sap/public/myssocntl?sap-client=001
    I have started all the services.
    Do I have still to configure something?
    Thanks for help.
    RG. Jimbob

    Hi.
    Im new to this Forum but i have the same Problem.
    I cannot open the ABAP WEBDYNPRO from Outside of my network.
    Configuration
    - Apache reverse proxy in DMZ (running well)
    - EP 7.01 in DMZ
    - ABAP SOLMAN in local Network
    I can access the Portal from Outside (http://service.myportal.de/irj) and use it. But if I open a iView with ABAP Webdyndpro i receive the Error "Page cannot be found".  Looks like that the iView try to open the internal URL from SOLMAN.
    What can I do to solve this problem.
    Thanks for any Idea.
    Regards
    Sven

  • Manage Auto Attendent Prompts from Outside Network

    Is it possible to manage, edit, change auto attendant prompts in CME from outside network i.e.: calling in from outside line?
    Any help would be greatly appreciated!

    Hi Dave Kallweit,
    We don't have not a option modify from prompt thru TUI :-).
    Regards,
    Mohammed Noor

  • Unlimited europe from outside europe?

    If I have unlimited europe or one country minutes, can I call Europe from outside Europe ( for example Asia or Africa)?

    oas71 wrote:
    I don't remember if it used to cover other Russian cities
    Hello
    No it didn't.
    TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
    I recommend that you always run the latest Skype version: Windows & Mac
    If my advice helped to fix your issue please mark it as a solution to help others.
    Please note that I generally don't respond to unsolicited Private Messages. Thank you.

  • How can i call a plugin from outside of Acrobat Pro.?

    Hello All,
    Is it possible to call acrobat pro plugins from outside of Acrobat Pro.? I believe it is definitely possible.
    I am not able to get any pointers on this. Can someone suggest any pointers on this.
    Thanks.

    The plugins that come with Acrobat or custom ones that you write yourself?
    Custome ones. 
    Call them in what way?
    Through an executable. I mean from inside an exceutable.
    On what OS platform?
    Windows
    For what purpose?
    Just for fun Actually learning
    Thanks for the reply.

  • Can not foward into voicemail from outside call on CUE and CUCM 8.6

    Dear Team,
    I have CUE Utility and CUCM 8.6.
    I can call from local, if user busy or go out office then call will foward to voice mail.It is ok.
    But when i call from outside to my phone(direct line), then call can not foward to voice mail on CUE.
    Please help me some solution.
    Thanks.

    Hi nam,
    A couple of things to check. Have you set the Forward Busy/No Answer "External"
    on the DN config page in CUCM?
    Are the calls coming in using a codec other than g.711?
    Best Practices for Deploying Cisco Unity Express
    • Each mailbox can be associated with a primary extension number and a primary E.164 number.
    Typically, this number is the direct-inward-dial (DID) number that PSTN callers use. If the primary
    E.164 number is configured to any other number, use Cisco IOS translation patterns to match either
    the primary extension number or primary E.164 number so that the correct mailbox can be reached
    during SRST mode.
    • Each Cisco Unity Express site must be associated with a CTI route point for voicemail and one for
    AA (if licensed and purchased), and you must configure the same number of CTI route points as
    Cisco Unity Express ports licensed. Ensure that the number of sites with Cisco Unity Express does
    not exceed the CTI scalability guidelines presented in the chapter on Call Processing, page 8-1.
    • Cisco Unity Express is associated with a JTAPI user on Cisco Unified CallManager. Although a
    single JTAPI user can be associated with multiple Cisco Unity Expresses in a system, Cisco
    recommends associating each dedicated JTAPI user in Cisco Unified CallManager with a single
    Cisco Unity Express.
    • Calls into Cisco Unity Express use G.711 only. Cisco recommends using a local transcoder to
    convert the G.729 calls traversing the WAN into G.711 calls. You can configure Cisco Unified
    CallManager regions with the G.711 voice codec for intra-region calls and the G.729 voice codec
    for inter-region calls.
    • If transcoding facilities are not available at the Cisco Unity Express site, provision enough
    bandwidth for the required number of G.711 voicemail calls over the WAN. Configure the Cisco
    Unified CallManager regions with the G.711 voice codec for calls between the IP phones and Cisco
    Unity Express devices (CTI ports and CTI route points).
    • The CTI ports and CTI route points can be defined in specific locations. Cisco recommends using
    location-based call admission control between Cisco Unified CallManager and Cisco Unity Express.
    RSVP may also be used.
    http://www.cisco.com/en/US/docs/voice_ip_comm/cucm/srnd/4x/42unityx.pdf
    Cheers!
    Rob
    "Far away from your trouble and worry
    You belong somewhere you feel free" - Tom Petty

  • Is it possible to set a variable in a program from outside before calling

    Suppose I have a program as follows
    Report Program1.
      data: prog1data(10) type c.
    start-of-selection.
      perform Prog1Form.
    form Prog1Form.
      write: prog1data.
    endform.
    Now if I have another program which calls the Prog1Form from outside, is there some way I can set value of variable prog1data from my second program before I call Prog1Form routine e.g
    Report Program2.
    start-of-selection.
    ->>>>Somehow set the variable prog1data in Program1 ?
      perform PROG1FORM in PROGRAM1.
    Will give points for the right answer. Thanks for reading.

    HI,
      use Export statment in calling program and import statment in the called program.
    Calling program
      export variable to memory id 'VAR'.
    Called Program
      import variable from memory id 'VAR'
    Thanks
    Mahesh

Maybe you are looking for

  • Mid-2013 Macbook Air: question about the battery life

    First of all, I'm sorry if these questions have been already asked, I've looked around and I've seen some answers, but none that fit my specific case. I have had this computer since December (Macbook Air, 13'', Mid-2013), I've been using it for a mon

  • Is it possible to change the color of the folders in OS 10.10.2 Yosemite?

    Is it possible to change the color of the folders in OS 10.10.2 Yosemite?

  • Table border

    hi! I have a table in epub of one row and 2 columns. How can I modify the table with sigil to obtain: table width 100%, first column width 20%, stroke only below the second column? For example: I would like to obtain table like this below: Name _____

  • User-resizable JPanel within my frame?

    Hi all, I've got a JFrame which contains a bunch of content in FlowLayout. One of the components in my frame is a JPanel that has the potential to display a lot of content -- it's reading a webpage obtained from the user. The panel has a scroll-bar,

  • Stolen Laptop - Is there any way to deauthorise it remotely?

    I have looked through the forums and support pages, but can't seem to figure out how to do this. I have changed my apple ID and password, so even if the thief gets past my system password they won't be able to buy anything on my credit card, but I wo