Recent Updates RSS Toggle Comment Threads | Keyboard Shortcuts

  • poidasmith 9:41 pm on June 16, 2009 Permalink | Reply  

    WinRun4J 0.3.3 Released 

    A new version of WinRun4J is available. It contains the following fixes and new features:

    • Moved service name, description and controls accepted to INI file
    • Refactored Service interface and added AbstractService helper class
    • Implemented FileAssociations helper class
    • Greatly improved the Registry API
    • Option to log to console and file
    • Log file rolling
    • Fix for relative log file path

    The Registry API has been refactored to be easier to use (no need to open/close).

    The Service API is now also much easier to use, with an AbstractService class. This makes the example service implementation much simpler:

    package org.boris.winrun4j.test;
    
    import org.boris.winrun4j.AbstractService;
    import org.boris.winrun4j.EventLog;
    import org.boris.winrun4j.ServiceException;
    
    /**
     * A basic service.
     */
    public class ServiceTest extends AbstractService
    {
        public int serviceMain(String[] args) throws ServiceException {
            int count = 0;
            while (!shutdown) {
                try {
                    Thread.sleep(6000);
                } catch (InterruptedException e) {
                }
    
                if (++count % 10 == 0)
                    EventLog.report("WinRun4J Test Service",
                          EventLog.INFORMATION, "Ping");
            }
    
            return 0;
        }
    }

    The shutdown variable is set to true when the service is requested to close by the service control manager.

    You can download the new version from the WinRun4J Sourceforge Site.

     
    • nielm 10:53 am on June 19, 2009 Permalink | Reply

      Thanks for creating this — it’s a very useful tool.

      One small point about the log.file.and.console setting – - I did not realise that it was only for WinRun4J logging, (and java logging via the ‘Log’ class). I had assumed that all stdout/stderr was redirected to both destinations (similar to Unix’s Tee: a very useful tool!), and spent ages trying to figure out why it was not working!

      • poidasmith 9:47 am on June 20, 2009 Permalink | Reply

        Yes, this is a good point. I’ll update the documentation to point this out for the moment.

        • Kirill 9:04 am on October 15, 2009 Permalink

          I proud that I also took a part in winrun4j logging! (log & log.overwrite options :)

    • jaking 3:26 pm on July 6, 2009 Permalink | Reply

      Hi,
      First of all thank you for this great tool, it is very intuitive.

      I am currently evaluating this tool along with “Java Service Wrapper” and I have encountered a problem when setting up a service with JRE packaged with the application

      I have the following ini setup:
      vm.location=jre/bin
      service.class=org.boris.winrun4j.test.ServiceTest
      service.id=ServiceTest
      service.name=WinRun4J Test Service
      service.description=An example service using WinRun4J.
      classpath.1=*.jar

      When I try to launch the service I get the following error:
      [info] Module Name: D:\service\winruntest\service.exe
      [info] Module INI: D:\service\winruntest\service.ini
      [info] Module Dir: D:\service\winruntest\
      [info] INI Dir: D:\service\winruntest\
      [info] Found VM: D:\service\winruntest\jre\bin
      [info] Expanding Classpath: *.jar
      [info] Expanding Classpath: D:\service\winruntest/WinRun4J.jar
      [info] Expanding Classpath: D:\service\winruntest/WinRun4JTest.jar
      [info] Generated Classpath: D:\service\winruntest\WinRun4J.jar;D:\service\winruntest\WinRun4JTest.jar
      [info] VM Args:
      [info] vmarg.0=-Djava.class.path=D:\service\winruntest\WinRun4J.jar;D:\service\winruntest\WinRun4JTest.jar
      [info] Main Class: org/boris/winrun4j/test/ServiceTest
      [err] ERROR: Could not load library: D:\service\winruntest\jre\bin
      [err] Error starting Java VM

      Am I missing something?
      Thanks

      • jaking 4:29 pm on July 6, 2009 Permalink | Reply

        Hi,

        Problem solved by replacing jre/bin witj jre/bin/client/jvm.dll

        • poidasmith 7:30 pm on July 6, 2009 Permalink

          Admittedly its a little unclear that you need to point to the DLL. I’ll update the website docs to make it more explicit.

        • poidasmith 7:31 pm on July 6, 2009 Permalink

          BTW, let me know how you get on with your evaluation. I’d be interested to hear what differences you found and pros/cons between the two.

        • jaking 11:12 am on July 14, 2009 Permalink

          Hi,

          While evaluating WinRun4J and JSW I was left with the following impressions (so far):

          1) I found both solutions very easy to setup and get started, but WinRun4J felt much “cleaner” to deploy and configure.
          2) JSW was alot more helpful in those situations where it holds control by providing logging info.
          E.g. if the service can´t start because the path to an embedded jvm is incorrect, JSW informed me of that fact while WinRun4J left me guessing.
          3) This point is more of a question than an opinion since I experienced a JVM “crash” with JSW and not with WinRun4J.
          First, so that there is no confusion, I know for a fact that the crash was not due to a JSW issue.
          My question is: JSW made it possible for my app (service) to recover from the JVM crash, how would WinRun4J react in the same situation (JVN crash)? Do we need to include any measures as a precaution?

          For now I am not going to leave any humble Overall… sentences, but, I am enjoying this excellent tool and I will be using it!!!

          Thanks again for this great tool.

        • poidasmith 7:40 pm on July 15, 2009 Permalink

          Hi,

          Thanks for the feedback!

          Certainly the logging could be improved to provide the user with more pertinent information on failure.

          WinRun4J doesn’t do anything clever around restarts etc.. I have a todo to detect when the JVM hangs and report this and react (possibly shutdown). I just have to find a rock-solid way of detecting a hang… As for restarting its certainly possible (if a little clunky) but I imagine native services don’t have this feature because the service control manager does (eg. restart on first failure, second failure etc.. – see the recovery tab on the service properties).

          Regards,
          Peter

    • jaking 2:04 pm on July 15, 2009 Permalink | Reply

      I setup a small test to launch an application with the following .ini file and corresponding exe file:

      vm.location=../jre/bin/client/jvm.dll
      vm.version=1.6.0_11
      classpath.1=../lib/*.jar
      working.directory=.
      main.class=some.domain.topic.Main

      When I launch the app using the exe file, I noticed that the correspoding command window was also launched.

      If WinRun4J “is an alternative to javaw.exe”, why is there a corresponding command window when the app is launched.

      I don’t see anything in the ini keys that i could use to prevent this.

      Am I missing something?

      • poidasmith 7:41 pm on July 15, 2009 Permalink | Reply

        Hi,

        Are you perhaps using the WinRun4Jc.exe (ie the console version of the launcher)? This will cause a console to appear if it isn’t run from an existing console. If you want the same behaviour as javaw.exe you need to use WinRun4J.exe.

        Regards,
        Peter

        • jaking 8:41 am on July 16, 2009 Permalink

          Hi,

          Yip, I was using WinRun4Jc.exe – changed it for WinRun4J.exe and no command window appears.

          Thank you

    • weishaupt@bernot.net 7:57 am on July 24, 2009 Permalink | Reply

      Hi,

      I still have problems running WinRun4j version 0.3.3 as windows service (WinXP SP2 German) .
      1 (critical): start and stop service manually runs fine. But if I logoff the user from windows – the service crashes hard. After login the service isn’t running – no log message – nothing.

      2: running your TestServiceArgs produces the following log:
      [info] Module Name: D:\downloads\winrun4J-0.3.3\winrun4j\bin\service\service.exe
      [info] Module INI: D:\downloads\winrun4J-0.3.3\winrun4j\bin\service\service.ini
      [info] Module Dir: D:\downloads\winrun4J-0.3.3\winrun4j\bin\service\
      [info] INI Dir: D:\downloads\winrun4J-0.3.3\winrun4j\bin\service\
      [info] Working directory set to: D:\downloads\winrun4J-0.3.3\winrun4j\bin\service
      [info] Found VM: C:\Programme\Java\jre6\bin\client\jvm.dll
      [info] Expanding Classpath: *.jar
      [info] Expanding Classpath: D:\downloads\winrun4J-0.3.3\winrun4j\bin\service/WinRun4J.jar
      [info] Expanding Classpath: D:\downloads\winrun4J-0.3.3\winrun4j\bin\service/WinRun4JTest.jar
      [info] Generated Classpath: D:\downloads\winrun4J-0.3.3\winrun4j\bin\service\WinRun4J.jar;D:\downloads\winrun4J-0.3.3\winrun4j\bin\service\WinRun4JTest.jar
      [info] VM Args:
      [info] vmarg.0=-Xdebug
      [info] vmarg.1=-Xnoagent
      [info] vmarg.2=-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
      [info] vmarg.3=-Djava.class.path=D:\downloads\winrun4J-0.3.3\winrun4j\bin\service\WinRun4J.jar;D:\downloads\winrun4J-0.3.3\winrun4j\bin\service\WinRun4JTest.jar
      [info] Program Args
      [info] arg.0=hallo
      [info] arg.1=hallo2
      [info] arg.2=hallo3
      [info] Main Class: org/boris/winrun4j/test/TestServiceArgs
      Listening for transport dt_socket at address: 8787
      [info] Registering natives for Log class
      [info] Registering natives for INI class
      [info] Registering natives for SplashScreen class
      [info] Registering natives for Registry class
      [info] Registering natives for Shell class
      [info] Registering natives for EventLog class
      [info] args.length=0
      [info] TestServiceArgs running…

      As you can see I pass 3 args but in the main method the args[].length is 0

      3: Don’t set the working.directory=. causes the working.directory to be C:/WINDOWS/system32

      Regards,
      Rainer

      • poidasmith 8:44 pm on July 27, 2009 Permalink | Reply

        Hi,

        For 1. Try adding the -Xrs vm option – this should prevent the shutdown on logoff.
        For 2. How are you setting the start parameters? Is it via the service properties, general tab, start parameters?
        For 3: This will be set by the service control manager – I guess it would be reasonable to default the working directory to “.” when running as a service. I’ll add this to the todo list.

        Thanks,
        Peter

        • MistaP 6:18 pm on November 25, 2009 Permalink

          Using the WinRun4J64c.exe, I tried setting two args, I get the same issue as Rainer

        • MistaP 9:58 am on November 26, 2009 Permalink

          I set the paramaters in Properties tab and hit start. That passed the parameters in, but the nt service will not save those parameters. I was hoping the ini file would work, as a workaround for now I test if the args passed in is lenght is 0, if so then build the args from a vmarg.X=-Darg.1=myValue

          fyi on another note; I had service.class=foo and main.class=foo in the same ini file, that causes issues, I kept getting told ClassNotFound until I removed main.class

          P

        • poidasmith 9:40 am on November 27, 2009 Permalink

          Hi,

          I’m not aware of a way to get windows to save those start parameters. You’re best bet is to add the properties you need to the ini file and then use the INI class to access these directly.

          The main.class/service.class is the switch to tell the launcher which mode to use instead of having to specify mode=service as another parameter… it should probably output an error message if you specify both main.class and service.class.

          Cheers,
          Peter

    • doschhar 7:26 pm on September 11, 2009 Permalink | Reply

      Oh – mabye my first reply did not work – got a huge error msg …
      Found a small glitch with the icon handling of the WinRun4J.exe – once added it only shows the small icon in the explorer – on the desktop still shows the “running guy” icon. With WinRun4Jc.exe booth icon work – strange?!

      Nice tool,
      Harald

    • Stas 9:53 am on October 21, 2009 Permalink | Reply

      Hi!
      I’d like to help WinRun4J with Ant task.
      Please contact me if you’re interested.

    • acarman 5:36 pm on November 4, 2009 Permalink | Reply

      Hi,
      We are looking at using this software to inject some icons into executables. We however would like to have the ability to use it under linux to create windows executables.
      I had a peek a the source code, and the portion of the program pertaining to what we would like to acomplish seems to use a winapi call UpdateResource. If this is so, it is possible that you know of a way this is doable under java?
      Is a java port somthing that is even possible, this would be the best option for what we are looking at.
      Thanks

      • poidasmith 8:53 pm on November 4, 2009 Permalink | Reply

        Hi,

        It won’t be possible to port this easily – its the windows api call that is doing all the work. A java one is possible and is almost complete at: http://pecoff4j.sourceforge.net/ (one of my other projects). This is a parser/assembler for windows exe/dlls. It still needs a little more work on resource entries and assembling though.

        Regards,
        Peter

        • acarman 3:07 pm on November 5, 2009 Permalink

          Peter thank you very much for your response. We will be following pecoff4j very closely. This seems to be exactly what we need!

  • poidasmith 11:34 am on June 10, 2009 Permalink | Reply
    Tags: backup, , , twitter,   

    Twitter Backup Utility 

    The following is a simple tool I hacked together in Java that downloads your twitter statuses to a directory, to test out the new WinRun4J Plugin for Eclipse. I wrote a simple Java class and then exported it to a single fat executable (console version): TwitterBackup.exe.

    Note that you need Java to run this application: You can download it from here.

    If you run it without command line arguments you get:

    Twitter Backup v0.1.0 @winrun4j
    
    A backup utility for Twitter statuses.
    
    TwitterBackup [-user <user>|-search <search>] -outdir <backup_dir>
        [-limit #hours|day|week|month|year]
    

    The -user option is simply your twitter user id.

    The -search option is a search query (you probably want to put “quotes” around it).

    The -outdir option is the directory you want the statuses saved into.

    The -limit option sets a time/date limit on the history, so “day” only loads statuses for the last 24 hours. The #hours is a number of hours (e.g. -limit 4 only saves statuses from the last 4 hours).

    Some examples:

    TwitterBackup -user twitter -outdir C:/TEMP -limit 12
    

    This will save the “twitter” user’s statuses from the last 12 hours to the directory C:/TEMP.

    TwitterBackup -search "cool filter:links" -outdir C:/TEMP -limit day
    

    This will save all search results for “cool filter:links” for the last 24 hours to the directory C:/TEMP.

    The utility is also incremental so you can run it over and over again and it will only grab new statuses.

    It is designed to be run as a scheduled task (e.g. setup a schedule task to run every week and use the -limit week option).

    Each twitter status is saved into a separate file using the unique status id provided by twitter. It simply contains the RSS item XML.

    You can download TwitterBackup here

    Note that Twitter has limits on how much you can download at one time and how far back in time you can go.

    BTW The utility should work as specified but the author accepts no responsibilities is something screws up. Use at your own risk.

     
  • poidasmith 2:59 pm on June 8, 2009 Permalink | Reply
    Tags: configuration, explorer, file associations,   

    Launcher File Double-Click in Explorer 

    The following is a potentially useful hack if you have plenty of different java apps you need to launch from explorer but don’t want to create separate launcher files for each launcher configuration file.

    Using Windows file associations we create a new file association for *.winrun4j to the WinRun4J launcher. The command executed is the new WinRun4J --WinRun4J:ExecuteINI command added in the previous release.

    The following registry script updates the appropriate entries:

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\.winrun4j]
    @="WinRun4JLaunch"
    "PerceivedType"="text"
    
    [HKEY_CLASSES_ROOT\.winrun4j\OpenWithList]
    
    [HKEY_CLASSES_ROOT\.winrun4j\OpenWithList\WinRun4J.exe]
    
    [HKEY_CLASSES_ROOT\WinRun4JLaunch]
    @="WinRun4J Launcher Configuration"
    
    [HKEY_CLASSES_ROOT\WinRun4JLaunch\DefaultIcon]
    @="F:\\Development\\tools\\WinRun4J.exe"
    
    [HKEY_CLASSES_ROOT\WinRun4JLaunch\shell]
    
    [HKEY_CLASSES_ROOT\WinRun4JLaunch\shell\open]
    
    [HKEY_CLASSES_ROOT\WinRun4JLaunch\shell\open\command]
    @="F:\\Development\\tools\\WinRun4J.exe --WinRun4J:ExecuteINI %1"
    

    This assumes that you have the latest version of the launcher saved into F:/Development/tools – if not just change the above entries to point to your folder.

    The following screenshot shows a bunch of launcher files:

    Now you can create any launch configuration and give it a .winrun4j extension and then double-click to launch.

    Caveat: As per usual, make sure you backup your registry before modifying.

     
  • poidasmith 5:52 pm on June 4, 2009 Permalink | Reply
    Tags: eclipse, , plugin,   

    New Eclipse Plugin for WinRun4J 

    The initial version of the Eclipse Plugin for WinRun4J is now available from the WinRun4J SourceForge site.

    The Update Site URL is: http://winrun4j.sourceforge.net

    The main features of the addin are (as per the website):

    • Launch any Java Application with WinRun4J (via right-click or launch configuration)
    • Export your Java Application as a single Windows Executable (with necessary jars embedded)
    • Provides improved windows integration from Eclipse (eg. JNI access to Registry).

    To install the plugin in eclipse go to Help->Software Updates… then select Add Site… then
    add http://winrun4j.sourceforge.net and click OK. The select “WinRun4J Eclipse Plugin 0.1.0″ and click Install… and follow the prompts.

    Further help on using the plugin is on the plugin website

     
  • poidasmith 8:46 am on May 31, 2009 Permalink | Reply
    Tags: eventlog, , scm, service, windows,   

    Create a Windows Service for Java using WinRun4J 

    The following is a quick tutorial on a creating a windows service in Java using WinRun4J.

    The first step is to download WinRun4J.

    Now unzip it into any folder, create a new directory called service and copy over the following files from the download:

    • WinRun4Jc.exe
    • service.ini
    • WinRun4J.jar
    • WinRun4jTest.jar

    Now rename WinRun4Jc.exe to service.exe and you should have a folder that looks like this:

    Now we need a command prompt with Administrator priveleges. This can be created in Vista/Windows7 by going Start->All Programs->Accessories, right-click on Command Prompt and select Run as Administrator:

    Now change into the service directory you created above:

    To register the service with the Windows Service Control Manager (SCM), run the following command:

    C:\downloads\service>service.exe --WinRun4J:RegisterService
    

    Now if you start up the Windows service viewer you should see the WinRun4J test service:

    You can start/stop the service using the service viewer.

    The code listing for the service implementation is as follows:

    package org.boris.winrun4j.test;
    
    import org.boris.winrun4j.EventLog;
    import org.boris.winrun4j.Service;
    import org.boris.winrun4j.ServiceException;
    
    /**
     * A basic service.
     */
    public class ServiceTest implements Service {
        private int returnCode = 0;
        private volatile boolean shutdown = false;
    
        public int doRequest(int request) throws ServiceException {
            switch (request) {
            case SERVICE_CONTROL_STOP:
            case SERVICE_CONTROL_SHUTDOWN:
                shutdown = true;
                break;
            }
            return 0;
        }
    
        public int getControlsAccepted() {
            return SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
        }
    
        public String getName() {
            return "WinRun4J Test Service";
        }
    
        public String getDescription() {
            return "An example service using WinRun4J.";
        }
    
        public int main(String[] args) throws ServiceException {
            int count = 0;
            while (!shutdown) {
                try {
                    Thread.sleep(6000);
                } catch (InterruptedException e) {
                }
    
                if (++count % 10 == 0)
                    EventLog.report("WinRun4J Test Service", EventLog.INFORMATION,
                            "Ping");
            }
    
            return returnCode;
        }
    }
    

    The main method is called from the WinRun4J launcher when the service is required to run. This method should not return until the service is shutdown.

    The doRequest method is called by the WinRun4J launcher on a separate thread (i.e. the service control thread). This method should modify the state of the application based on the request type passed in. In the example we just modify the shutdown flag.

    The getName and getDescription methods are called when the service is registered. These values appear in the service viewer.

    The example service simply logs to the windows event log every minute.

     
    • Rogerio 7:33 pm on June 2, 2009 Permalink | Reply

      Hello.
      Thanks for this product.
      Could I make a sugestion?
      It would be great to have a feature that could restart the application, without stopping the exe. It would stop only the jvm, and relaunch it…
      Thanks!

    • poidasmith 8:08 pm on June 2, 2009 Permalink | Reply

      Hi,
      What would be the benefit of stopping only the jvm? Presumably all your state would live in the jvm anyway?
      Thanks

      • Rogerio 8:25 pm on June 2, 2009 Permalink | Reply

        If I could programmatically restart the jvm, I could detect configuration changes (or even jar updates), and restart the program, without the windows service restarting.
        But if I could restart the service internally, that would be good as well.
        Thanks!

      • Rogerio 8:33 pm on June 2, 2009 Permalink | Reply

        I forgot, restarting only the jvm would be beneficial to exe’s too, like firefox restart after updating addons. The exe would still be running, but the java application would close and return updated.
        I already do that using the Java Wrapper by Tanuki Software, but my software will be commercial, and the license cost is prohibitive.
        Thanks!

        • poidasmith 9:18 pm on June 2, 2009 Permalink

          OK, yes, this is a feature that is on the todo list. Thanks.

    • illya 3:33 pm on June 3, 2009 Permalink | Reply

      Thanks for the product…

      I’m having some issues, I don’t know if this is the best place to ask for help….but anyway…

      It seems I cannot configure sending arguments to a service. I have the service implementing Service and have some System.out of the parameters args in the method
      public int main(String[] args) throws ServiceException

      But it seems that the args are always null.

      Thanks

      • poidasmith 5:06 pm on June 3, 2009 Permalink | Reply

        Hi,

        Thanks for the feedback. There is an issue in the launcher where service parameters aren’t passed correctly. There will be a new version ready very soon that will address this.

        Thanks.

      • poidasmith 1:58 pm on June 4, 2009 Permalink | Reply

        Hi,

        There is a new release of WinRun4J (0.3.2) that addresses this issue.

        Regards.

        • mmastrangelo 7:25 pm on October 3, 2009 Permalink

          I am running 0.3.3, and can’t seem to get an argument passed into my serviceMain method (in a subclass of AbstractService). I have a single argument defined in my ini file in the “arg.0″ property.

          The argument appears to be recognized when the service starts:

          [info] Program Args
          [info] arg.0=C:/temp/

          …however I get an ArrayIndexOutOfBounds exception when I try to read element 0 in the args array.

          Any help would be appreciated!

    • illya 4:26 pm on June 4, 2009 Permalink | Reply

      Thanks a lot, I’ll check it

    • Rogerio 11:36 pm on June 4, 2009 Permalink | Reply

      Hello again!
      It seems I cannot set the working.directory because it fails to register the service with: [err] Could not find service class
      I´m trying to set it to parent (..).
      If I move the exe and ini to the parent dir it works, if I change the classpath’s to include “../”, it works too…
      Shouldn´t it work relative to the working dir?
      Thanks!

      • poidasmith 6:59 am on June 5, 2009 Permalink | Reply

        Hi,

        The launcher does use the working directory when generating the classpath unless it has not been set in the INI (in which case it uses the directory of the INI file as the working directory).

        When you have logging level set to info do you see a line that says:

        [info] Working directory set to:

        Regards.

        • Rogerio 2:12 pm on June 5, 2009 Permalink

          Yes, I had set int the INI: working.directory=..
          I am in path: C:\semasp\winrun4j
          I see a line: [info] Working directory set to: C:\semasp
          The classpath is correct: classpath.1=winrun4j/*.jar
          classpath.2=bin/*.jar
          But the bug is:
          If I call the executable without args, the classpath does get expanded:
          [info] Expanding Classpath: winrun4j/service.jar
          [info] Expanding Classpath: winrun4j/WinRun4J.jar
          [info] Expanding Classpath: bin/*.jar
          [info] Expanding Classpath: C:\semasp\bin/sitefweb_comunicserver.jar
          [info] Expanding Classpath: C:\semasp\bin/sitefweb_infra.jar
          [info] Expanding Classpath: C:\semasp\bin/sitefweb_profile.jar
          [info] Expanding Classpath: C:\semasp\bin/sitefweb_rmiserver.jar
          [info] Expanding Classpath: bin/lib/*.jar
          [info] Expanding Classpath: C:\semasp\bin\lib/drivers_jdbc.jar
          [info] Expanding Classpath: C:\semasp\bin\lib/framework_log.jar
          [info] Generated Classpath: C:\semasp\winrun4j\service.jar; (…)

          BUT if I call it with –WinRun4J:RegisterService, I get:
          [info] Expanding Classpath: winrun4j/service.jar
          [info] Expanding Classpath: winrun4j/WinRun4J.jar
          [info] Expanding Classpath: bin/*.jar
          [info] Expanding Classpath: bin/lib/*.jar
          [info] Generated Classpath: (empty line)

          [err] Could not find service class

          That´s it.
          Thank you for your attention.

        • Rogerio 2:18 pm on June 5, 2009 Permalink

          In my example, I tried to include winrun4j/service.jar and winrun4j/WinRun4J.jar directly, instead of winrun4j/*.jar, but it is no different.
          Only when trying to register the service…

        • poidasmith 2:21 pm on June 5, 2009 Permalink

          OK, yes, I can see the problem now – the launcher is not setting the working directory when the register service command is specified. Thanks for finding that one!

          I will get a fix out shortly for this.

          I think in the future version I will move the name and description to the INI file so it doesn’t need to startup the VM just to get these two bits of information when registering the service…

        • poidasmith 2:27 pm on June 5, 2009 Permalink

          BTW in the short term you could add fixed paths eg

          classpath.1=c:\semasp\bin\*.jar

          or even use evironment variables: APP_HOME=c:\semasp

          then
          classpath.1=%APP_HOME%\bin\*.jar

        • Rogerio 2:57 pm on June 5, 2009 Permalink

          Ok, Thank you for your great work!
          Humm, great idea moving the name and description to the INI! It was kind wierd setting the service params in two different places.
          And if I need to change the name or description (to several customers), I don´t need to recompile! It is very good!
          Thanks again…

    • Rainer 7:38 pm on June 16, 2009 Permalink | Reply

      Hi,
      i’m running version 0.3.2 and try to start my osgi environment as a windows service.
      there is still the problem, that the args aren’t passed to the main method of the class implementing Service. The length of the array is correct but the values are empty.
      For when is the next release planed?
      Thanks Rainer

  • poidasmith 7:54 am on May 27, 2009 Permalink | Reply
    Tags: , executable, jar, ,   

    Create a Windows Executable for Java with Embedded JAR Files 

    The following is a quick tutorial on how to create a single executable for a java application using WinRun4J. We will also give it a splash screen.

    To start download WinRun4J.

    Now unzip it into any folder, create a new directory called winrun4j and copy:

    • WinRun4J.exe
    • WinRun4J.jar
    • WinRun4JTest.jar
    • WinRun4J.ini
    • SplashScreen.gif
    • RCEDIT.exe

    You should now have a folder that looks like this:

    Now create a console window and change directory to your winrun4j folder:

    Now its time to use RCEDIT to embed the files into the WinRun4J executable. If you run RCEDIT you should see the following output:

    F:\winrun4j>RCEDIT.exe
    WinRun4J Resource Editor v1.0 (winrun4j.sf.net)
    
    Edits resources in executables (EXE) and dynamic link-libraries (DLL).
    
    RCEDIT   [resource]
    
      filename      Specifies the filename of the EXE/DLL.
      resource      Specifies the name of the resource to add to the EXE/DLL.
      /I            Set the icon as the default icon for the executable.
      /A            Adds an icon to the EXE/DLL.
      /N            Sets the INI file.
      /J            Adds a JAR file.
      /E            Extracts a JAR file from the EXE/DLL.
      /S            Sets the splash image.
      /H            Adds an HTML file the EXE/DLL.
      /C            Clears all resources from the EXE/DLL.
      /L            Lists the resources in the EXE/DLL.
      /P            Outputs the contents of the INI file in the EXE.
    
    F:\winrun4j>
    

    So to embed the JAR files we need to run the following command:

    F:\winrun4j>RCEDIT.exe /J WinRun4J.exe WinRun4J.jar
    

    And:

    F:\winrun4j>RCEDIT.exe /J WinRun4J.exe WinRun4JTest.jar
    

    Now we need to edit the WinRun4J.ini file to contain the necessary instructions (or in this case remove the unnecessary ones). After editing it should look like this:

    main.class=org.boris.winrun4j.test.WinRunTest
    

    Now we are ready to embed this file into the executable:

    F:\winrun4j>RCEDIT.exe /N WinRun4J.exe WinRun4J.ini
    

    The last thing we want to do is embed the splash screen:

    F:\winrun4j>RCEDIT.exe /S WinRun4J.exe SplashScreen.gif
    

    You should see that the WinRun4J.exe file has increased in size:

    You should now be able to double click on the WinRun4J.exe and launch the java application:

    To check that there are no magic tricks you can delete the other files (i.e. WinRun4J.jar, WinRun4J.ini, SplashScreen.gif, WinRun4JTest.jar and RCEDIT.exe). You only need the executable.

    That’s all folks.

     
  • poidasmith 9:23 pm on May 26, 2009 Permalink | Reply
    Tags: erlang, excel, python, r, , ruby, xll, xlloop   

    XLLoop 0.2.0 Released 

    A new release of XLLoop is now available (0.2.0). The new features and changes are:

    • Added popup to client for long running operations (with option to cancel request)
    • Added native Ruby server
    • Added native Python server
    • Added native R server
    • Fixed native Erlang server
    • Buffered streams on java server for improved performance
    • Improvements to reliability on binary protocol
    • Support up to 512 registered functions
    • Reduced xll size by using wcrt

    Download at the XLLoop Sourceforge Site.

     
    • Sal Kadam 6:57 pm on November 12, 2009 Permalink | Reply

      Hi,
      I am trying to use XLLoop, it is a amazing project.
      I needed some direction on , how I can achieve this.
      When my Java function returns a 1 or 2 dimension array, how do I auto-populate all my values in excel
      without pressing CTRL-SHIFT Enter.

      Can you please give me some direction on this.

      Thanks
      Sal

      • poidasmith 8:05 am on November 13, 2009 Permalink | Reply

        Hi,

        Thanks for the feedback. This is a feature of excel really. You can go to tools->options->calculation and set it to manual then you just need to press shift-f9 to update the whole sheet.

        Regards,
        Peter

        • Sal Kadam 5:24 pm on November 13, 2009 Permalink

          Peter,
          Thanks for the reply.

          Let me describe my problem little better.

          I have a method
          double[] Util.getAvg()
          say which return a 1-dimension array of 10 double.

          So when i am on cell A1 and type =FS(“Util.getAvg” ). How can i auto fill excel
          Cell from A1:A10 or A1:J1.

          Same for if my method return a double[][], how do i fill A1:J10.

          Is there something i can setup on excel or we will have to enhance XLLoop to do that.

          Please point me to the right direction.

          Regards,
          Sal

        • poidasmith 8:51 pm on November 15, 2009 Permalink

          Hi,

          You might want to take a look at http://excelmvf.sourceforge.net/

          Regards,
          Peter

        • Sal Kadam 6:46 pm on November 17, 2009 Permalink

          Peter,
          Thanks for pointing me to the sourceforge project. But we are looking to use XLLoop completely in Java.

          And we also have couple of other needs, if you could please point us to right direction. We can also help to contribute to the project also .

          1. Limit on number of parameter. Is it currently 10 and can it be increased to 20.

          2. Find out a way to populate a range of excel cells when function returns a single/double dimension array.

          3. Can we somehow pass a UserContext when we register to XLLoop server
          and then use that context for some entitlement for functions on the server.

          4. Is nested function call possible.

          Hope to get some direction from you.

          Thanks for all your help.
          Sal

  • poidasmith 8:50 pm on May 26, 2009 Permalink | Reply
    Tags: , launcher, logging, , ,   

    WinRun4J 0.3.0 Released 

    A new version of WinRun4J is now available (v0.3.0). The changes and new features are:

    • Added log.overwrite option for log files
    • Fixed log file logging
    • Added process.priority option to set process priority on startup
    • Fixed shutdown bug on service mode
    • Added ability to write text to splash screen
    • Fixes for splash screen loading in 64 bit mode
    • Improved window attributes on splash screen
    • Further improvements to diagnostics

    Download at the WinRun4J Sourceforge Site.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel