Can JAVA execute a logic programme ?

I need to execute a logic programme in JAVA.
The logic rules are of the type: If <Condition> then <Action>.
I feel very happy with some information about
how checking a set of logic rules in a programme writen in JAVA.
Thank you, very much.

int k =0 ;
if(k==0)
else

Similar Messages

  • Can Java execute batch file outside of current JVM in separate process tree

    Hi,
    Does anyone know how to run programs from Java as separate processes that will not die when the spawning java program exits (JVM exits).
    The problem I have with using Runtime.exec is it spawns only child processes under the current running JVM, thus when the origonal program that called Runtime.exec ends so does all child processes.
    Basically I want to start a DOS batch file from my Java application, my Java application will then immediately exit (calling System.exit(0) ). The batch program will continue to run, its does some file clean up, create's some new files and deletes the old jar (containing the main app), it then rebuilds the main app jar and and executes the main class and then exits itself.
    I've also tried the apache.tomcat.jni.Proc :-
    long pool = Pool.create( new Long(0).longValue() );
    long pa = Procattr.create( pool );
    Procattr.dirSet( pa, "c:\\temp\\updater\\");
    Procattr.cmdtypeSet( pa, Proc.APR_SHELLCM );
    Procattr.detachSet( pa, 1 );
    long proc = Proc.alloc( pool );
    Proc.create( proc, "test.bat", new String[]{"test.bat"}, null, pa, pool );
    System.exit(0);
    The detach option doesn't work, if I take it off then the bat file runs and stops the JVM exiting, if I leave it in the batch file never gets called.
    Is this possible in Java. Can java start master process on Windows XP JDK1.5+?
    Cheers
    Chris.

    Well I found the answer elsewhere (java.net) thought I'd post it here for future visitors who might be experience the same problem.
    Basically Runtime can do this however it must be done the following way :-
    The java:-
    public class Main {
        public static void main(String[] args) throws Exception {
            Process p=Runtime.getRuntime().exec("cmd /c c:\\test.bat");
            System.out.println("done");
            System.out.println("quitting");
            System.exit(0);
    }The batch:-
    @echo off
    PING 1.1.1.1 -n 1 -w 5000 >nul
    java -cp "c:\ " MainThe important line that makes the whole thing work is :-
    @echo offIf this line is missing then the whole things locks up (must be the io streams getting used)
    Also this code can not be run from an IDE (well at least not from Intellj) as it also locks up.
    It must be run from a command prompt or jar.
    Also note that any commands in the batch file must have there output redirected to "nul" otherwise Windows kills the cmd as soon as it trys to output to a dead stream (dead because the Java has exited). for example :-
    @echo off
    PING 1.1.1.1 -n 1 -w 10000 >nul
    cd %1
    del /F /Q *.* >nul
    move /Y new\*.* >nul
    RD /Q /S new >nul
    PING 1.1.1.1 -n 1 -w 1000 >nul
    java -cp "c:\ " Main
    exit

  • Can Java executes Microsoft Access Macro?

    Is there any way to run a Macro of Access database from Java? How to
    do it if so?
    I searched the internet, I have not found an answer yet. It seems
    there is no way. true or false?
    We have a lot of statistic charts generated by Macros of either Access
    database or Excel and want to put on the web so that user can view the
    charts by a click from anywhere. Our web applications are developed
    in JSP and on Tomcat.
    Any suggestions are appreciated.
    Thanks

    **MAJOR SPAMMING SCUM BAG ALERT**
    I was puzzled in that you asked a SQL Server question in one post and then in another thread asked a Oracle related question... and then I noticed you had cross posted one of your questions at JavaRanch and I was more annoyed....
    and then I found this....
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=10&t=002447
    You sir -> Michael Byrd -> are scum sucking dirtbag.
    To quickly explain. Mr. Byrd posts his messages (which he copies wholesale from other posters) so that he can get better google caching for the website listed in his profile.
    This is such scummy behaviour I don't even know what to say. Other than basically everyone that has ever helped you had totally wasted their time.
    You are scum. Your company is scum. I hope you rot in hell.

  • Java interface with PLC (programmable logic controller)

    hi everyone,
    I'm a totally new to java as well as PLC. Pls help me if anyone has any idea to help me.
    I would like to create a road traffic simulator by using java which the simulator can communicate with PLC.
    I will create a crossroad. Each junction will have three colour lights (green, yellow, red).
    The PLC is to control the traffic lights in the simulator while the simulator will output the length of vehicle in each junction.
    How should i do?
    What should i do?
    I'm urgently looking forward for your answers. thank you!

    I'm assuming you are interested in using Java RTS (Sun's implementation of JSR-01) since you posted to this forum.
    Java RTS has more than enough predictability to simulate (and in fact replace in production) any PLC.
    My suggestion is that you use Java RTS for the complete simulation. It's much simpler since the complete logic can be executed in a single JVM no PLC would be required.
    If you need proof that Java RTS is so capable check out these videos.
    http://www.youtube.com/watch?v=xH1yUXd9krU (JavaOne 2007)
    http://www.youtube.com/watch?v=g5Ky2ApC4Y4 (JavaOne 2008)
    You can download Java RTS here
    http://java.sun.com/javase/technologies/realtime/rts/
    Note that for academic work there is no fee to use JavaRTS.
    Please stay in touch and let us know more about your porject. Traffic signaling and control is an area in which I am interested and for which, we believe, Java RTS offers significant advantages.
    Cheers, Greg

  • How can i execute vb scripts in java program

    hi
    how can i execute any batch files or any other exe files (vb scripts) from java programs
    thanks

    Hi,
    You use Runtime.exec to execute commands / exe-files. See the documentation (and remember that it will only work on windows):
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    /Kaj

  • How can I execute a batch file from my java program

    Hi,
    Can someone help me or direct me to a link,
    How can I execute a DOS batch file from my java program?
    Thanks

    You will need to grab a handle to the process's
    outputstream so u can see its output.The OP didn't mention any output from any batch file;
    nor any input for that
    matter,so lets not complicate matters here for now
    ok?Actually I think this is essential to see whether it works or not. It's either that or do some manual check to see whether it ran, which is not exactly elegant, and in some cases this may not be easier than simply writing the output stream code, or in fact it may be impossible to check manually.
    I'm sure it wasn't intentional that your post appeared to be bristling with attitude.

  • How can java programs execute automatically when it connects to network

    Good Day dears...
    How can java programs execute automatically when it connects to network.
    Thanks in Advance friends Shackir

    884924 wrote:
    Good Day dears...
    How can java programs execute automatically when it connects to network.What is "it"? That is, execute when what connects to the network?
    Your computer? If that's what you mean, this is not a Java question. It's an OS operational/administrative question. Executing any program, whether written in Java or not, based on some system event has to do with that system, not with the program. If it's possible to do this, you'd do it exactly the same way for a Java program as you would for any other program.
    Or is "it" the program itself? If this is what you mean, then it's a nonsensical question. For the program to connect to the network and detect that it has connected to the network, it must already be executing, so asking how to execute it at that point is meaningless.
    Finally, I'll point out that "connecting to the network" is a pretty meaningless phrase. Or rather, it has so many potentially valid meanings that it's impossible to know which one you're referring to when you use that phrase. And I'd be willing to bet you don't have a clear picture of that yourself.

  • Can java script be executed inside Acrobat reader 7

    Hello All
    I am quire new to Acrobat. Please tell me if I can execute a java script in Acrobat reader.
    I am using itext library to add java script to a pdf and opening the pdf in reader and get the error
    NotAllowedError: Security settings prevent access to this property or method.
    Global.addWatermarkFromText:1:Document-Level:0000000000000000
    First question can I execute this javascript with Reader itself. If yes how should i get rid of this error

    The Acrobat SDK cannot be used to change the information shown for
    each method in the quick bar in the documentation. If that says the
    method does not work in Reader, then it does not work in Reader...
    I do not think there is any similar method for Reader (adding a
    watermark) - very much an Acrobat function. Unless you can pre-create
    the watermark as a form field, so you only have to change the text at
    runtime.
    Aandi Inston

  • How can i execute excelsheet without giving path in java

    Hi,
    How can i execute excelsheet without giving path in java, through this code, you can open the notepad but
    I want whereever the excel is installed in your machine , fine and open excelsheet without given absolute path.
    class ExecuteCommand{
    public static void main(String d[]){
         Runtime r = Runtime.getRuntime();
         Process p= null;
         try{
         p = r.exec("notepad");
              catch(Exception e){
                   System.out.println("error");
    If you know please send me your idea and code samples.
    regards
    Mohan kumar

    just execute the exelfile with the Windows "start" command:
    Runtime.exec("cmd /c start "+excelFileName);But this requires that Excel is the default application for the Excel file type (*.xls). You can test this by simply typing "start myTestExcel.xls" in a dos box.

  • Can java app programmer make secure app?

    I am the author of the Interactive Color Wheel. It (in various versions) has been on the web since 1998, and has been very popular. With the recent hysteria about Java security, I have observed hits fall off dramatically. While it is not commercial and I'm not losing money, the drop-off still concerns me.
    So the question is, until such time as Oracle fixes it, what can I as an app programmer do to alleviate the problem?
    It seems quite ironic that the java app "sandbox", which was supposed to ensure security, seems to be the very source of the current problem. As far as I know, my app:
    * uses the screen
    * accesses the mouse and keyboard
    * accesses resources within its own JAR
    It does not:
    * access the web
    * write/read cookies (or do anything else on the file system)
    With these limitations, is my app even dangerous?

    I'm ignorant concerning the plug-in magic that gives a Java applet a sandbox to run in which protects the rest of the computer (and the world!) from devious programmers. How I view it is the Java Run Time (JRT) does not need a browser plug-in, but the plug-in needs the JRT. That would make them two separate things. If the plug-in for Java 6 releases was safe, why cannot it be packaged with the Java 7 JRT?
    Yes it was a rant -- not really at the whole world, but the journalists and supposed experts they interviewed. And certainly not directed at anyone here! I did not even know there was a problem until I allowed the JRT to upgrade last week, and my app would not run normally any more. At first I blew it off as "the installation screwed up". So I de-installed and re-installed the upgrade several times, and the security block did not go away.
    So I was frustrated but not yet angry. Then during the weekend I got serous about tracing down the problem, and discovered there really was a security issue. From my first question, you can see I still did not understand, thinking that devious internet Voodoo could make my app insecure. If that were the case, how would I block the Voodoo?
    Then I learned here that my applet was not in fact insecure. The press and "experts" were just telling people it (Java in general) was. I don't know what you have read, but there are some ridiculous claims being made. Not just disable Java for the time being (which the browsers are doing automatically now), but that it is inherently unsafe. Completely uninstall it and never re-install. Or the problem is so bad, it will take Oracle two years to fix. I know as a programmer those extreme claims are foolish, and I allowed that to affect me emotionally. I apologize.

  • Can I execute MySql's command from java application?

    Can I execute MySql's command from java application? And how?
    For example :
    load data local infile 'D:\\myData.txt'
    into table myTable
    fields terminated by ';'
    lines terminated by '\n';

    1. get the jdbc driver for mysql from the mysql site at: http://dev.mysql.com/downloads/connector/j/5.0.html
    2. follow the installation instructiions... which you'll also find in your mysql manual...
    Happy travels. Keith.

  • Is there online platform where we can execute our ABAP Programme

    Hi Buddies,
    Could some one let me know where i can execute my abap programmes online.
    Because most of the time i used to implement outside the home. where abap software installation is not possible.
    So that i need a platform where i can execuet my programme online.
    ~Rashid

    I found this site host free Ides Service, www.ides.consolut.eu  you need to register with this. It is a training server, so Most of the features will be disabled, If you are looking out for a basic, functionality yo can go with this one. I am not sure if you can access this from india. You can try it.

  • How can we execute the BDC session in error mode through se38 programme

    Dear Experts,
    How can we execute the BDC session in error mode through se38 programme....
    we can execute the session in the below 2 ways
    1) Through SM35 we can process the session manually in foreground/Error mode or Background also.
    2) through RSBDCSUB (standared Program) we can process the session in back ground.
    But i want to process the session in foreground or Error mode..Do we have any standared program for process the session in foreground or error mode.
    Please suggest.
    Regards,
    Bussa.

    Hi,
    SAP was smart enough to provide this little program: RSBDCCTU
    Sandra
    Edited by: Sandra Rossi, 15 minutes later
    Maybe the answer to your question is just to use CALL TRANSACTION ... USING ... (see the example in RSBDCCTU). You can also generate such a program using transaction SHDB

  • Can you execute a class file without invoking the command line java command

    I am running java on a Windows XP equipped machine, and I am wondering if it is possible to execute a class file by double clicking the file icon, or can it only be done via command line. So far I have been unsuccessful in my attempts - I tried associating the class file with the java executable in my JRE directory, but that didn't work.
    Many thanks,
    -Stile

    nope, can't be done, by design... microsoft recognised java as threat to the empire very early on in the peace.... but you can write a batch file to execute myprogram.class called myprogram.bat and stick it in your PATH.
    keith.

  • How can i execute a workflow using a bapi/wapi??

    Hi All,
    How can i execute a workflow using a bapi/wapi??
    pls advice
    thanks

    Hi Hrus,
    it's not as simple as a single BAPI to approve a workflow.
    Workflow comes with a Workflow API (WAPI) that you can use to programmatically interact with the workflow system. The WAPI is implemented as a group of RFC-enabled function modules that are prefixed with "SAP_WAPI_".
    Approving a workflow is simply taking a decision path for a workflow item. It is logically no different to rejecting the same workflow item or any other workflow decision.
    As part of NetWeaver workflow is tightly coupled to the WAS platform you are running on so you may need to perform WAPI operations slightly differently on older releases.
    Some of the WAPI calls you might need to use include: -
      SAP_WAPI_GET_HEADER to get the workitem header
      SAP_WAPI_READ_CONTAINER to get the workitem container
      SAP_WAPI_GET_OBJECTS to get the attached objects
      SAP_WAPI_DECISION_READ to get a list of possible decisions
      SAP_WAPI_SET_WORKITEM_STATUS to set the workitem status
      SAP_WAPI_WRITE_CONTAINER to write to the workitem container
      SAP_WAPI_EXECUTE_WORKITEM to execute the workitem
    I usually do what you are trying to do by adding the decision to the workflow container and then executing the workflow.
    Be warned, you can really stuff things up if you get this wrong! Make sure you know what you are doing.
    Quoting from Practical Workflow for SAP by Alan Rickayzen, et al from SAP Press...
    Writing directly to the workflow container is dangerous because it can compromise the integrity of the process.
    ...be careful that you do not waste time duplicating existing ad hoc features of SAP's Workflow Engine.
    For example you can use events (combined with wait steps), instead of container modifications to force the workflow to restart.
    Cheers
    Graham Robbo

Maybe you are looking for