Dont want to hard code the -Djava.class.path...notation question

Hello everyone,
I have a c++ program that is compiled into a DLL file. It calls the JNI_CreateJavaVM. I have the whole thing working but now I need to port it and the jar file to another machine.
right now i am setting the options this way:
#define USER_CLASSPATH "c:\\javaClasses\\intec.jar.zip" /* where PRLocalBridge.class is */
#define PRCLASS "com/intec/intecapi/PRLocalBridge"
bool PRLocalBridgeMain(){
     JavaVMOption options[1];
     options[0].optionString = "-Djava.class.path=" USER_CLASSPATH;
     vm_args.version = JNI_VERSION_1_4;//0x00010002;
     vm_args.options = options;
     vm_args.nOptions = 0;
     vm_args.ignoreUnrecognized = JNI_TRUE;
    /* Create the Java VM */
    res = JNI_CreateJavaVM(&jvm, (void**)&env,&vm_args);
    if (res < 0) {
     return (bool*)errorHandler('b', CANT_INVOKE_JVM);
    cls = env->FindClass(PRCLASS);
}where USER_CLASSPATH is hardcoded directly to where the jar
file is located. in other machines, it may not be loaded
in that file structure. how do i softcode the path?
ive put the jar in my classpath but that doesnt seem to work
(unless i didnt have USER_CLASSPATH set properly). Thanks
in advance :)
txjump

hi bschauwe,
thanks for the suggestions! i was hoping you would reply. You have helped some others with classpath questions. :)
since its a dll, can you pass it values?
we do have an ini file that is already created but the file parser is in java so i would have to write another one in c. id like to stay away from that though. cause if it gets messed up or goes missing, clients wont be able to reach the java program, and in turn the database.
the classpath environment variable sounds like a good idea...will check into that. eventually we plan to wrap our software up in installshield so that would really be nice. clients could be ignorant of environment variables and still be able to run everything.
my solution for now has been to find my jar file by recursively searching the c drive. and use GetFilePath() to get the full path and pass that to JNI_CreateJavaVM. i did get it to work...just wondering if this is a good idea.
i was thinking that if the dll is in the same folder as the jar file i could just use dot notation but that just doesnt seem like a good idea to make that assumption. but i think java does something similar 'cause Sun says not to move the java.dll file.
thanks for your input,
txjump

