String.getBytes (java) o/p different in Windows and Unix

Hi,
I was trying out the following code, which gives me a byte array from a
String object.
byte[] bytArr = null;
bytArr = <String object>.getBytes("UnicodeBigUnmarked");
System.out.println(bytArr.toString());
The output is different in Windows and in Unix. The assumed that the reason could be because Intel architecture is based on little_endian so the difference in output. I changed the code to the following
bytArr = <String object>.getBytes("ISO8859_1");
and then ran the class file by using "java -Dfile.encoding=ISO8859_1" so that the toString can also take the character encoding of ISO8859_1 rather than using the platform dependent one. Still the result is different in Windows and Unix.
What could be the reason for this? How can I correct this ? Any help in this regard is welcome.
cheers
kk

Hi Sabre150,
Thanks for the suggestion, it worked. Both the o/p shows the same if I use System.out.println(Arrays.toString(bytArr));
I am assigning full points to you. Thanks a ton for the help.
To end with I have one more question, the method Arrays.toString is introduced from jdk1.5, so if I want to use jdk 1.4 what should I use instead of Arrays.toString ?
It would be great if I can get this answer.
cheers
kk

Similar Messages

  • Java program runs differently on Windows and Linux

    Hi!
    I would like to run a java application (which is written and run on windows platform) on linux platform. I don't know wether it is possible or not, but I tired on the following way:
    I have made a small java application. It worked correctly on windows (I developed it on windows). I copied first only the class file (Start.class) to the linux machine (which has exactly the same JDK as windows machine). When I type the command:
    java Startit gives me the folloving error:
    Exception in thread "main" java.lang.ClassFormatError: Start (unrecognized class file version)
       at java.lang.VMClassLoader.defineClass(libgcj.so.7rh)
       at java.lang.ClassLoader.defineClass(libgcj.so.7rh)
       at java.security.SecureClassLoader.defineClass(libgcj.so.7rh)
       at java.net.URLClassLoader.findClass(libgcj.so.7rh)
       at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.7rh)
       at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
       at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
       at gnu.java.lang.MainThread.run(libgcj.so.7rh)After that I was trying to compile the source file on linux with the command:
    javac Start.javabut the compiler gave me an error in the source file.
    Is there any way to run the formerly written java application (on windows) on linux machine?
    Thanks

    When I type the command java-version I get the following:
    java version "1.4.2"
    gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-46)
    Copyright (C) 2006 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.The JDK on linux and windows is the latest (I was download it today).
    How can I upgrade the jdk/jre on linux?
    Here is the compiler error:
    [root@Linux-oracle app]# javac DataMining.java
    1. ERROR in DataMining.java (at line 77)
            ArrayList<String> temp = new ArrayList<String>();
            ^^^^^^^^^
    The type ArrayList is not generic; it cannot be parameterized with arguments <String>
    2. ERROR in DataMining.java (at line 77)
            ArrayList<String> temp = new ArrayList<String>();
                      ^^^^^^
    Syntax error, parameterized types are only available if source level is 5.0
    3. ERROR in DataMining.java (at line 77)
            ArrayList<String> temp = new ArrayList<String>();
                                         ^^^^^^^^^
    The type ArrayList is not generic; it cannot be parameterized with arguments <String>
    4. ERROR in DataMining.java (at line 77)
            ArrayList<String> temp = new ArrayList<String>();
                                                   ^^^^^^
    Syntax error, parameterized types are only available if source level is 5.0
    5. WARNING in DataMining.java (at line 240)
            String youtube[][] = new String[20][5];
                   ^^^^^^^
    The local variable youtube is never read
    6. WARNING in DataMining.java (at line 267)
            int e;
                ^
    The local variable e is never read
    7. ERROR in DataMining.java (at line 329)
            for(int i=1;i<Video+1;i++)
                          ^^^^^^^
    The operator + is undefined for the argument type(s) Integer, int
    7 problems (5 errors, 2 warnings)

  • How to find cd rom drive in windows and unix platform using java program

    Hi,
    I am having the requirement of finding the cd rom drive
    using java program. I do not know the label and which
    one is the cd rom drive. also I want to know how many
    cd rom drives are there on my system. I want the solution
    for windows and unix platforms.
    If have any suggestions please mail to [email protected]
    Deepak

    Ughhh.. I had the same problem with multi platform file-system detection
    First off - Unix.
    Do you know for sure you have all your drives mounted?? This could be a big problem because java will not see unmounted drives... So you can scour thru your /etc/fstab to find out which drives are available... or you can mount all and show roots... (Yuck!)... You've got timeouts and all sorts of things to worry about...
    I would then shy away from the java.io.File.listRoots() on unix and rely on parsing your fs file. If a user would like to see the medium in the drive. Do a Runtime.exec and mount the drive, then you can grab the filesystem by wrapping it in the java.io.File object. ( NOTE - this will hold well for your NFS mounts as well which might be buried under other FS. So you now have detection for that as well. ) Labels are also noted in this file. Let me know if you don't know the difference between mtab and fstab....
    Second - Winders.... Corney but I love saying that.
    The listRoots is a good solution. As others have said CD-ROMS will not be writable. Use a combination of getName and getPath to decipher the label and mount point.
    Hope this helps!

  • Is QT DVD Player different on Windows and MAC?

    I have both Mac and PC computers. QT 7.1.3 is installed on both. I can view both commercial (Hollywood) and non-commercial mp2 content on the Mac but not the PC. Can anyone tell me what the difference is and why?
    Mac and PC   Mac OS X (10.3.9)   Win XP Pro

    Is QT DVD Player different on Windows and MAC?
    There is no such thing as a QT DVD Player. On the Mac there is a QT Player which does not play DVDs and there is a DVD Player which does. You are probably trying to compare the DVD Player on the Mac with the QT Player on the PC here.

  • Webutil usage on Windows and Unix clients - Host and Temp dir issues

    Hello,
    I am in the process of writing a Forms application which makes use of WebUtil to handle the uploading and downloading of files, as well as launching the files on the client PCs. The code below is my current 'Launch' program which works great in a Microsoft Windows environment. It gets the TEMP directory location, builds a file name, downloads the file to the TEMP directory and uses the Host command to launch the file.
    PROCEDURE Launch_DB IS
    l_directory varchar2(200) := client_win_api_environment.get_temp_directory(true);
    l_success boolean;
    BEGIN
    :file_block.full_file_name := l_directory || '\' || :file_block.file_name;
    l_success := webutil_file_transfer.DB_To_Client_with_progress
    (clientFile => :file_block.full_file_name
    ,tableName => 'FILES
    ,columnName => 'FILE_DATA'
    ,whereClause => 'ID = ' || :file_block.id
    ,progressTitle => 'Download from Database in progress'
    ,progressSubTitle=> 'Please wait'
    if l_success then
    WEBUTIL_HOST.NONBLOCKING('CMD /C "' || :file_block.full_file_name || '"');
    else
    exception
         when others then
         message('File download failed: '||sqlerrm);
    END;
    My problem is that I've just discovered that there's a new group of users that will want access to these forms, and they're using non-windows machines - mostly Solaris and Linux. As such, I have these problems:
    - " client_win_api_environment.get_temp_directory " is a Microsoft Windows specific function. Is there any way to determine a temporary storage area on a Unix machine?
    - " WEBUTIL_HOST.NONBLOCKING('CMD /C "' || :file_block.full_file_name || '"'); " - CMD is Microsoft Windows specific function. What should I do to launch a file from Unix? (Sorry, my Unix skills are pretty minimal).
    - I'm guessing that I'll need to determine the operating system so that I can use different methods to determine the TEMP dir, and to execute the HOST command. Assuming that Microsoft Windows and Unix variants are the only OS's that I need to provide access to, what is the best way to determine the client environment ( eg. IF UPPER(WebUtil_ClientInfo.Get_Operating_System) like '%WINDOWS%' THEN ... ELSE ... END IF; ) . I only have access to Windows XP for testing so I don't know what values "WebUtil_ClientInfo.Get_Operating_System" will return for any other OS.
    Thanks in advance for any assistance.
    Regards,
    Michael.

    Hi,
    as far as launching the file goes, if teh program that runs the file exist on teh local computer, you can use teh host command in webutil to access teh program and file. CMD is what you use to open teh command line on windows, but the host command is supposed to work on the UNIX client as well.
    For the temp directory, you have two options
    The short term option: Pass the temporary directory name as a user variable to Forms when starting the application. This can be user specific if adding this information to the URL using teh otherparams parameter
    The longterm option: Log a TAR with Oracle customer support to add a function to teh getClientInfo function that retruns the temporary directory for the authenticated user.
    Frank

  • Compiling reports6i on Windows and Unix

    Hi Friends,
    I'm compiling reports6i on windows by opening the browser window online. But to my confusion when I run and save the report program, I only see the .rdf extension of the file. I just thought the executable version is .rep , so I thought I will see also this file type. My question is can the report program run without the .rep extension file?
    Thanks

    Thanks Hussein,
    But I got this script from metalink > How to compile reports on windows and unix in batch mode:
    For Windows Reports 6i
    ===============
    REM WINDOWS COMPILE REPORT
    ::compile_report.bat
    cls
    Echo compiling Report .....
    for %%f IN (*.rdf) do RWCON60 userid=scott/tiger@v817 batch=yes source=%%f
    stype=rdffile DTYPE=REPFILE OVERWRITE=yes logfile=log.txt
    ECHO FINISHED COMPILING
    For Unix Reports 6i
    ============
    #UNIX COMPILE REPORTS
    #compile_rep.sh
    for i in `ls *.rdf`
    do
    echo Compiling Report $i ...
    rwcon60 userid=scott/tiger@bs817 batch=yes source=$i stype=rdffile
    dtype=repfile overwrite=yes compile_all=yes
    done
    =======
    I'm only concern with the unix output....is it ok if I have both file extensions? (.rdf and .rep)
    Another concern is are the program name case-sensitive? I know unix is case-sensitive unlike windows.
    So if I have a program name APXDCDFO.RDF , is it the same with
    APXDCDFO.rdf or
    apxdcdfo.RDF or
    apxdcdfo.rdf
    Thanks a lot

  • Setting file permisions ,group permission on Windows and unix from java

    Hi
    i am trying to set up file permissions through java on unix and windows operation sysyem
    .I don't want to use shell scripts .
    thank you for your help.

    HI BIJ001,
    Thanks for reply.I am paling to use
    1)First i am detecting operating system
    2)if it is UNIX->calling unix scripts from JAVA
    2)if it is WINDOWS ->calling Bat scripts.
    But attrib command in windows does not support FIle Gropu permssion like unix(chmod 777 filename).
    Do yoou have any experience in .bat sctipts on file permission.
    Let me know .Again thank you for reply.

  • Java transports across different SPS, EHP and release

    Hi All,
    During an SPS/EHP upgrade, there is generally a transport freeze in the development landscape from DEV ->QA->PRD. This due to the incompatibility between the systems. SAP Note explaining the same is 1090842.
    I understand that same is true for the Java developments as well. As the SC imported into track are specific to release and SP levels of the WAS. These would have to be adjusted and re-build, (after SPS/EHP upgrade of WAS) so that it refers to the new versions. But these new builds are possible in NWDI, which has not been updated. But these releases cannot be transported to QA before QA is also upgraded to same SPS/EHP as for DEV.
    Please let me know if my understanding is correct. If yes, then is there a similar SAP Note/documentation available as for ABAP one explaining the same?
    Appreciate your inputs on the same.
    Thanks and Regards,
    Arundeep Singh

    Hi Mark,
    Thanks for your reply. Your reply seems to talk more on the different release of NWDI and runtime systems.
    My query is not about the relation of NWDI and Runtime Java systems compatibility. I want to know the restrictions on transports in which the Runtime system landscape, DEV->QA->PRD, when an SPS/EHP on release is being upgraded on runtime systems. The scenario where standard SAP developments has been modified is clear and there is good enough documentation available [here|https://cw.sdn.sap.com/cw/docs/DOC-17604]. Let me try to explain the case again.
    1. Only the Runtime systems landscape being upgraded. NWDI remains the same.
    2. No SAP standard development has been modified.
    3. There is only custom development, but it has build and/or runtime dependency on standard SAP SWCV. e.g. dependency on JTECH 7.00
    4. Now DEV runtime Java system is upgraded, lets say to EHP1. That means the JTECH will change from JTECH 7.00 to JTECH 7.01 in Runtime DEV system.
    5. Now, I beleive that custom development/ SLD configuration should be adjusted so that custom development now depends on JTECH 7.01 and not on JTECH 7.00.
    6. If this custom development is not modified and transported to QA system, it may not work as the JTECH version is different in DEV and QA.
    7. There could be another option at point 5. It may be chosen not to change the dependency to new JTECH 7.01. but then it may not build or run properly as JTECH in DEV is now JTECH 7.01.
    Similar case would be there in case of SPS as well. It is just in case of SPS it is more subtle. The SLD dependencies will remain same. But I wonder if any library/interfaces gets updated/deprecated then the applications may not run as expected. I understand the code is generally downward compatible, but not always.
    This is why, I was checking if there is some official document explaining such scenarios. I am still searching. If I came across something i will provide the links.
    Thanks and Regards,
    Arundeep Singh
    PS: I am not a Java developer. My judgement is purely based on the general logic.

  • Diffference between coding in Windows and Unix

    I have coded some servlets and jsp under windows environment .. How different is it to do the same in a unix environment ?
    How do I go about coding java with unix?

    Just in Java terms? No difference, really. GUIs will "look" different because of the Look and Feel restrictions (you can't get the Windows LnF on Unix). But the underlying Java code is just the same. There are pure Java-based IDEs that function identically on either platform. Byte-code created on one will work in the same version JVM on the other.
    But make no mistake: Unix is also a very different environment. And it can bite you very hard when you make a major mistake. If you're going to be transitioning from a Windows environment to (some flavor of) Unix for development work, you'd do best to get some books, training, etc. on how to work in a Unix-like environment before jumping in.

  • Difference in performance of SBA between Windows and Unix

    Hi,
    I am using a  MSF routine which uses SBA to recursively search a sysbld suprerblock and its children to find a specific type block (in this case a ucb). It works fine on both Windows and Solaris Xmath. However, for very large models, there is a huge performance difference. I ran the algorithm on a model containing around 1000 superblock and 10000 blocks. Under Solaris (7.1.5) it takes around 30 seconds while under Windows XP (7.1.6) it takes more than 8 minutes.
    Any thoughts on the reason behind this difference.
    Thanks
    Farshid
    P.S. The MSF file is attached
    Attachments:
    finducb.zip ‏1 KB

    I'm aware I may get some flack for this statement.^^^Some. <grin>
    I'll give you the counter-argument. Those Unix shops with incredibly stable environments? Have you done a count of actually used applications? The ones that mimic the business' current needs? The ones that reflect the business', uh, business? Perhaps it's just the clients I interact with, but those often have a mixture of "dead" apps in with the live ones. I rarely see that with Windows and yes, the app count is sometimes crazy high on the Unix side -- certainly beyond what EAS can comfortably navigate (I was on a 9.2 environment once that had 200+ apps -- Shared Services was essentially broken at that site, but so was 9.2 in general.)
    Anyway, I've observed that IT tends not to do a terribly good job of producing flexible analytical applications. They are very good at stability, sustainability, security, and all sorts of other things Essbase (and other, especially transactional) environments must have. Until they become fossilized in their SOPs, their policies, and their requirements. At which point a different transformational technology that the business can control pops up -- heard of TM/1 lately? I am super curious (for all kinds of obvious reasons) to see where my beloved Essbase ends up in a few years.
    I'm not coming down on either side, just saying that I've seen this play out multiple times since the mid-1980s. While both sides have their merits, at the end of the day, if a super well maintained environment is just a monument to IT's ego, it's worthless. And yes, I have seen Windows environments that are just that.
    Regards,
    Cameron Lackpour
    Edited by: CL on Jul 12, 2011 9:54 AM
    Smiley faces no longer work. Why oh why oh why?

  • STMS configuration windows and unix

    Dear guru,
    We had a two system landscape.Dev system in windows and prd system in unix.
    We are configuring the STMS . We take domain controller in prd system.The common transport Directory in Prd system that will map to dev system .There is a error messge, the dev system cannot access the bin(profiles) and .cfg files.
    Kindly provide the solution.
    regards
    guna

    Yes I created a samba/CIFS.
    The security levels is share .I created a same user in windows system with permisson <sid>adm user privilages.
    In the Unix system acess is working fine.but windows the file system is not acess by the TMSadm user.
    when the stms configuration the profile file will be access by the tmsadm and write in the profiles (/bin).that process not done by the windows server.
    guna

  • Trade-Off Oracle on Windows and UNIX

    Hi All,
    We are in process to decide whether Oracle database should reside on Windows OR UNIX,
    Hence would thankful if anyone can help me with some technical points for favouring UNIX compared to Windows.
    -Yasser

    OracleNewbie828 wrote:
    Does anyone ever have problems / concerns with Windows Server Security Updates? Which to apply, should I apply the Security Updates, etc?When you install an Oracle database, you will need to decide which is more important - your data or your operating system.
    If your data, then you will investigate every operating system change individually using such resources as a Test system and My Oracle Support to determine whether you can
    - use that operating system
    - upgrade the operating system
    - patch the operating system
    However, most people these days seem to assume that Oracle will be resilient against any changes at the OS. It is a moderately fair assumption, but can (and will) bite at the most inconvenient time.
    So to answer your questions
    1) Does anyone ever have problems / concerns with Windows Server Security Updates?
    I always have concerns with these updates until they have been tested on the test system.
    2) Which to apply, should I apply the Security Updates, etc?
    Those that have passed regression testing on the test system.
    If you do not have a test system, all you need to do is a standard risk analysis: Is it acceptable to you and your organization if an OS patch changes the API in such a way that the database stops working for a period of time? If yes, how long is an acceptable period of time?
    As for which (between Linux/Unix/Windows is better - this "Security Updates" question is equally valid in every operating system, so all you need to do is consider your skill set.

  • How do I license my Physical Windows and Unix/Linux Servers for VMware VCM?

    I currently have vCenter Operations Manager Suite Enterprise edition which will allow me to manage my VMware VMs with VCM.
    I would also like to manage my 300-500 Physical Windows and Linux/Unix Servers.
    What license do I need to buy to achieve this?
    Cheers,
    /m

    You need an OS Instance (OSI) license for each managed endpoint.
    vRealize Suite Cloud Management Platform Purchasing | United States
    Cheers,
    Paul

  • Cfthread of coldfusion on different systems-windows and RedHat

    Recently I use cfthread writing a multithread samples. Each thread ask a http request.When I run this cfc file with coldfusion9 on windows, it runs well. Then I run the same cfc file on coldfusion9 on linux(RedHat and centOS), unfortunately, it seems do not work, I found the multi thread do not run parallely, they run one by one. The both coldfusion configuration files are same, and the web server use the built-in one of coldfusion. Is there anyone meet the same probelm? And is there something wrong with cfthread to run on linux? Really need your help. Many thanks!

    <cfloop index="pageIndex" from="1" to="#num#" step="1">
                            <cfthread name="thr#pageIndex#" threadIndex="#pageIndex#" action="run">
                                            <cftry>
                                                <cfhttp url="#watson_url#"  method="post" charset="utf-8" timeout="26000000" useragent="#CGI.http_user_agent#" result="THREAD.GETTREAD">
                                           <cfhttpparam type="formfield" name="appGUID" value="#guid#">
                                           <cfhttpparam type="formfield" name="userId" value="#user_id#">
                                           <cfhttpparam type="formfield" name="password" value="#user_pass#">
                                           <cfhttpparam type="formfield" name="sql" value="#TempArr[threadIndex]#">
                                              </cfhttp>
                                              <cfset result_Arr = #DeserializeJSON(THREAD.GETTREAD.Filecontent)#>
                                              <cfset resultArr[threadIndex]=result_Arr >
                                              <cfcatch type="any">
                                      </cfcatch>
                                        </cftry>
                           </cfthread>
         </cfloop>
    TempArr is an array for sql,each thread run a sql and get result from http request.

  • Flash behaves differently in windows and linux ?

    There are some sites that flash doen't display too well (firefox/opera) in linux, but seems to work fine in windows. Is there a difference in the plugin for each OS?
    try this:
    http://www.asus.com/index.aspx
    Wait for the page to finish loading, and then hover your mouse over the "products" link at the top of the page.. the drop down menu is now masked by the "asus webcam notebook ad". This doesn't happen in windows.. I've tried both arch package and the default flash installer, but get the same results.
    Note: The drop down menu is visible if you use the flashblock extension and disable the ad.
    Thanks..

    yep, for some reason the linux flash plugin doesn't let the browser draw elements over the animations, which is especially annoying on websites like the one you mentioned where dropdown menus are used over a silly useless flash banner.
    there are a LOT of things wrong with the flash plugin. macromedia hasn't really addressed them in a long long time
    EDIT: which is why i wish the best of luck to the gplflash plugin developers.

Maybe you are looking for