Mac OS X Copying JavaApplicationStub using Java code

I have a java application that copies files from one folder to another.
This works fine on Windows, but on Mac OS X a Unix executable file like JavaApplicationStub appearently does not like to be copied using Java...
I have tested the application trying to duplicate a whole MyApplication.app package.
I realize that the file system is somewhat different on Mac than Windows, but I have a hard time accepting that java should not be able to copy a unix executable file from one folder to another without damaging the file...?
The copied file has the same size, but the file info does not say "Unix executable file" but "Document".
If I double-click it, it is opened using Terminal, but all it says is "Welcome to Darwin"
If I double-click the original file, (in the original package) the embedded java application is launched...
Can anyone give me a piece of Java code that successfully copies (duplicates) a Unix executable file?
Or a hint....?
Thanks, I would be VERY grateful :)

I am using something like:
byte[] buf;
BufferedInputStream bis;
BufferedOutputStream bos;
int bytesRead;
int fileSize;
fileSize = (int)sourceFile.length();
buf = new byte[512];
bis = new BufferedInputStream(new FileInputStream(sourceFile));
bos = new BufferedOutputStream(new FileOutputStream(destFile));
while ((bytesRead = bis.read(buf)) > -1) {
bos.write(buf, 0, bytesRead);
bis.close();
bos.close();

Similar Messages

  • How to get MAC address using java code

    hi friends
    please write me, How can I get MAC Address of local machine using java code.I don't want to use JNI.
    Please reply me. Its urgent for me
    Thanks in advance
    US

    You have several ways under *nix
    ifconfig -a | grep HWwill output something like
    eth0      Lien encap:Ethernet  HWaddr 00:11:FF:74:FF:B4combined with Runtime.getRuntime().exec("")and Process.getInputStream()you should be able to read it easilly.
    Under Windows (and Linux of course) try jpcap (http://sourceforge.net/projects/jpcap)
    You can also use jnative as a generic tool (http://sourceforge.net/projects/jnative)
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to launch Jar file in Mac Os using java code??

    can anyone tell me how can i launch another jar file in my apllication using java code.

    define "launch".
    - You want to run a new java program in a separate process? (see Runtime.exec())
    - You want to run a method in a specific class in the jar? (add jar to application classpath and then simply instantiate the class and call the method)

  • How to get the values from struct data type using java code..?

    Hi ,
    I am newer to java.
    we are using oracle database.
    How to get the data from struct data type using java code.
    Thanks in Advance.
    Regards,
    kumar

    Hi Rajeev,
    To retrieve a FilterContainer you will need to traverse the report structure:
    ReportStructure boReportStructure = boDocumentInstance.getStructure();
    ReportContainer boReportContainer = (ReportContainer) boReportStructure.getReportElement(0);
    FilterContainer boFilterContainer = null;
    if (boReportContainer.hasFilter()) {
         boFilterContainer = boReportContainer.getFilter();
    } else {
         boFilterContainer = boReportContainer.createFilter(LogicalOperator.AND);
    Calling boDocumentInstance.getStructure() will retrieve the entire structure for the document.
    Calling boReportStructure.getReportElement(0) will retrieve the structure for the first report of the document.
    Hope this helps.
    Regards,
    Dan

  • How to change InputField background color using Java Code

    Hi,
    In my application use will enter some set of Cost Centers in a table and submits request.
    In return i will get a list of invalid cost centers which i need to display in a table with input field
    In that table all cost centers will displayed, but invalid cost centers should be highlighted or background color should some other color. like red or yellow.
    Is it possible using java code to change a input field color.
    Please help me.
    Thanks

    Hi,
        declare a error message in message pool and declare a method say "checkCostCenters " and in this method, u can check whether it is a valid cost center .. if it is invalid cost center , then throw the erro message using the below code :
    wdComponentAPI.getMessageManager().reportContextAttributeMessage(
                        inputfieldattibutePointer, IMessageProgramPlanComp.ur error message,
                        new Object[] );
    for getting pointer and label use the below code:
    IWDAttributePointer inputfieldPointer = URNODEELEMENTElement
                        .getAttributePointer(URNODEELEMENT.ATTRIBUTENAME);
              String inputfieldLabel = wdContext.nodeURVALUENODE.getNodeInfo()
                        .getAttribute(URNODELEMENT.ATTRIBUTE).getSimpleType()
                        .getFieldLabel();
    hope it helps..
    Thanks and Regards

  • How to change the properties of a directory using java code

    Hai All,
    I need to change the properties of directory( websharing).
    Can i do this using java code.
    Regards,
    Charan

    I need to change the properties of
    directory( websharing).
    an i do this using java code.Depends on whether the server has a Java API to do it. Most likely it hasn't.

  • How to print/list all the groups/users present in Weblogic using Java code

    Hi,
    Weblogic version : 11.1.1.5
    How to print/list all the groups/users present in Weblogic using Java code
    I want to make a remote connection to Weblogic server and print all the users/groups present in it.
    I have gone through the below mentioned site, but I cannot use the same approach since most of the API' are deprecated for example "weblogic.management.MBeanHome;"
    http://weblogic-wonders.com/weblogic/2010/11/10/list-users-and-groups-in-weblogic-using-jmx/
    Thanks in advance,
    Edited by: 984107 on 05-Feb-2013 05:26
    Edited by: 984107 on 05-Feb-2013 22:59

    see this http://www.techpaste.com/2012/06/managing-user-groups-wlst-scripts-weblogic/
    Hope this helps.

  • How to dynamically configure JPA setting at runtime using java code?

    Hi,
    I am new to EJB 3.0 and JPA. I am trying to help my company to deploy the use of JPA in EJB3.0. Currently, i am trying out with OpenJPA in IBM Webshpere Application Server 7.0. We have four different WAS servers running for testing, system integration testing, user testing and production respectively, and in each region, the configurations for data source, JDBC username and password, schema, etc are different. So i think i would need to configure the JPA setting during runtime using Java code that determines which is the environment. And apparently i am stuck with the limited knowledge i have.
    1) I understand that i could override the JDBC in the persistence xml by creating entity manager using entity manager factory. But is it possible that i do similar thing by using inejction of persistence context on entity manager to obtain a container managed entity manager?
    2) Alternatively, it is possible to create multiple persistence unit in the XML and inject different PU to the entity manager, am i right? But how to inject dynamically since @PersistenceContext(unitName="xxx") only accepts constant declaration.
    3) Is it possible that the JDBC username and password are read from properties file?
    Thanks for your help in advance!

    Hi
    Thanks for the reply.
    Are you saying that i have to configure the data source authentication to the backend DB2 using the JAAS-J2C? Correct me if i am mistaken. I guess i am unable to do so as the application server setup only contains one data source, and the server hosted a number of applications. Every applications has their own JDBC username and password supply to the data source (the ID supplied at the DB2 side will decide which resource can access) and thus, i have to supply the username and password at runtime. Talked to the server guy and seems that it is not feasible to have seperate datasource for each applications as considered to the volume of applications hosted inside the server.
    Any suggestion?

  • Read an excel file using java code

    Hi,
    I want to create an excel file on the client machine based on the personal details entered on the web page. And I want to save the file on the client machine in the form of CSV. Then I want to read the contents of the spreadsheet using Java Code from the using servlets. Can I read the contents of the file directly from the client machine or do i need to save the file on the server and then read the contents of it. Please help me solve this.

    Hi,
    I want to create an excel file on the client machine
    based on the personal details entered on the web
    page. And I want to save the file on the client
    machine in the form of CSV. Then I want to read the
    contents of the spreadsheet using Java Code from the
    using servlets. Can I read the contents of the file
    directly from the client machine or do i need to save
    the file on the server and then read the contents of
    it. Please help me solve this.As stated I am rather certain that is impossible.
    Servers don't access the file systems of client machines.

  • Creating a folder in current workspace using java code

    Hi Experts,
    I need to create a folder and some file in the workspace of NWDS user. Can someone please suggest how can i find out the workspace of user using JAVA code.
    IWorkspaceRoot is not working in NWDS.
    Regards
    Pranav

    Hi Pranav,
    Tell me if you want to create this folder at run time or in NWDS while developing application.
    If you want to create it at the time of development just change your perspective to Java perspective and from there you can see the entire project structure and from there you can create desired files / folders.
    Ninad

  • How do I produce an excel file using java code

    How do i produce an excel file using java code.
    If it is possible would ne one have ne source code as an example.
    I have tried looking up information on outputing the information to a *.csv file but unfortunality i have had no luck in finding any information. To be exact ne source code.
    Thanks
    Lee

    That's what I use and I'd be the first to admit that it's very messy. But it works. Go use Google and see what else you can find.

  • In Struts is it possible to use java code  in jsp?

    in Struts Tag Program in jsp pages is it efficient to use java code? Please explain?

    No issues.. you can use java code... in jsp struts
    based framework..
    SJYou can use Java code as scriptlets in any JSP, but that doesn't mean there are no issues.
    I would say it's a bad idea for the following reasons:
    (1) Scriptlet code is difficult to read when mingled with HTML
    (2) You can't unit test scriptlet code
    (3) It increases the chance that business logic will leak into pages where it doesn't belong.
    Better to use a well-proven tag library like JSTL or the Struts taglibs and keep all scriptlets out of your JSPs.
    %

  • How to use Java code inside WebDynpro-ABAP

    Hi,
        How to use Java code inside WebDynpro-ABAP.
    Could any one provide sample code.
    Cheers,
    Sam

    Hi Sam,
    We can't Bring Java Inside the ABAP. Both are running in different Environments.
    and also ABAP Codes are runs on BASIS.
    -Basis is a middleware between ABAP codes and Ur OS.
    -Contains set of programs to load,RUN,intepret the ABAP program..
    So Both are Different.
    Regards,
    Ramganesan K.

  • Stoping System Clock using Java code.

    Is it possible to do so if yes then some code idea for
    Stoping System Clock using Java code.
    [email protected]

    The system clock is controlled from the BIOS, and as such, I don't think even windoze can stop it, though it can be continually reset. I don't believe that Java provides a sufficiently low level of control to set the system clock, although you could use a native method to accomplish the task.
    Why would you want to do such a thing?

  • To run a command using java code

    hi all,
    There is a command
    "java -jar selenium-server.jar -interactive"
    which i am running through command prompt after going to D:\MyFolder\Examples .
    i want to execute this command using java code .please help

    subratjyetki wrote:
    please answer in detail or if posible can u give the code for thisThe detail is given in the reference. Why don't you read it?
    I could give you the code but it will cost you ?100 per hour.

Maybe you are looking for

  • Copy text from FrameMaker 11 to another editor

    It appears that one cannot copy text in FrameMaker 11 and paste it into another editor such as Notepad++ or MS Word. It is as though FrameMaker does not use the Windows clipboard. We observe this behavior with WYSIWYG View and Author View. On the oth

  • Flash MX updates

    I have Flash MX and Mac OS X 10.5.5 and I've seen problems with the built swf. Does anyone know of updates I can download?

  • Why are my titles not sharp?

    After I made some ken burn effect to my pictures I exported it to high quality Quick time, for some reason the titles I added are not sharp and clear but blurred at the edges what could be the reason? Also if I want to make a dvd video, what is the a

  • Why can't I print in color from Photoshop to my HP 3500 wireless printer?

    I have Photoshop CS6. I just noticed last night that when I go to print files from Photoshop, (or even Preview right now... or straight from Google Chrome), it only prints grayscale. I have NOT figured out how to fix this setting in the HP 3511 wirel

  • Help with Windows 7 native scanning "Scan Profiles"

    Hey everyone, I've got a problem I just can't seem to find the answer for.  We have a couple workstations in our environment (Win7 Pro 64-bit) that are going to be used for card scanning--specifically the Fujitsu Flatbed fi-60F. There are no issues w