Similar Messages

  • Do not hard code the connection

    I trying to seperate the web container and ejb container into two machines
    for an existing application.
    It works in one machine, and it works on two machinese if I hard code the
    JNDI factory, the provider_URL.
    My question " Is it possible to do this without hardcoding the URL".
    I am running two windows NT boxes for this.
    thanks.

    To use 2 different WL servers, one as EJB container and one as web
    container, you have to create or edit your jndi.properties file (in your
    jre/lib directory) and add two lines to it that specify
    t3://<servername>:<port> ... unfortunately I don't have the information here
    at home but I think that I have posted it before on one of these WL
    newsgroups.
    Cameron Purdy, LiveWater
    "Dave Read" <[email protected]> wrote in message
    news:[email protected]...
    I may be missing it, but in this and another thread, I don't see where the
    host is specified (where the EJB has been bound to a JNDI name)? I'vebeen
    able to do this standalone using the -Djavax.naming.provider.url property.
    However, I don't see how to tell an instance of a WL server that's just
    running web-apps, where (on what machine) to find the JNDI tree that
    contains the EJB Homes?
    The code in this post seems to help when an EJB wants a simple way to get
    it's own properties. I need to deploy the web-app and EJBs on separate
    (non-clustered) systems.
    Bottom line ... how to externalize the provider URL.
    Thanks!
    Cameron Purdy <[email protected]> wrote in message
    news:[email protected]...
    Beautiful.
    Cameron Purdy, LiveWater
    "Tom Preston" <[email protected]> wrote in message
    news:[email protected]...
    Here is an example:
    Using 5.1.0 xml dd's, you can specify an <env-entry> which is
    associated
    with
    your ejb:
    <env-entry>
    <env-entry-name>poolName</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>myPool</env-entry-value>
    </env-entry>
    file://now put this code into your Bean class
    private String getPoolName( ) {
    try {
    // Obtain this enterprise bean's environment naming context.
    Context initCtx = new InitialContext();
    m_envCtx = (Context)initCtx.lookup("java:comp/env");
    String poolName = (String) m_envCtx.lookup("poolName");
    return poolName;
    catch (Exception e) {}
    return null;
    Alexandre POLOZOFF wrote:
    Is there an example of how to do this somewhere?
    -Alex
    "Tom Preston" <[email protected]> wrote in message
    news:[email protected]...
    You can put this info into your EJB deployment descriptors (xml if
    5.1.0)
    and
    access them as environment variables.
    xinguang sheng wrote:
    I trying to seperate the web container and ejb container into
    two
    machines
    for an existing application.
    It works in one machine, and it works on two machinese if I hard
    code
    the
    JNDI factory, the provider_URL.
    My question " Is it possible to do this without hardcoding the
    URL".
    I am running two windows NT boxes for this.
    thanks.

  • How to hard code the values in XI for the synchronous scenario?

    Hi All,
    Actual Scenario : Webservice - XI - Any of the Receiver Adapter(RFC/JDBC) .
    The receiver adapter setup will take some more days to complete. So, time being I would like to hard code the response values in XI according to the webservice request and send the response back to webservice. Is it possible?
    If it is possible, could you please tell me how to go about for this?
    Regards
    Sara

    Hey
    >>So, time being I would like to hard code the response values in XI according to the webservice request
    if ur response is based upon the request,then how can u hard code any value?when u hard code any element.it will always display the hard coded value irrespective of the request.
    in case u want to hard code something which does not depends on response or which will always stay the same in ur scenario,then just use the constant function of message mapping to do that
    thanx
    ahmad
    Message was edited by:
            Ahmad

  • I had 10$ gift card that works only on US. I redeemed the gift card but back in the game i get buy stuff and it says "you cant buy in US store you must swich bla bla bla" i dont want ti swich because the 10 $ works only at the US store. Help please.

    I had 10$ gift card that works only on US. I redeemed the gift card but back in the game i get buy stuff and it says "you cant buy in US store you must swich bla bla bla" i dont want ti swich because the 10 $ works only at the US store. Help please.

    Hello SBentley22,
    I can only imagine how upset I would be to discover that over $1000 in gift card funds seemed to be missing. I certain that I would not do well with the additional complications that you've described either. I apologize for you and your boyfriend having to cope with this situation. Certainly this was never our goal.
    I was unable to locate the purchases or returns that you mention using the information you provided when you signed up for Best Buy Unboxed. I would very much like to look into this situation for you and do what I can to help, but I will need more information to begin. If you will please send me a private message that includes your full name, telephone number, and the Customer Service PIN from the receipt where the gift card was issued, I'll get started with my research.
    Please know that I'm extremely grateful that you took the time to bring your situation to our attention. I look forward to hearing from you.
    Sincerely,
    John|Social Media Specialist | Best Buy® Corporate
     Private Message

  • My iphone 4 dont want to start beyond the apple logo

    my iphone 4 dont want to start beyond the apple logo

    Hello diyaakaraman69,
    That symptom is listed in this article (it is having problems booting),
    iOS: Not responding or does not turn on
    http://support.apple.com/kb/TS3281
    5. If the above steps do not resolve the issue, or the if the screen remains black or shows a persistent Apple logo, try restoring with iTunes:
         1.Connect the device to your computer and open iTunes.
         2. If the device appears in iTunes, select and click Restore on the Summary pane. Learn more about restoring iOS software.
         3. If the device doesn't appear in iTunes, try to force the device into recovery mode, and then restore it.
    6. If the above steps do not resolve the issue, contact Apple.
    Note it suggests a restore as described here:
    Use iTunes to restore your iOS device to factory settings
    http://support.apple.com/kb/HT1414
    Please go through that article.
    Thank you for using Apple Support Communities.
    Nubz

  • User defined classpath setting using "-Djava.class.path="

    Hello,
    I am invoking a JVM from a C++ application ( say A ) which inturn will be started by another C++ application ( say B ).
    The class path for the JVM is set by "-Djava.class.path=" option in application 'A' which will actually supplied by parent application 'B'.
    I want to know how to do it ?
    I tried with the following things but it doesn't work.
    // the application 'A' gets classpath string from appication 'B' the "classpath" variable ( which is a string ) gets from application 'B'
    // this is in application 'A'
    // "classpath" variable in application 'A' holds the class path string optained from application 'B'
    "-Djava.class.path=" classpath ; ---(1)
    // "-Djava.class.path=" %classpath% ; ---(2)
    // "-Djava.class.path=classpath" ; ---(3)
    All the above tries are failed in first 2 tries the application even doesn't get compiled and in third try the appilcation doesn't set the classpath even though it is get compiled.
    Do any one have any Idea !!

    Hi,
    I am not quite sure if I got your problem correctly...
    Your application A has a variable called classpath containing the classpath recieved from B. right? Now you want to call the JVM with that.
    I think what you got to do is something like
    sprintf(myclasspath, "-Djava.class.path=%s", classpath);
    this will build the correct string for the JVM in myclasspath. And that one can be used to call the JVM.
    Does this sound right??

  • The HttpServlet Class. A question for all please

    Hello there,
    When we write our Servlets,we extend the HttpServlet class.
    This class is an abstract class having the doGet() and doPost()
    methods which we normally override for our custom functionality.
    We cannot instantiate this class as this is abstract.
    Why couldnt this be defined as an Interface then?
    This could then have the same doGet() and doPost() methods which
    we could then implement in our class.
    Can any one explain to me this difference or am I missing anything
    here.?
    Wouldnt defining the HttpServlet class as an Interface be a viable
    solution?
    Regards
    Ajay

    "An interface cannot implement any methods, whereas an abstract class can"
    HttpServlet extends GenericServlet and has methods so it can not be an interface.

  • Run Into Problem When Trying Not To Hard Code the Host Name

    My code (using the JavaMail API) works fine when the SMTP host name is hard coded in the program:
           props.put( "mail.smtp.host", "TheHostName" );Then, I tried to put the host name in a properties file (smtpServer.properties). The properties file is in the $TOMCATHOME\webapps\AppName\WEB-INF\classes\resources directory. And the properties file has this one single line:
    smtpServer = TheHostName     //Note: The host name has only alpha characters, dots, and dashesIn my program, I did:
       private final String PROPFILE = "resources/smtpServer.properties";
       private Properties oProp = null;
       public SendBatchMails()  // this is the constructor in my class
          try
             oProp = new Properties();
             oProp.load ( getClass().getClassLoader().getResourceAsStream( PROPFILE ) );
          catch( IOException oEx )
             System.out.println("Unable to load the Properties " + PROPFILE + oEx );
           String smtpServer = oProp.getProperty( "smtpServer" );
           Properties props = System.getProperties();
           props.put( "mail.smtp.host", smtpServer );And, I got this runtime error:
    java.lang.IllegalArgumentException: argument type mismatch
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:324)
         org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
         org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
         org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
         org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    I would agree with Reply 1. From the stack trace it is apparent that it comes from Struts, where it is failing to set some kind of property in a bean. However the code that you posted doesn't seem to have anything to do with that. Check your Struts configuration.

  • I apologize for my stupidity right from the start so extra points for the help! how do you get get rid of apps that you dont want ever, off of the list of waiting i guess youd call it? im beginning to think its allowing something to affect the safari?

    i started having issues with my i pad yesterday afternoon, then i noticed the upper section of the safari which was grey was now charcoal? since then searches are odd and when i click on history to erase its not there? i went into the apps to see if there might be some i missed cleaning out and not only were there, but i cannot remove them, am i doing something wrong? im not a computer person at all so any help would be greatly helpful. your humble ammature, joe.

    Try clearing Safari's cache : Settings > Safari > Clear Cookies And Data and also Clear History
    If that doesn't work then try closing Safari via the taskbar and then re-open it : from the home screen (i.e. not with Safari 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Safari app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    A third option is a soft-reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.
    Not sure what you mean by the 'list of waiting' (?). Do you mean that they are on your iPad's homescreens with 'waitin' against e.g. they have haven't finished downloading ?
    You can delete fully downloaded apps from your iPad's homescreens by pressing and holding any of them for a second or two and they should start to shake. Then press the 'x' in the left corner to delete the ones that you don't want, and when you've finished deleting press the home button below the iPad's screen so as to stop the apps shaking. If you don't get the 'x' on any of the apps that you've downloaded (you can't delete built-in apps) then check that Settings > General > Restrictions > Deleting Apps isn't set 'off'

  • [Deployment] How NOT to hard code the Database SID, Username, and Password

    Hi, I'm new in J2EE so be easy on me. :)
    How can I parameterize the database SID, username, and password in my J2EE application? So that anyone can change the SID, username, and password without the need to modify my code? I use Oracle 10g, ADF BC, JSF and JDeveloper 10.1.3.1.
    My friend said that I can use XML for this. But he didn't go to detail for doing this. Is it true? Is there any [or better alternative]?
    Any help or pointer to a simple tutorial would be fine.
    Thanks in advance.

    Hi -- this is quite easy to do with J2EE.
    In your application code, you declare "logical" references to resources (such as datasources, security roles, etc.) and use those in your application code so all it depends on is the logical name
    On the server where the application is deployed, "physical" resources are created that point to the actual resource -- in the case of a database, this would be the JDBC URL, username, password.
    At deployment time of the application, you then use the facilities of deployment tool to "map" the logical references in the application, to the physical references that exist on the server. So you connect the dots between your application needing something and the server providing the something. That way all the "details" are abstracted out of the your application code.
    I don't know how this works in ADF, BC4J, etc. but I presume that since they are based on standard/J2EE, it must be available somehow.
    I wrote something about this a while back using direct JDBC as an example:
    http://buttso.blogspot.com/2006/06/datasource-lookup-using-javacompenv.html
    -steve-

  • Can you hard code the speed and duplex on lightweight access points

    I have a client that want to set the spped and duplex on the switch port. Is there a way you can configure the fastethernet port on a lightweight access point for speed and duplex.

    Try this step
    configure terminal
    Enter global configuration mode.
    Step 2
    interface fastethernet0
    Enter configuration interface mode.
    Step 3
    speed {10 | 100 | auto}
    Configure the Ethernet speed. Cisco recommends that you use auto, the default setting.
    Step 4
    duplex {auto | full | half}
    Configure the duplex setting. Cisco recommends that you use auto, the default setting.
    Step 5
    end
    Return to privileged EXEC mode.
    Step 6
    show running-config
    Verify your entries.
    Step 7
    copy running-config startup-config

  • 2 iphones but dont want to sync them the same

    Hi
    We have 2 iphones my wife has the new 1 and I have the old 1
    The problem we have is all her stuff is getting onto my phone so I end up deleting a load of crap, can anyone tell me how we stop this as I have a new apple Id she has the old one but all the old is coming onto my phone with the new id.
    Totally baffled tried almost everything we know, which isnt much
    Thanks
    D

    When the phone is connected go into iTunes and select iPhone under devices (left-hand side). Navigate to each tab (Music, apps etc) and you can check exactly what you want to sync. Also make sure 'automatically sync apps' is unchecked
    http://support.apple.com/kb/ht1977
    http://support.apple.com/kb/ht1386
    http://support.apple.com/kb/ht1351

  • Unable to hard code the ports of cisco 3750x series switch

    hello,
    I have tried with hardcode to 1000 7 Full on the ports which are connected to another switch.
    After changing the port to auto from one side of the switch port came up. Is there any solution to make port up when both sides are hard coded to 1000 & full duplex.
    Simple Words:
    Switch 1 --> Switch 2 --> Hard coded to 1000 & Full --> Down.
    Switch 1 --> Switch 2 --> Auto on one end to Switch 1  --> Up.
    Switch model:
    Switch 1 Cisco 3750x (Gi Switch)
    Switch 2 Cisco 3750 (Gi Switch)
    Regards,
    Ezra.

    Disclaimer
    The  Author of this posting offers the information contained within this  posting without consideration and with the reader's understanding that  there's no implied or expressed suitability or fitness for any purpose.  Information provided is for informational purposes only and should not  be construed as rendering professional advice of any kind. Usage of this  posting's information is solely at reader's own risk.
    Liability Disclaimer
    In  no event shall Author be liable for any damages whatsoever (including,  without limitation, damages for loss of use, data or profit) arising out  of the use or inability to use the posting's information even if Author  has been advised of the possibility of such damage.
    Posting
    Yes, it's possible without a straight through cable, enable auto/auto both sides.    Otherwise you'll need a cross-over cable.
    BTW, if your standard is hard coding copper gig ports, for speed and duplex, you might consider bringing your standard up to date.  Copper gig standard went much further in how auto/auto is supposed to work.  By disabling auto/auto, I believe, you're also disabling some error monitoring too.  Generally, all the major players, e.g. Cisco, would recommend auto/auto for copper gig Ethernet.

  • How do I turn off auto flip on my pictures when I use the front face camera? I dont want it to flip the picture after I take it, I have a 4S

    When I take pictures using the front face camera on my phone it flips them, it didn't use to do that thats why I know there has to be a way to turn it how, but how?

    It's here (in Numbers > Preferences):
    Uncheck 'Show suggestions when editing table cells'.
    SG

  • Where to Hard Code the Connection String.....

    Hi,
    We just give the url to the user and when the user clik it.
    The Application form login will appear and user should login before they
    can use the system.
    When our DBA setup in the production they give us the url and
    when I click it the Database login screen appear before it goes to
    the Application form login.
    My problem is how to bypass that Database Login Screen and where to hardcode
    the connection string in which file in the server.
    Thanks.
    Regards,
    Jun

    We are hardcoding the userId (Connection) details in the formsweb.cfg, wil it create any issues to our security system.
    From the application link, i couldnt get the userid details, as all the other
    details like
    serverArgs="escapeParams=true module=frm_login.fmx userid= sso_userid=%20 sso_formsid=%25OID_FORMSID%25 sso_subDN= sso_usrDN= debug=no host= port= buffer_records=no debug_messages=no array=no obr=no query_only=no quiet=yes render=no record= tracegroup= log= term=D:\Applns\OracleForms\forms\fmrweb_.res"
    separateFrame="true"
    splashScreen="no"
    background="no"
    lookAndFeel="Oracle"
    colorScheme="blue"
    serverApp="default"
    logo="false"
    imageBase="codebase"
    formsMessageListener=""
    recordFileName=""
    EndUserMonitoringEnabled=""
    EndUserMonitoringURL=""
    heartBeat=""
    were visible (view Source) but userid= sso_userid=%20, i think this points to
    basejini.htm, which doesnt contain the userid details ..
    am i correct .. please render your thoughts over this.
    Many Thanks
    Deepa
    Message was edited by:
    Deepa.ibs

Maybe you are looking for