How can I have a #defined  in Java?

How can I have a #defined in Java that
works like C/C++?
Edited by: thunderball1234 on Mar 25, 2009 7:55 AM

BigDaddyLoveHandles wrote:
I just threw up in my mouth a little. Why do you want to preprocess Java files?I have some code that works with primitive arrays and I want to use that code for byte, char, double, float and long. I first wrote this as a file to be processed by cpp, I then changed to use perl and now I use XSLT.
What is interesting to me is that the perl version was easiest to write and easiest to maintain. The XSLT version is bloody difficult to understand.
Edited by: sabre150 on Mar 25, 2009 4:03 PM

Similar Messages

  • How can i have a refrence of a java class object instance in my c++ project

    Hi!
    How can i have a refrence of a java class object instance in my c++ project. Is there a way?

    hahaxia wrote:
    The second question is the big one. The first question is half of the problem of "c++ to java" invocation and access. But the other half which is "java to c++ " invocation and access is still not solved. jni only provide the "java to c++ " DLL invocation Wrong,
    Using JNI your java classes can have methods implemented in C/C++.
    Using JNI you can call java classes.
    There is no other possible interaction between C++ and java, so it does it all.

  • How can I have a default servlet and an index.html?

    Hi,
    I writing a small webapp to test/understand the 2.2 Servlet Spec. I am deploying this as a WAR to Orion, Tomcat and Silverstream.
    The app's name is: "myapp"
    My application has an index.html, which is listed as the sole welcome-file in the welcome-file-list element in the app's web.xml.
    The interesting thing is that, after adding a default Servlet (<url-pattern>/</url-pattern>), I can no longer access the app's index.html either implicitly or explicitly:
    1. Implicit:
    - http://localhost/myapp
    - http://localhost/myapp/
    2. Explicit:
    - http://localhost/myapp/index.html
    - http://localhost/myapp/index.html/
    All of these invoke the Default Servlet in all 3 app servers.
    Question: How can I have both a default Servlet and an index page?
    Thanks in advance.
    Miles

    you can define it in the web.xml file
    look at the dtd, element "welcome-file-list"

  • How can i execute Spaces API in java main class?

    Hi
    I am able to execute Spaces API through portal application. However if i try to execute it in java main class, its throwing an exception
    "SEVERE: java.io.FileNotFoundException: .\config\jps-config.xml (The system cannot find the path specified)"
    oracle.wsm.common.sdk.WSMException: WSM-00145 : Keystore location or path can not be null or empty; it must be configured through JPS configuration or policy configuration override.
    How can i set this path, so that i can execute Spaces API from java main class.
    Need this main class to configure in cron job, to schedule a task.
    Regards
    Raj

    Hi Daniel
    Currently i have implemented create functionality in my portal application using Spaces API, which is working fine. Now the requirement is, i need to implement a "Cron Job" to schedule a task, which will execute to create space(for example once in a week). Cron job will execute only the main method. So I have created java main class, in which I have used Spaces API to perform create space operation. Then it was giving exception.
    Later I understood the reason, as I am executing the Space API with a simple JSE client, its failing since a simple java program has no idea of default-keystore.jks, jps-config.xml, Security Policy. Hence i have included those details in main class. Now I am getting new error,
    SEVERE: WSM-06303 The method "registerListener" was not called with required permission "oracle.wsm.policyaccess"
    For your reference i have attached the code below, please help. How can i use Spaces API in java main method(i mean public static void main(String[] args) by giving all required information.
        public static void main(String[] args) throws InstantiationException,
                                                      GroupSpaceWSException,
                                                      SpacesException {
            Class2 class2 = new Class2();
            GroupSpaceWSContext context = new GroupSpaceWSContext();
            FactoryFinder.init(null);
            context.setEndPoint("http://10.161.226.30/webcenter/SpacesWebService");
            context.setSamlIssuerName("www.oracle.com");
            context.setRecipientKeyAlias("orakey");
            Properties systemProps = System.getProperties();
            systemProps.put("java.security.policy","oracle/wss11_saml_or_username_token_with_message_protection_client_policy");
            systemProps.put("javax.net.ssl.trustStore","C:\\Oracle\\Middleware11.1.7\\wlserver_10.3\\server\\lib\\cacerts.jks");
    systemProps.put("oracle.security.jps.config","C:\\Oracle\\Middleware11.1.7\\user_projects\\domains\\workspace\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\jps-config.xml");
            systemProps.put("javax.net.ssl.keyStore",C:\\Oracle\\Middleware11.1.7\\user_projects\\domains\\workspace\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\consumer.jks");
            systemProps.put("javax.net.ssl.keyStorePassword", "Test12");
            System.setProperties(systemProps);
            GroupSpaceWSClient groupSpaceWSClient;
            try {
                groupSpaceWSClient = new GroupSpaceWSClient(context);
                System.out.println("URL: " +
                                   groupSpaceWSClient.getWebCenterSpacesURL());
                //delete the Space
                List<String> groupSpaces = groupSpaceWSClient.getGroupSpaces(null);
                System.out.println("GroupSpaces:: " + groupSpaces.size());
            } catch (Exception e) {
    Regards
    Raj

  • How can i use Unix database in java?

    How can i use Unix database in Java?
    Message was edited by:
    JPro

    I have not a clue about FoxPro, but the db then is FoxPro and not Unix. The better question would be "How do I connect to FoxPro DB running on Unix with JDBC?".
    My answer to that would be, search the Internet for a JDBC driver.

  • How can I have one row for each object?

    Post Author: farnaz
    CA Forum: WebIntelligence Reporting
    I have 3 objcts that one of them is ID and second one is internal code and the third one is quantity.There is more than one value for each ID (becouse of internal code).I want to create a report based on ID and quantity (not based on internal code).I make a break on ID but the result shows me more than one row for each ID.so how can i have just one row for each ID?
    another question:
    how can I post screen shot of the results to my messag in forum?

    Post Author: jsanzone
    CA Forum: WebIntelligence Reporting
    farnaz:
    Have you tried to omit "internal code" from your grid?  In normal circumstances, if you have "ID" and "Quantity" on the grid, then WebI will on its own summarize Quantity based on ID, however, this is provided that Quantity has been set up as a measure (or metric).  The quickest way to tell if Quantity is a metric or not is to observe the color of its icon when you look at it in the data panel.  If it is a purple (or sometimes appears as pink or fuscia) dot, then it's a measure, but if it is a blue box then it is a dimension.  If you need Quantity as a measure then this will have to be modified at the universe (make it look like "sum(Quantity)" in the select phase of the object, and insure the object is defined as a number....

  • How can i use C/Javascript/php/Java in flex?

    can i embed these language into my flex project?
    since i have to check harddisk space, free memory remain. Also, i need to check the pixel of photos before the photos becoming bitmapdata
    please help~

    saipanBETTY0509 wrote:
    Subject: How can i use C/Javascript/php/Java in flex?
    can i embed these language into my flex project?
    You can't.  Why do you want to do this?
    saipanBETTY0509 wrote:
    since i have to check harddisk space, free memory remain. Also, i need to check the pixel of photos before the photos becoming bitmapdata
    I think what this means is "I want to check to see how much hard disk space is available.  Also, I need to check the pixel dimensions of an image."
    Is that right?
    There is no way in the Flash Player (as far as I know) that you can determine the amount of free disk space.  However, in AIR you can use air.File.applicationStorageDirectory.spaceAvailable to determine the storage space available in the application storage directory.
    As far as determining the dimensions of an image, there are plenty of good resources out there on that.  Maybe this one will be helpful to you?
    http://www.yswfblog.com/blog/2008/12/22/flash-10-experiments-the-warholizer-loading-and-pr ocessing-local-images/
      -Josh

  • How can I have popup text when user types something wrong?

    I have some textarea and textfields created dynamically. I have set of rules in a text file. How can I have these rules popup when users make mistakes(e.g., forgets to capitalize the name)?
    Please provide your input.
    Thx.
    M

    Mike
    From your addendum I'm guessing you are wanting to do this with a JSP or servlet. If so Ali's suggestion won't work becuase he's working with Swing components. It is always helpful if you specify the technology you're using: JDeveloper is a tool for writing many different types of Java programs.
    If you want to produce pop-up windows in JSP then you have to use JavaScript.
    If you're using DataWebBeans and want to use JavaScript you have to change (ie subclass) the WebBeans so that they have HTMLFieldRenderers that allow you to attach Javacript to a TextField (or whatever). This is not a small job but is worth it for the flexibility you'll gain.
    If you're using datatags I should imagine it's easier because you can add JavaScript functionality directly to the HTML input fields e.g. in the Input page, but I imagine you'll still have to subclass your own datatags to do the same for the Update pages.
    GoodLuck().youllNeedIt, APC
    null

  • How can I have user specific filters for information display on portlet?

    Hello Everyone !!!!!
    I am new to the Portlet World
    My query is..
    How can I have filters on a portlet screen ?
    I want to display certain information on a portlet which must be filtered and ordered.
    Example:
    In Internet Banking , I want to display transfers which had happened in the last month. So I ( as a user ) will keep this predefined somewhere may be in portletData.
    Whenever that user logs in for the next time, he will be able to view account transfers taken place in the lastest month only.
    This must be user specific. As another user can keep the setting in a different way. That is he/she might want to view account transfers for the last week only.
    When user clicks on a button a new screen( filter screen ) is loaded where he need to enter the dates of From and To .....
    The user saves this.....( may be in portletdata)
    So that when he logs in .. next time screen loads with the defined settings in filter....
    Any idea ? How can this be achieived ?
    Thanks in advance.... :-)
    Wating for a reply
    Message was edited by:
    dev2007

    Hey !!!
    Can anybody give me some idea regarding this ?

  • How can I have my servlet accept 100 concurrent client requests?

              My servlet extends HttpServlet so it is multithreaded. Then I have written a java
              client which starts 100 concurrent threads that try to contact the servlet.
              There are always lots of threads which are refused by the Weblogic Server 6.0.
              They get a 'Connection refused' exception. Sometimes there are 50 refused connections,
              sometimes there are 0 refused connections (not very often), sometimes there are
              80 refused connections (usually).
              I have checked the 'Servlet' documentation and the 'J2EE Design Considerations
              for Weblogic Server' which recommends not to exceede the execute thread count
              number of 15. I have not changed that value, I do not even know if it still exists
              in Weblogic 6.0 as the document refers to the 5.0 version.
              Does anybody know how to solve this problem? How can I have the client requests
              waiting rather than being refused? Of course the main goal is to serve all the
              client requests, not to refuse.
              This is the code that the client thread uses to contact the servlet:
              URL url = new URL("http://localhost:7001/examplesWebApp/myServlet");
              URLConnection conn = url.openConnection();
              conn.setDoInput(true);
              conn.setDoOutput(true);
              DataOutputStream os = new DataOutputStream(conn.getOutputStream());
              os.writeBytes()
              os.writeBytes()
              Thanks for your time,
              David
              

              The key is
              KKEY_LOCALMACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters
              There you may need add a value "MaxUserPort" as REG_DWORD (5000 is default), also
              change "TcpTimedWaitDelay" to small number (30 is minimum). You may have trouble
              to find them. Just add them.
              You can also use Microsoft Web Application Stress Tool to test your Weblogic applications.
              As a free test tool, it is really powerful, although not so flexible.
              I guess you write your own test tool with java.net.URLConnection. I am not sure
              about the power of this class. In my case, I wrote my stress test tools with Java
              Socket. I can test application on Weblogic 6 with 1000 threads with my own tool
              and Microsoft tool, depending on memory and CPU of the machines I use. I run my
              tests on both Windows 2000 professional and Solaris.
              Check your CPU and memory usage with task manager.
              On the other hand, you should check log message on Weblogic 6. Try to turn on
              HTTP debug by add the following in your config.xml in tag <Server>.
              <ServerDebug DebugHttp="true" DebugURLResolution="true"
              JDBCConn="true" JDBCSQL="true" ListenThreadDebug="true" Name="myserver"/>
              "David Ruana" <[email protected]> wrote:
              >
              >Xiang, I really appreciate your help. I changed my Weblogic server configuration
              >from the console but I still experience the same problems.
              >
              >I start my 100 threads, and from about the 20th onward all them get the
              >'Connection
              >refused' exception in the URLConnection::getOutputStream() function,
              >always after
              >a successful URLConnection::openConnetion().
              >
              >My system is Windows 2000 Professional (Spanish version). I tried to
              >check the
              >open client socket descriptor limit but I was not able to find the TCPIP/MAXUSERPORT
              >in the registry. Do you know how is this entry called in Windows 2000?
              >
              >At this point I am not sure whether my problems are related to the Weblogic
              >server
              >or to the operative system. I will keep trying... I would appreciate
              >any other
              >suggestion.
              >
              >Thank you very much.
              >
              >
              >
              >"Xiang Rao" <[email protected]> wrote:
              >>
              >>It is better to use Weblogic 6 console to configure Weblogic server.
              >>In the console,
              >>there is tab Servers->myServer->Congiguration->Tuning, you can find
              >execute
              >>length
              >>and backlog.
              >>
              >>If you use Windows as test client, note Windows have a 5000 open client
              >>socket
              >>descriptors limit. You need change Windows Registry (TCPIP/MAXUSERPORT)
              >>to change
              >>this parameter.
              >>
              >>On the other hand, during test, you should monitor your test via Weblogic
              >>console
              >>(myServer->Monitoring->Performance), here you can see the change of
              >wait
              >>queue.
              >>If the queue keeps increaing, you are in trouble.
              >>
              >>Since you know how to use MBean, try to write customized (servlet, for
              >>example)
              >>to collect the following data: opened socket number, open socket number,
              >>opened
              >>session number and open session number. The two "open" numbers will
              >give
              >>you some
              >>clue. Also record your CPU and memory usage.
              >>
              >>BTW, what is the output you get from your test in terms of number of
              >>requests
              >>per second, response time and number of bytes downloaded/uplodaed per
              >>second?
              >>Are your test client and Weblogic running on the same machine?
              >>
              >>
              >>
              >>"David Ruana" <[email protected]> wrote:
              >>>
              >>>By the way, this is a piece of the config.xml file where you can see
              >>>my Server
              >>>configuration. It is the configuration which is installed in the examplesServer
              >>>in the free evaluation of Weblogic 6.0. I only modified the AcceptBacklog
              >>>value,
              >>>and added the ThreadPoolSize="15" line which was missing (I copied
              >from
              >>>the petstoreServer).
              >>>
              >>> <Server AcceptBacklog="1000" AdministrationPort="0" ClusterWeight="1"
              >>> ConsoleInputEnabled="false" DGCIdlePeriodsUntilTimeout="2"
              >>> DefaultProtocol="t3" DefaultSecureProtocol="t3s"
              >>> HttpdEnabled="true" JavaCompiler="C:\bea\jdk130/bin/javac"
              >>> ListenPort="7001" Name="examplesServer" NativeIOEnabled="true"
              >>>     ThreadPoolSize="15"
              >>> SocketReaderTimeoutMaxMillis="10"
              >>> TransactionLogFilePrefix="config/examples/logs/"
              >>> TunnelingClientPingSecs="45" TunnelingClientTimeoutSecs="40"
              >>>XMLRegistry="examplesXMLRegistry">
              >>> <ServerDebug Name="examplesServer"/>
              >>> <WebServer DefaultWebApp="DefaultWebApp_examplesServer"
              >>> LogFileName="./config/examples/logs/access.log"
              >>> LoggingEnabled="true" Name="examplesServer"/>
              >>> <Log FileName="./config/examples/logs/weblogic.log" Name="examplesServer"/>
              >>> <KernelDebug Name="examplesServer"/>
              >>> <SSL Enabled="true" ListenPort="7002" Name="examplesServer"
              >>> PeerValidationEnforced="0"
              >>> ServerCertificateChainFileName="./config/examples/ca.pem"
              >>> ServerCertificateFileName="./config/examples/democert.pem"
              >>> ServerKeyFileName="./config/examples/demokey.pem" TrustedCAFileName="./config/examples/ca.pem"/>
              >>> </Server>
              >>>
              >>>
              >>>
              >>>
              >>>
              >>>"Xiang Rao" <[email protected]> wrote:
              >>>>
              >>>>You only need to change Weblogic HTTP configuration. Give the server
              >>>>a big socket
              >>>>Backlog number. Since you test with 100 threads, you can think 1000
              >>>to
              >>>>5000, i.e.,
              >>>>1000 to 5000 requests will be in queue before got served. Aslo, you
              >>>might
              >>>>need
              >>>>to change your OS TCP/IP settings (both test clients and servers),
              >>such
              >>>>as maximum
              >>>>number of sockets and timeout value(so closed sockets will release
              >>socket
              >>>>descriptors
              >>>>immediately).
              >>>>
              >>>>On the other hand, the number of executive threads can be much larger
              >>>>than 15
              >>>>(50-200 is a normal number), depending on the features of your application.
              >>>>You
              >>>>can try your stress test tools to find a reasonable number by analyzing
              >>>>the relationships
              >>>>among (throughtput, response time, number of executive threads, etc).
              >>>>
              >>>>
              >>>>"David Ruana" <[email protected]> wrote:
              >>>>>
              >>>>>My servlet extends HttpServlet so it is multithreaded. Then I have
              >>>written
              >>>>>a java
              >>>>>client which starts 100 concurrent threads that try to contact the
              >>>servlet.
              >>>>>
              >>>>>There are always lots of threads which are refused by the Weblogic
              >>>Server
              >>>>>6.0.
              >>>>>They get a 'Connection refused' exception. Sometimes there are 50
              >>refused
              >>>>>connections,
              >>>>>sometimes there are 0 refused connections (not very often), sometimes
              >>>>>there are
              >>>>>80 refused connections (usually).
              >>>>>
              >>>>>I have checked the 'Servlet' documentation and the 'J2EE Design Considerations
              >>>>>for Weblogic Server' which recommends not to exceede the execute
              >thread
              >>>>>count
              >>>>>number of 15. I have not changed that value, I do not even know if
              >>>it
              >>>>>still exists
              >>>>>in Weblogic 6.0 as the document refers to the 5.0 version.
              >>>>>
              >>>>>Does anybody know how to solve this problem? How can I have the client
              >>>>>requests
              >>>>>waiting rather than being refused? Of course the main goal is to
              >serve
              >>>>>all the
              >>>>>client requests, not to refuse.
              >>>>>
              >>>>>This is the code that the client thread uses to contact the servlet:
              >>>>>
              >>>>>URL url = new URL("http://localhost:7001/examplesWebApp/myServlet");
              >>>>>URLConnection conn = url.openConnection();
              >>>>>conn.setDoInput(true);
              >>>>>conn.setDoOutput(true);
              >>>>>
              >>>>>DataOutputStream os = new DataOutputStream(conn.getOutputStream());
              >>>>>os.writeBytes()
              >>>>>os.writeBytes()
              >>>>>...
              >>>>>
              >>>>>Thanks for your time,
              >>>>>David
              >>>>>
              >>>>
              >>>
              >>
              >
              

  • How can i open the popup from java class

    Hi,
    Please tell me how can i open the popup from java class.
    I am using jdev 11.1.1.7.0
    I have used the below code which works fine in jdev 2.1 but it will have some errors in 11.1.1.7.0.
    Please tell me some way to do this in all jdev versions.
    Bean obj = (Bean)RequestContext.getCurrentInstance.getExternalContext.getPageFlowScope(“obj”);
    Code for hide pop-up
    FacesContext context = FacesContext.getCurrentInstance();
    String popupId = obj.getPopUpBind().getClientId()
    ExtendedRenderKitService service = Service.getRenderKitService(FacesContext.getCurrentInstance(),
    ExtendedRenderKitService.class);
    String hidePopup = "var popupObj=AdfPage.PAGE.findComponent('" + popupId +
    "'); popupObj.hide();";
    service.addScript(FacesContext.getCurrentInstance(), hidePopup);
    Code to Show pop-up
    StringBuffer showPopup = new StringBuffer();
    showPopup.append("var hints = new Object();");
    showPopup.append("var popupObj=AdfPage.PAGE.findComponent('" +
    obj.getPopUpBind().getClientId() + "');popupObj.show(hints);");
    service.addScript(FacesContext.getCurrentInstance(), showPopup.toString());
    Code need to be added in jsff pop tag
    binding="#{pageFlowScope.bean.popUpBind}
    Variable need to be added in Bean.java
    private RichPopup popUpBind;

    Hari,
    Since you're using a non-public build of JDeveloper, you should be using a non-public forum.
    John

  • How can i get system variable using java

    Hi,
    I just want to know how can i get system variables using java code.
    for example i want to get the the date for today or i want to get the number of processes that's running.
    Thanks alot

    Hi,
    I just want to know how can i get system variables
    using java code.
    for example i want to get the the date for today or i
    want to get the number of processes that's running.
    Thanks alotSome generic "system variables" are available though Java, usually through the System class.
    Date today = new Date();
    is instantiated with the current date and time.
    Other system values, like environment values, should be passed to java through the command line (-D option) by setting system properties.
    Finally, platform specific values like the number of processes running will have to be written in platform specific code and executed by JNI (java native interface).
    Java is platform or system agnostic. Common system values, like time, are implemented. Hopefully you won't need platform specific values.

  • How can I build Instalation Program for java applet?

    I want to build on line internet game based on java applet.
    Uset must instull the game to his computer.And this program mast Connect to the server when user enter
    to this application.Not from explorer,but from my application,like when i enter to ICQ.
    My questions:
    How can i build instalation program in java?
    How can i connect to the server when user enter into my game not from explorer but from game?
    Thanks,Maya.

    Hi Maya
    First of all an Applet does not have to be "installed" as you would with a normal application. The browser handles the install and execution of the applet.
    Check out this URL for more about applets:
    http://web2.java.sun.com/docs/books/tutorial/applet/index.html
    On the subject client/server pairs - see:
    http://web2.java.sun.com/docs/books/tutorial/networking/sockets/index.html
    If you decide to make the game an application instead check out Sun's WebStart - under the products section.
    That's about all the help I can give you.
    Programming a game is a complicated subject - I am doing one too:
    http://hjem.get2net.dk/mhjembaek/armageddon/
    Kind reg,
    Hjembaek

  • How can i display the result of java class in InputText ?

    Hi all,
    How can i get the result of java class to InputText Or OutputText ???
    also can every one in the forum give me road map for dealing with java in oracle adf because i'm beginner in oracle adf
    i saw some samples in oracle adf corner but it's difficult for me.

    User,
    Always mention your JDev version, technologies used and clear usecase description (read through this announcement : https://forums.oracle.com/forums/ann.jspa?annID=56)
    How can i get the result of java class to InputText Or OutputText ???Can you elaborate on your requirement? Do you mean the return value of a method in a class as output text? Or an attribute in your class (bean?) as text field?
    -Arun

  • How can I have multiple users on iTunes (in order to connect to a shared office iPad)?

    How can I have multiple users on iTunes (in order to connect to a shared office iPad)? Currently each of us has our own iTunes account, so I've made an "all office" Apple ID. However, I can't seem to get two different accounts (my personal and the office) to work on my machine. Even when I login as "the office", my personal library is still showing. Additionally, when I try to setup with a first-time use in iTunes, I get an error that I don't meet the minimum age requirement - no matter what birthdate I enter!

    The library exists regardless of which user is logged in.
    The only way around that is to create different user accounts on the computer.
    There is no way to have 20 unique iTunes users access a shared iTunes under a single login on the computer.

Maybe you are looking for