OS X Batch File Equivalent?

Posted:
in Genius Bar edited January 2014
Hi, I'm new to OS X and could use a little help.



I use a program for work called XWand from Fujitsu, it's a Java application that normally is executed from a batch file in windows. I've managed to get the aplacation to run by editing the batch file contents a little bit and pasting it into the Terminal. Now, what I'd like to do is create either a batch file equivalent, or a shortcut that will run the the below commend in the Terminal from the folder "/Applications/Fujitsu XWand Files".



Code:


java -mx800m -ms256m -DXWAND_LICENSE=. -classpath lib/instancecreator2.jar:lib/tool-common.jar:lib/taxeditor2.jar:lib/xwexplorer.jar:lib/xwandlink.jar:lib/xmlpro.jar:lib/xmlschemac.jar:lib/xmltransx.jar:lib/xwand.jar:lib/xwandschema.jar:lib/xbrldiff2se.jar:lib/xmlpath2.jar:lib/xmlpath2fn.jar:lib/xwand_xpath2.jar -Dcom.fujitsu.xml.xbrl.report.taxonomy.supportCSV=y es -Dconfig.dir="conf" com.fujitsu.xml.xbrl.xwexplorer.XWandExplorerPlatf orm











Thanks,

Comments

  • Reply 1 of 16
    MarvinMarvin Posts: 15,326moderator
    You can use a shell script. Open Text Edit and make sure you use plain text and not rtf by using format > make plain text.



    Then type:



    Code:




    #!/bin/bash

    cd "/Applications/Fujitsu XWand Files"

    java -mx ....









    Just enter the whole java command at the end. Then save it as something like xwand_builder.sh and then in terminal, type:



    chmod 777 <drag xwand_builder.sh into terminal window>



    Hit return and that will give it execute permissions. Then make sure that the .sh file type is set to run in the terminal using the Get Info box and it should run by double-clicking it.
  • Reply 2 of 16
    Thanks, worked like a charm.
  • Reply 3 of 16
    Hi



    I have s situation that is similar to AustinMatherne. My batch file contains the following:



    @echo off

    setlocal ENABLEDELAYEDEXPANSION



    rem start application

    start .\\jre\\bin\\javaw -Dplaf=avionics -Djava.library.path=.\\\\foct-bin -Djrex.gre.path=.\\\\foct-bin -DJREX_DEBUG=false -Djrex.dom.enable=true -Dfoct.library.path=./foct-bin -Dlog4j.configuration=./foct-conf/log4j.properties -Djava.main.path=. -Xmx512m -jar foct-bin/ois-control.jar file:foct-data/ ./foct-data/ FCOM file:foct-data/users.xml file:foct-data/ois-control-help.jar file:foct-data/ct-help.jar



    endlocal



    How do i get this batch file to run? Running it from Crossover 10 does not work.



    Thank you.
  • Reply 4 of 16
    MarvinMarvin Posts: 15,326moderator
    Quote:
    Originally Posted by Pierre Scerri View Post


    How do i get this batch file to run?



    You'll have to move into the directory where the flight manual app is located and run the equivalent java command with the corrected path names. For example:



    Code:




    #!/bin/bash

    cd "/User/Name/Downloads/Avionics/"

    java -Dplaf=avionics -Djava.library.path=./foct-bin -Djrex.gre.path=./foct-bin -DJREX_DEBUG=false -Djrex.dom.enable=true -Dfoct.library.path=./foct-bin -Dlog4j.configuration=./foct-conf/log4j.properties -Djava.main.path=. -Xmx512m -jar foct-bin/ois-control.jar file:foct-data/ ./foct-data/ FCOM file:foct-data/users.xml file:foct-data/ois-control-help.jar file:foct-data/ct-help.jar









    Modify the locations to where the software is so change /User/Name/Downloads/Avionics/ to the path of the folder. Then save the text file as something like avionics.sh and do the above steps and see what output you get when you run it. You may have to adjust some of the command-line Java options if they are Windows-specific.



    If you like, you can upload a zip of the app to rapidshare or similar and it'll be easier to sort out a batch file.
  • Reply 5 of 16
    Thank you for your reply. I am a bit confused. The application (not allowed to upload - sorry) is a Java application that runs on Windows. It contains its own JRE folder with all the EXE files included. My question is: Do you think that I can run it straight from the mac or do i need to use Wine ( I have Crossover 10 installed)? The reason I ask is that if i run a shell script as suggested, this would invoke javaw.exe which is a windows app. Is that going to work?
  • Reply 6 of 16
    If it helps to clarify things the image below shows the application folder. The batch file in question is run-ois-control.bat.



  • Reply 7 of 16
    MarvinMarvin Posts: 15,326moderator
    Quote:
    Originally Posted by Pierre Scerri View Post


    Thank you for your reply. I am a bit confused. The application (not allowed to upload - sorry) is a Java application that runs on Windows. It contains its own JRE folder with all the EXE files included. My question is: Do you think that I can run it straight from the mac or do i need to use Wine ( I have Crossover 10 installed)? The reason I ask is that if i run a shell script as suggested, this would invoke javaw.exe which is a windows app. Is that going to work?



    javaw.exe is the same as java.exe but is a Windows version that doesn't load a console - in the above script, I used the standard java command. The jre folder is just the java runtime files.



    Normally, applications are built to run on one platform but Java outputs bytecode, these files are then executed in a virtual machine (the Java runtime). This is similar to how Flash works and how it is cross-platform - the JRE equivalent would be the Flash plugin.



    When you run the java command in the terminal in Mac OS X, you are starting the Mac's Java runtime, which should be able to execute the java files just the same as it does in Windows.



    The Java files it executes are the .jar files.



    If you open a terminal window (/Applications/Utilities/terminal) and type cd then drag the LPC browser folder into the window and hit return.



    Then copy/paste the following in and hit return and see what it does:



    java -Dplaf=avionics -Djava.library.path=./foct-bin -Djrex.gre.path=./foct-bin -DJREX_DEBUG=false -Djrex.dom.enable=true -Dfoct.library.path=./foct-bin -Dlog4j.configuration=./foct-conf/log4j.properties -Djava.main.path=. -Xmx512m -jar foct-bin/ois-control.jar file:foct-data/ ./foct-data/ FCOM file:foct-data/users.xml file:foct-data/ois-control-help.jar file:foct-data/ct-help.jar



    An alternative is if you can get a copy of Windows, you can run it in a virtual machine like vMWare, Parallels or Virtual Box. Crossover is ok but it can be very tricky to get things to work, especially things like running a Java VM inside it.
  • Reply 8 of 16
    Hi



    Thank you for your explanation. I am getting a little bit closer. as the application now starts loading but stops with the error shown in the picture below:







    (The 100% shown means nothing. This is how the app starts.)



    BTW i already have a windows installation with the software running. I was actually trying to move away from windows as this is the only app that i am using windows for.



    Thank you for your help.
  • Reply 9 of 16
    MarvinMarvin Posts: 15,326moderator
    Quote:
    Originally Posted by Pierre Scerri View Post


    Hi



    Thank you for your explanation. I am getting a little bit closer. as the application now starts loading but stops with the error shown in the picture below:



    (The 100% shown means nothing. This is how the app starts.)



    BTW i already have a windows installation with the software running. I was actually trying to move away from windows as this is the only app that i am using windows for.



    Thank you for your help.



    I have enabled your account again, so you should be able to login again. The guide for the LPC browser says that you have to install at least one manual first by running LPC Browser-setup.jar, which I'd guess would be in the foct-bin folder.



    Try doing this in the terminal by being in the same LPC Browser directory as before and then typing:



    java foct-bin/LPC\\ Browser-setup.jar



    or whatever the pathnames are. If it doesn't like that, try running the long java command before but replace:



    -jar foct-bin/ois-control.jar



    with



    -jar foct-bin/LPC\\ Browser-setup.jar
  • Reply 10 of 16
    Your patience and insight are incredible. Thank you for taking the time to reply to my queries.



    The foct-bin folder contains the files in the image below:







    This next image shows the original Install folder:







    Running LPC Browser-setup.jar installs the app to the App folder (or wherever).

    Two other folders (foct-fcom and foct-mel) need to be copied manually as shown below:







    These contain the actual manual data.



    When i run the long java command I get the error previously reported. The Log below is produced:



    35 [Thread-3] LEVEL3 systrace.control.foct-bin - GC2001: Error while launching OIS Control.

    java.lang.ClassCastException: com.apple.laf.AquaComboBoxRenderer cannot be cast to javax.swing.plaf.basic.BasicComboBoxRenderer

    \tat com.airbus.ops.shared.swing.gui.WidthFittedPopupCo mboBox.<init>(WidthFittedPopupComboBox.java:76)

    \tat com.airbus.ops.ois.control.gui.EffectivityComboBox .<init>(EffectivityComboBox.java:52)

    \tat com.airbus.ops.ois.control.gui.OisControlToolBar.g etTopToolBar(OisControlToolBar.java:184)

    \tat com.airbus.ops.ois.control.gui.OisControlToolBar.< init>(OisControlToolBar.java:92)

    \tat com.airbus.ops.ois.control.gui.OisControlCardPanel .<init>(OisControlCardPanel.java:55)

    \tat com.airbus.ops.ois.control.gui.OisControlFrame.<in it>(OisControlFrame.java:48)

    \tat com.airbus.ops.ois.control.OisControlSession$2.run (OisControlSession.java:411)

    \tat java.lang.Thread.run(Thread.java:680)
  • Reply 11 of 16
    MarvinMarvin Posts: 15,326moderator
    Quote:
    Originally Posted by Pierre Scerri View Post


    When i run the long java command I get the error previously reported. The Log below is produced:



    35 [Thread-3] LEVEL3 systrace.control.foct-bin - GC2001: Error while launching OIS Control.

    java.lang.ClassCastException: com.apple.laf.AquaComboBoxRenderer cannot be cast to javax.swing.plaf.basic.BasicComboBoxRenderer

    \tat com.airbus.ops.shared.swing.gui.WidthFittedPopupCo mboBox.<init>(WidthFittedPopupComboBox.java:76)



    This would be where Java's cross-platform feature breaks down - when Apple build their own interpreter that behaves differently from Sun's version so that it has a prettier UI. Apple are planning to stop development of Java in 10.7 and it's possible that Sun may take over the role but it's not entirely clear what will happen.



    To fix this, you'd have to change the source code. Because it's just compiled bytecode, you can actually decompile the class files using a decompiler:



    http://www.varaneckas.com/jad



    Then you'd have to modify the code in the way suggested here:



    http://stackoverflow.com/questions/6...rop-down-popup



    then recompile the class files.



    Crossover would seem like the easier route at this point but the developers don't seem to have put support in Crossover for the JRE:



    http://www.codeweavers.com/support/t...ticket_level=2



    You could always run Linux in a VM instead of Windows and try running the same command as you do in Mac OS X.
  • Reply 12 of 16
    Yes i thought that it was getting a bit too deep for me. I'll checkout the Linux idea on my other PC - se if that works. If i have to use a VM I'd rather use Linux than Windows.



    I'll also have a look at the links you sent.



    Thank you for your help. I'll let you know if I get anywhere.
  • Reply 13 of 16
    I tried using linux. I can get to the first screen of the app as shown below:





    However, when I click Validate I get the error shown below:







    Seems like it's not the simplest thing to do. I'll probably have to continue using Windows - pity.
  • Reply 14 of 16
    MarvinMarvin Posts: 15,326moderator
    Quote:
    Originally Posted by Pierre Scerri View Post


    However, when I click Validate I get the error shown below



    Turning debugging on might show up what the error is, change -DJREX_DEBUG=false to true.



    If they can't even spell-check their error messages though, you could well be fighting a losing battle - the app will never initialiaze.
  • Reply 15 of 16
    He he. Something must have been lost in the translation I guess



    Turning on DEBUG has produced some interesting results (on linux):







    I guess i am fighting a losing battle



    All those libraries are there but they are dll files!
  • Reply 16 of 16
    MarvinMarvin Posts: 15,326moderator
    Quote:
    Originally Posted by Pierre Scerri View Post


    All those libraries are there but they are dll files!



    You'll need to get the Linux equivalents. It looks like they are from JRex:



    http://jrex.mozdev.org/releases.html



    But possibly some from:



    http://www.mozilla.org/projects/nspr/



    You should be able to get compiled versions of the libraries from a Firefox, Seamonkey or OpenOffice installation - just click on English US Linux at the following sites and unzip the packages:



    http://www.seamonkey-project.org/releases/

    http://download.openoffice.org/other.html



    You can then copy the .so files into the foct-bin folder.
Sign In or Register to comment.