Java from VC++

I am writing a VC++ program that has to fetch Java source code from a file, compile and execute it at runtime, and return the result objects back to C++. Can anyone suggest a starting point to this? Any ideas??

It will require a little communication to get the result back to the VC++ program.
First of all you cannot transfer Java runtime objects back to VC++. They have to be serialized somehow and the simplest way is to convert the Java objects to Strings and write them to a textfile according to some format you define yourself. This result file is then read by the VC++ program and turned into C++ runtime objects.

Similar Messages

  • How do i uninstall java from my MacBook Pro running Lion?

    I would like to uninstall Java from my Lion OS running MacBook Pro. *it got installed a while back while running a Java program, and due to Fashback and other holes, I would like it off of my system, other than a complete re-install, how do I remove it?
    Thanks in advance.

    CT wrote:
    Uninstalling Java on Lion
    There's a lot more installed than what that article says. The Java installation package includes much more than just:
    /System/Library/Java/JavaVirtualMachines/
    Take a look at the package with Pacifist.

  • Call java from ABAP

    JCo connectivity is used to call RFCs from Java. can i call Java from abap?
    thanks in advance.....
    regards,
    Sundararamaprasad

    Hi Sundar ,
             This link will surely give u an idea about calling java fro ABAP using Jco.
    http://www.thespot4sap.com/Articles/SAP_Netweaver_Java_Connector.asp
    regards,
    aravindh.

  • Should I remove Java from  my IMac?

    Should I remove Java from my iMac?  Heard  of security problem with Java and  wondered if I should delete it,

    MadMacs0 wrote:
    I've been going entirely on the almost universal statement that installing Lion does not install Java by default. I'm very aware of the fact that older versions of OS X actually rely on the use of Java for some system functions, but I've been told that is no longer the case. If that were so, then there is no need for any Java to be present, yet you say it is there and you aren't the only one who has told me that.
    But exactly how much Java is installed by default? Obviously not enough to use it for browsing. In the days of the Java 6 Preferences app, it used to alert you that Java was not installed and offer to do so.  What happens with standalone apps like CrashPlan in Lion that require Java, do they have enough, by default, to run?
    The only Java component missing in these OSs is the Java Runtime Environment (JRE). Peruse those installations, looking in these directories, and be enlightened:
    /Applicatons/Utilities/->Java Preferences.app
    /Library/Java/
    /Library/Internet Plug-Ins/->JavaAppletPlugin.plugin
    /System/Library/CoreServices/->
            Jar Launcher.app
            Java Web Start.app
            JavaVersion.plist
    /System/Library/Frameworks->
            JavaFrameEmbedding.framework
            JavaScriptCore.framework
            JavaVM.framework
    /System/Library/LaunchAgents/->
    com.apple.java.InstallOnDemand.plist
    com.apple.java.updateSharing.plist
    /System/Library/Java
    /System/Library/PrivateFrameworks/->
            JavaApplicationLauncher.framework
            JavaLaunching.framework
    to name a few, but probably not all the Java components installed with OS Xs. Then, stop saying Java's not installed, when only the JRE component is missing.
    There has been speculation from some that perhaps it migrated from an older system or that Lion was installed on top of the older system. There's also some confusion these days about what actually constitutes a "clean install".
    AFAICT, it's speculated wrongly. As for the clean install, I define it to occur when the user wipes the drive, installs the OS, sets up everything, and then installs all 3rd-party software. Then, the installation is clean. If there's any migration involved, then it's not clean. i've not done one for over ten years and my OSs started with 9.2->Jaguar->to the current three.

  • JNI (Java from C) -- multiple JREs installed, need to use non-default one

    Hello,
    I don't know how many Google/forum searches I must have tried -- I can't seem to find a solution to my problem.
    I am calling Java from C. We have two types of environments:
    (1) 1.3/1.4 mix, and
    (2) 1.4 only.
    The mixed environments are configured to use 1.3 by default. This configuration will not be changed. The original developer's code needs backported to the mixed environment, but it has been discovered that his Java code is not 1.3-compatible.
    Since the code is not compatible with 1.3, I need a way to bypass the default JRE setting and get JNI to start a 1.4 JVM. Is there a way to do this?
    Thank you for your help.

    My "solution" is a kludge. It attempts to compensate
    for what I thus far believe to be an apparent lack of
    functionality. I believe the functionality I
    described should exist in JNI so that little jewels
    like my "solution" are not needed. What I am doing
    is improper. Therefore, I respectfully disagree with
    you.Except that your OP suggested that if you could replace it with 1.4 then that would be suitable solution.
    So if that is a suitable solution and you can in fact modify the JNI code then that is a solution that meets all of your needs.
    Regardless however you will note that the "The Java Native Interface" book in chapter 7 provides a specific section which
    1. Specifically points out why you can't depend on a generic VM loading mechanism
    2. Provides a specific mechanism which is OS/Platform specific, for doing runtime loading of the VM presuming certain constraints are followed.

  • Java from Time Machine

    Hi all...
    Due to the recent Java update (From Apple), Java is disabled in web-browsers.
    Simple question is, how do I restore just the old version of Java from a Time Machine backup, without having to do a full restore of all my files?
    Thanks.

    You can't.
    MadMAC0 posted at https://discussions.apple.com/message/20107182?ac_cid=tw123456#20107182 that:
    Apple has posted (10/22/12) the approved solution for restoring the Java 6 plug-in:
    Java for OS X 2012-006: How to re-enable the Apple-provided Java SE 6 applet plug-in and Web Start functionality.

  • Problem in generate Java  from PL SQL package in Jdeveloper

    Hi
    i have problem in create java class from PL SQL package in JDeveloper.
    I use Database navigator of jdeveloper and right click on a package and choose Generate Java then in Jpublisher window choose my view Controller and accept other default values.
    I call methods of generated class in the Action of a button in my JSP page, but when I click the button it  throw null pointer exception !!! i fund one of generated method return null and it lead to this exception.
    protected DefaultContext __tx = null;
    public DefaultContext getConnectionContext() throws SQLException  {
    if (__tx==null){
    __tx = (getConnection()==null) ? DefaultContext.getDefaultContext() : new DefaultContext(getConnection());
        return __tx;
      public Connection getConnection() throws SQLException
        if (__onn!=null) return __onn;
         else if (__tx!=null) return __tx.getConnection();
         else if (__dataSource!=null) __onn= __dataSource.getConnection();
         return __onn;
    i try to generate class in Model project and create DataControl for that and use method action but noting change and i get null pointer again!!
    Jdeveloper Versino = 11.1.1.7.0

    Let me ask you another question: Why do you generate java from the package at all?
    Where do you want to call the package?
    Back to your question: you should see code like
        public void setDataSourceLocation(String dataSourceLocation) throws SQLException {
            javax.sql.DataSource dataSource;
            try {
                Class cls = Class.forName("javax.naming.InitialContext");
                Object ctx = cls.newInstance();
                java.lang.reflect.Method meth = cls.getMethod("lookup", new Class[] { String.class });
                dataSource = (javax.sql.DataSource) meth.invoke(ctx, new Object[] { "java:comp/env/" + dataSourceLocation });
                setDataSource(dataSource);
            } catch (Exception e) {
                throw new java.sql.SQLException("Error initializing DataSource at " + dataSourceLocation + ": " + e.getMessage());
    in the generated code. This code look up a datasource (which you have defined e.g. on the Weblogic Server) by calling the method
    setDataSourceLocaltion("jdbc/HRConnDS");
    This look up the datasource nad stores it in the class variable.
    Timo

  • Upgrade java from 1.2 to 1.5 on SunOS 5.8

    Hi,
    Can anyone help me to upgrade java from 1.2 to 1.5 on SunOS 5.8 ....
    Thanks
    G. Singh

    Can anyone help me to upgrade java from 1.2 to 1.5 on
    SunOS 5.8 ....Sure, download the installation file and run it, then follow instructions. If you need more help, I'd be happy to help for $150 / hour

  • Calling Java from Delphi

    Can ActiveX bridge used for calling Java from Delphi?

    Also trying to solve this problem, after creating the bean i packaged/registered it successfully, (tested the bean using beanbox, works perfectly) then tried calling it via createoleobject in delphi 7
    (*Code Snip *)
    Var
    v : variant;
    begin
    try
    v := createoleobject(Edit1.text); // my class name ie WorldPort.Bean (also tried WorldPort.Bean.1
    except on e:exception do
    showmessage(e.Message)
    end;
    end;
    (*Code Snip*)
    After this simple code failed i started backtracking , eventually after getting "Access Violation...etc in axbridge.dll" all the time. tried delphi "import activex control" got the same access violation.
    Decided to test the example from http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/examples.html........ they both crashed on execution (calc.exe and boundprop.exe).
    After this failed I tested these example classes on another machine, both crashed again.....
    Also tried this experiment in VC++ , after adding the class to the Toolbox , i try to drop it onto a form, once again access violation.**PS**
    ('You will need VC++ and the Microsoft SDK to build the dll, download c++beta for free from microsoft site it you need it')** and a simple cmd file todo the job would look something like this:
    echo - ** Build Java ActiveX Bridge **
    echo Make sure these folders exist in jre--> axbridge\lib and axbridge\bin
    cd\SDK\jre\axbridge\bin
    set path=%path%;C:\MSDN\Bin;C:\VisualC++\lib
    echo path
    javac WorldPort.java
    jar cmf Manifest.txt WorldPort.jar WorldPort.class
    "C:\SDK\bin\packager.exe" -clsid {162193C4-AD5C-4A06-9F88-A737AE9B43AD} -out "C:\SDK\jre\axbridge\bin" WorldPort.jar WorldPort-reg
    *** After running this cmd you will find the dll in bin folder and the jar in lib folder..***
    Must Read:http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/index.html
    Hope some of this helps , if you have successfully created / installed/ used a "JavaActiveX" in Delphi , i would really like to try replicate it on my machine..

  • ClassDefNotFound error when calling Java from C++

    Hi all,
    I have a problem with calling my java from C++ through JNI.
    I have set my CLASSPATH environment varible that include path to every libary that I need. My source is as follows:
    #include <jni.h>
    #include <stdio.h>
    int main()     
         JNIEnv               *env;
         JavaVM               *jvm;
         JavaVMInitArgs     vm_args;
         jint               res;
         jclass               cls;
         jmethodID          mid;
    IMPORTANT: specify vm_args version # if you use JDK 1.1.2 and beyond
         vm_args.version = JNI_VERSION_1_4;
         vm_args.ignoreUnrecognized = JNI_TRUE;
         JNI_GetDefaultJavaVMInitArgs(&vm_args);
         /* Create the Java VM */
         res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
         if (res < 0) {
              printf("Can't create JVM\n");
              return 1;
         cls = (env)->FindClass ("dds/test/comm/listeners/NACKListenerFrame");
         if (cls == 0)     {
              printf("Can't find NACKListenerFrame Class\n");
              return 1;
    mid = (env)->GetStaticMethodID(cls, "start", "()V");
         if (mid == 0)     {
              printf("Can't find NackListnerFrame.start \n");
              return 1;
         (env)->CallStaticVoidMethod((_jclass*)cls, (_jmethodID*)mid, NULL);
         jthrowable e = (env)->ExceptionOccurred();
         if (e)     {
              env->ExceptionDescribe();
              env->ExceptionClear();
         if ((jvm)->DestroyJavaVM() < 0)     {
              printf("Cannot destroy JVM./n");     
         return 0;
    I deliberately left out the codebelow because I want the JVM I created to load Classes from the system's CLASSPATH variable as I have set path to every classes that I need, in that CLASSPATH variable.
    JavaVMOption     options[1];
    options[0].optionString=
    "-Djava.class.path=.;E:/DDSproject/DDSImplementation/classes";
    vm_args.options = options;
    vm_args.nOptions = 1;
    But it seems like unless I specify CLASSPATH in my C++ source code the JVM could not find any classes.
    I tried to put the "jvm.dll" path to the first one in the System's PATH variable. It does not work either...
    Gurus Pls help!!!.. I don't know what to do... I don't wanna code my CLASSPATH in my c++ source code as above.
    Thanks in advance,
    chancellor

    I was thinking JVM should the classpath when it is invoked. But obviously it is not and we need to assign the classpath ourselves when invoking from native side. Thanks for pointing that out. For other people's benefit the following is the code piece I for initializing JVM.
    char* str1;
              char* str2;
              char* classpath;
              str1 = "-Djava.class.path=";
              str2 = std::getenv("CLASSPATH");
              classpath = (char*)malloc(strlen(str1) + strlen(str2) + 1);
              strcpy(classpath, str1);
              strcat(classpath, str2);
              if (str2 == NULL)     {
                   printf("CLASSPATH environment variable is not defined.");
                   exit(1);
              m_VmArgs.version = JNI_VERSION_1_4;
              m_options[0].optionString= classpath;
              m_VmArgs.options = m_options;
              m_VmArgs.nOptions = 1;
              m_VmArgs.ignoreUnrecognized = JNI_TRUE;
              JNI_GetDefaultJavaVMInitArgs(&m_VmArgs);
              /* Create the Java VM */
              m_Res = JNI_CreateJavaVM(&m_Jvm, (void**)&m_Env, &m_VmArgs);
              if (m_Res < 0) {
                   printf("Can't create JVM\n");
                   exit(1);
    thanks,
    chancellor

  • How to call procedure in Java from SQL Server Database

    Hello Every Body
    i Have Question about
    How to call procedure in Java from SQL Server Database
    Thanks

    Hi,
    have you tried a Google search? I just gave it a 3 second try and already found: http://stackoverflow.com/questions/6113674/how-do-i-execute-a-ms-sql-server-stored-procedure-in-java-jsp-returning-table-d
    Frank

  • How to run Java from Firefox Extension using liveconnect?!

    Hi, I'm trying to run a very simple java program from a Firefox extension I'm making but I've run into a brickwall and just can't get it to work. I'm a complete beginner in java and don't know much javascript so I've copied and pasted code from around the net to get where I am now. I'm sure I'm just making some stupid error at some step.
    In order to work out what I'm misunderstanding/doing wrong I'd be really grateful if someone could show me how to get it to work using a very basic example:
    Say I have a .java file taken from the sun pages:
    * The HelloWorldApp class implements an application that
    * simply displays "Hello World!" to the standard output.
    class HelloWorldApp {
        public static void main(String[] args) {
            System.out.println("Hello World!"); //Display the string.
    }So I stick it into a jar using:
    jar.exe cvfe HelloWorldApp.jar HelloWorldApp.class HelloWorldApp.class
    I then place it directly on my C: drive.
    In the javascript of my firefox extension I have code copied and pasted from https://developer.mozilla.org/en/Java_in_Firefox_Extensions:
    var urlClasz = java.lang.Class.forName("java.net.URL");
    var urlArray = java.lang.reflect.Array.newInstance(urlClasz,1);
    urlArray[0] = new java.net.URL('file:///C:/HelloWorldApp.jar');
    var cl = java.net.URLClassLoader.newInstance(urlArray);
    var aClass = java.lang.Class.forName("HelloWorldApp", true, cl);
    var aStaticMethod = aClass.getMethod("HelloWorldApp", []);
    var greeting = aStaticMethod.invoke(null, []);This seems to start java but then only gives me the error:
    "Error: uncaught exception: Error calling method on NPObject! [plugin exception: java.lang.ClassNotFoundException: HelloWorldApp]."
    I would be infinitely grateful if someone could show me the code I would use in this situation to run the HelloWorldApp. If I could get it working in this basic situation I'm sure I could work it out from there.
    Thank you very, very much!!

    By the way, I answered just because nobody did and I have some experience with using java from mozilla javascript.
    But I never played with Firefox extensions.
    No problem baftos, I understand you might not have all the answers but you've helped loads so far, so thanks a lot! I've found it very difficult to find good documentation on this for a beginner like me.
    Adding public did it (although I thought that I'd tried that, oops) so thanks again for that. I may have a couple of other questions just in case you happen to know the answer!
    I'd like to send some string arguments to the method I really want to run eg:
    public class HelloWorldApp {
    public static void sayHello(String[] args)
    {code}After googling .forName and .getMethod to see how to pass parameters I've added some code:
    {code:java}
    var strClass = java.lang.Class.forName("java.lang.String");
    var parameters = java.lang.reflect.Array.newInstance(strClass,2);
    parameters[0] ="My string argument";
    parameters[1] ="3"; // etc...
    var argHolder = java.lang.reflect.Array.newInstance(strClass,1);
    argHolder[0] = strClass;
    var aClass = java.lang.Class.forName("HelloWorldApp", true, cl);
    var aStaticMethod = aClass.getMethod("sayHello", argHolder);
    var greeting = aStaticMethod.invoke(null, parameters);
    {code}What I thought I was doing was creating a java array: argHolder and putting the string class/object thingy?! in it so that getMethod would look for a method called "sayHello" which took a string array as an argument... but apparently not!
    This brings me back to square one with a cannot find method with these arguments error:
    "Error: uncaught exception: Error calling method on NPObject! [plugin exception: java.lang.IllegalArgumentException: No method found matching name getMethod and arguments [java.lang.String, [Ljava.lang.String;]]."
    You don't happen to know how to do this as well do you?!
    Edited by: mzatanoskas on Feb 13, 2009 1:40 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to set JRE 1.5.0_07 as default Java from the cmd line in Windows

    Hi All,
    We are currently in the process of upgrading our company to IE8. As MS JVM is incompatible we need to remove it.
    However, once we have done this JRE 1.5.0_07 is not the default version of Java any more for IE8.
    My question is - Is there a command line switch to set set JRE 1.5.0_07 as default Java from the cmd line in Windows. ie the setting in Java Control panel where you would tick Internet Explorer?
    Thanks in advance!

    This is to confirm a similar issue. Here is the scenario:
    We are currently using IE 6 and looking forward to upgrade to IE 8. Our current Java version is: J2RE 1.5.0_16.
    When updating from IE 6 to IE 8 with J2RE 1.5.0_16 on a test workstation, we get the following error from the Java testing website (http://www.java.com/en/download/help/testvm.xml): "load: class testvm2/Main.class not found."
    Workaround :
    -> Change Java JRE Network Settings in Control Panel to "User proxy server : xxx.xxx.xxx.xxx:xx"
    We are using an autoconfig.pac file and it seems IE8 can't parse the settings to JRE to go through the proxy.
    Please advise if you have a fix for the autoconfig.pac file.

  • Nokia 6230i : how to send applications java from ?

    How to send applications java from nokia 6230i to an other nokia 6230i ?
    Looking for applications: "converter II, world clock II, translator".
    thanks.

    as hole is right ,there is no way can be sent , but i would like to know how the Mosh is working and which way everybody uploading the apps to Mosh ? i have downloaded apps from Mosh and want to send it to another phone and also i like to send some apps games to Mosh , thanks for any advise .
    The only thing necessary for the triumph of evil , is for good men to do nothing .

  • Problems to generate JAVA from SQLJ

    Hi, i work with Developer 10.1.3, and I try to generate files .java from files .sqlj. I generate java files from de packages in data base, but don´t generate me files .java from the .sqlj generated. Can anyone help me?
    Regards.

    Hi,
    Does it happen for a particular work area or any workarea?
    Can you give the detail of the Designer client you are using?
    The following steps should be follwed:
    Select Database as "Source of Design Capture"
    Give the correct database connection detail
    Give the correct Target Container, Capture Implementation Info and User.
    Select the object(s) to be captured
    Click the Start button

  • Transitioning to Java from Quicktime...

    Hi :)
    I am seriously thinking of transitioning all of my cross platform projects to Java from Quicktime wired media.
    an examples:
    http://www.siren.cc/siren/launch.html
    http://www.fonovisa.com/fonoplayer.html
    Will Java [Swing?] allow me keep custom shapes/skins and communicate with my php/mysql server ? How does Java behave cross platform ? Are there some cross platform Java examples similar to what I have done above ?
    many thanks as I need to know more :)
    g

    the point is...that it is no longer enough :)
    I need SSL,md5,Post, utf-8, sockets,File Upload, video chat capability, and a whole slew of other things that QT is never going to provide.....
    QT is a dying/nearly dead platform anyway. I just want to make sure I can take custom skins with me.
    Also, it appears that Java is going to support h264 playback without needing QT.
    It appears that Java Swing would be a more powerful programming language than Qscript [QT programming language]. It also appears I can keep my php/mysql back end system. I am not keen on switching to Flash because Macromedia forces you to buy all of their products to make a complete system.
    So, are there any good example of a java coded media player with a custom skin ?
    make sense ?

Maybe you are looking for

  • Stuck with a number attached to a Microsoft accoun...

    We have a Microsoft Account and then we purchased a Skype Number. Because we have a Microsoft Account we can't use a DECT phone with Skype function because the username (which starts live isn't accepted. This means we're stuck using the PC connection

  • HELPDeleted user account with file vault on to free disk space, to no avail

    My saga is a long one. Quick telling: I am the administrator on my eMac, and was locked out of my desktop last spring when the disk became overly full. File vault was turned on, and I was told by my computer repair folks that since the desktop was en

  • Who will decide...

    Hello, In Development, who will decide which mapping to use  XSLT ,Java or ABAP ..In which different scenarios these mappings are Appropriate pls give examples for each

  • Plotting GPS data in Diadem

    I am analyzing some GPS data and I want to visualize the data on google maps. I remember seeing an exmaple on this topic ( google maps and Diadem interface) but cannot seem to find it anywhere. I am using Diadem 11.1.0 and I doubt the GPS functionali

  • Learning Co-ordinate System - Problem

    Hi I created a sample project to epxlain my problem. There are two canvases in the main application. outerspace canvas and innerspace canvas. innerspace canvas has a visual component "mainBox" and there is also a visual component in outerspace canvas