Java on Linux vs. Windows

Dear All,
I was able to write below AES/CFB/NoPadding encryption/decryption program (with many thanks to the Internet) and it works fine on Windows. But it's "getByte()" gives problems on Linux.
Which is the "symmKey.length()" inside "SymmCipher" constructor is only 15 chars. But "symmKey.getBytes().length" has become 33.
Can anybody answer?
Thanks in advanced.
- amilww
// aesDemo.java
class aesDemo
     public static void main(String[] args) throws Exception
          String keyHexStr = "CAABBCCDDEE11223344556677889900F";
          String ivStr     = "0000000000000001";
          String inputStr  = "This in a test message";
          // Intermediate variables
          String cipherTextStr, plainTextStr,
                 reqHexMsgStr,  repHexMsgStr,
                 repMsgStr;
          SymmCipher symmCipher = new SymmCipher("AES/CFB/NoPadding",
                                                 new String(Util.hex2Bytes(keyHexStr)),
                                                 ivStr);
          // Encrypt the input string
          cipherTextStr = symmCipher.encrypt(inputStr);
          // Convert to an uppercase Hex request string
          reqHexMsgStr = Util.bytes2Hex(cipherTextStr.getBytes()).toUpperCase();
          // Obtain the reply; assume to be the request
          repHexMsgStr = reqHexMsgStr;
          // Convert reply hex message to a string
          repMsgStr = new String(Util.hex2Bytes(repHexMsgStr));
          // Decrypt the reply string
          plainTextStr = symmCipher.decrypt(repMsgStr);
          // Debub output
          System.out.println("=============================================");
          System.out.println("Encrypting/decrypting using AES/CFB/NoPadding");
          System.out.println("---------------------------------------------");
          System.out.println("Input String: '" + inputStr + "'");
          System.out.println("Encr request: '" + cipherTextStr + "'");
          System.out.println("Req Hex Msg:  '" + reqHexMsgStr + "'");
          System.out.println("Rep Hex Msg:  '" + repHexMsgStr + "'");
          System.out.println("Encr reply:   '" + repMsgStr + "'");
          System.out.println("Response:     '" + plainTextStr + "'");
          System.out.println("=============================================");
// SymmCipher.java
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
class SymmCipher
     private String cipherForm;
     // e.g.: "AES/CFB/NoPadding", "DES/CTR/NoPadding", "DES/ECB/PKCS5Padding"
     private String cipherMethod;
     private SecretKeySpec   keySpec;
     private IvParameterSpec ivSpec;
     private Cipher          cipher;
     public SymmCipher(String cipherForm, String symmKey, String iv) throws Exception
          this.cipherForm   = cipherForm;
          this.cipherMethod = this.cipherForm.split("/")[0];
          this.keySpec = new SecretKeySpec(symmKey.getBytes(), this.cipherMethod);
          this.ivSpec  = new IvParameterSpec(iv.getBytes());
          this.cipher = Cipher.getInstance(this.cipherForm);
     public String encrypt(String plainText) throws Exception
          // Encrypting...
          this.cipher.init(Cipher.ENCRYPT_MODE, this.keySpec, this.ivSpec);
          return new String(this.cipher.doFinal(plainText.getBytes()));
     public String decrypt(String cipherText) throws Exception
          // Decrypting...
          this.cipher.init(Cipher.DECRYPT_MODE, this.keySpec, this.ivSpec);
          return new String(this.cipher.doFinal(cipherText.getBytes()));
// Util.java
class Util
     public static String bytes2Hex(byte buf[])
          StringBuffer strbuf = new StringBuffer(2 * buf.length);
          for (int i = 0; i < buf.length; i++)
               if (((int) buf[i] & 0xff) < 0x10)
                    strbuf.append("0");
               strbuf.append(Long.toString((int) buf[i] & 0xff, 16));
          return strbuf.toString();
     public static byte[] hex2Bytes(String hex)
          int    len = hex.length();
          byte[] buf = new byte[((len + 1) / 2)];
          int i = 0, j = 0;
          if (1 == (len % 2))
               buf[j++] = (byte) hexDigit(hex.charAt(i++));
          while (i < len)
               buf[j++] = (byte) ((hexDigit(hex.charAt(i++)) << 4) |
               hexDigit(hex.charAt(i++)));
          return buf;
      * Returns the number from 0 to 15 corresponding to the hex digit <i>ch</i>.
      * @param ch hex digit character (must be 0-9A-Fa-f)
      * @return   numeric equivalent of hex digit (0-15)
     public static int hexDigit(char ch)
          if (('0' <= ch) && ('9' >= ch))
               return ch - '0';
          if (('A' <= ch) && ('F' >= ch))
               return ch - 'A' + 10;
          if (('a' <= ch) && ('f' >= ch))
               return ch - 'a' + 10;
          return(0);     // any other char is treated as 0
}

This statement
     return new String(this.cipher.doFinal(plainText.getBytes()));     has two problems.
1) It relies on the default character encoding when converting the plainText to bytes and the default character encoding is platform, operating system and user dependent. It is far far better to specify an encoding yourself - I always use utf-8.
2) You are converting the essentially random binary result of the encryption to a String using new String(encrypted bytes). String should never be used as a container for binary data unless something like Hex or Base64 is used because, depending on the character encoding, it is not reversible for most character encoding. If you need a Hex or Base64 encoder then Google for Jakarta Commons Codec.

Similar Messages

  • Java Performance: Linux vs Windows, 64 bit vs 32 bit JVM

    I am looking for information about how Java performs on Linux vs Windows and how the results are affected when a 64 bit jvm is used.
    Disk access or IO are not important, I would really like to see some benchmarks on floating point arithmetic and/or heavy memory access, assuming that on all environments enough physical memory could be addressed so the extra available memory space for 64 bit os'es/jvm's is not important.
    I have been searching on Google but didn't find any useful recent results, only some very old stuff.
    Does anybody know how the OS and the JVM affect performance? I could imagine that Java VM's are a little less optimized on Linux because of the fact that Linux has a smaller marketshare, but maybe that is not true?
    Also I could imagine that 64 bit JVMs could be faster because they could use more cpu registers, on the other hand they could slow down a little because all memory pointers are twice as long so more data should be processed?
    Any comments are greatly appreciated!

    On the Linux vs Windows theme, you would probably find out, after much browsing & research, that there is no difference in performance or that the difference is too small to be even considered.
    On the 32-bit vs 64-bit subject, here's a recent blog that you could look at:
    http://dev2dev.bea.com/blog/patel_jayesh_j/archive/2007/09/32bit_or_64bit.html
    That blog has some links to some benchmarks, but here again, the differences are unlikely to be earth-shattering.
    Not much to add here, other than the most important improvement in performance derive from how the application is designed, and in some cases, how the JVM heap itself is configured, independently on Linux vs Win or 32 vs 64 -bit considerations.
    In a case when you would really need to know, there is no general right answer to your question, and you'd have to benchmark your specific application yourself in your specific execution environment to be able to evaluate possible benefits of 64-bit vs 32-bit.
    In conclusion, I wouldn't waste much time on all this, and you probably have better things to do yourself.

  • Developing Java under Linux and Windows

    Dear all
    I want to know the percentage of developing Java under Linux platform and under Windows platform. is it 50 % for each or most of developers develop under one platform?
    Best Regards

    I want to know the percentage of developing Java
    under Linux platform and under Windows platform. is
    it 50 % for each or most of developers develop under
    one platform?I did a full survey of this just last week. I contacted 10,000 Java
    developers so to an accuracy of better than 1% I find that
    78% develop on Windows
    11% develop on Mac
    12% develop on Linux
    12% develop on AIX
    6% develop on 'other' platforms.------+
    119%
    You may quote me on this.Uhuh ;-)
    kind regards,
    Jo

  • Why we have separate azure java SDK for linux and windows

    I saw different links for downloading azure java SDK for linux and windows.
    What difference does it actually have when java is platform independent? Or both are same jars?

    Hi,
    Thank you for your post.
    It contains the same jar files.
    Regards,
    Mekh.

  • Call Windows COM/DCOM objects from Java on Linux

    Hello, is it possible to call COM/DCOM objects running on Windows from Java on Linux machine? Thank you.

    I don't know anything about it but it looks like EZ JCom in conjunction with the included Remote Access Service does what you're after. It's not free though.
    http://www.ezjcom.com/

  • Cannot connect properly to Oracle on Linux from Windows

    Good day all,
    I’ve got 2 virtual machines running on my Mac:
    -     Centos 5.4 with Oracle 11gR2
    -     Windows 2003 server with Oracle 10gR2
    From Linux box I have access to Oracle database on Windows box (both directly and via a database link), however from Windows I have problems accessing the oracle database on the Linux box.
    From Windows, if I try to set up a connection using Oracle’s SQL Developer using connection type “Basic”, I get “IO Error: The Network Adapter could not establish the connection”. When I use “TNS”, then it works.
    From the linux box it all works fine as the “oracle” user, but when I log on as another user (in this case “informatica”) it doesn’t work properly any more.
    To sketch what both environments look like.
    Windows:
    -     Machine name WS2003Ora10g
    -     Etc/hosts
    o     127.0.0.1 localhost
    o     #loopback adapter
    o     192.168.12.100     localhost
    o     #network adapter
    o     192.168.12.10     WS2003Ora10g
    o     # external machine
    o     192.168.12.110     ilmserver
    -     system variables
    o     TNS_ADMIN, set to network/admin path in Oracle home dir
    listener
    C:\Documents and Settings\Administrator>lsnrctl status
    LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 24-AUG-2011 17:38:06
    Copyright (c) 1991, 2005, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
    Start Date 24-AUG-2011 16:29:33
    Uptime 0 days 1 hr. 8 min. 33 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\listener.ora
    Listener Log File C:\oracle\product\10.2.0\db_1\network\log\listener.log
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=WS2003Ora10g)(PORT=1521)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "ora10gr2" has 1 instance(s).
    Instance "ora10gr2", status READY, has 1 handler(s) for this service...
    Service "ora10gr2XDB" has 1 instance(s).
    Instance "ora10gr2", status READY, has 1 handler(s) for this service...
    Service "ora10gr2_XPT" has 1 instance(s).
    Instance "ora10gr2", status READY, has 1 handler(s) for this service...
    The command completed successfully
    C:\Documents and Settings\Administrator>lsnrctl services
    LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 24-AUG-2011 17:40:43
    Copyright (c) 1991, 2005, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0
    LOCAL SERVER
    Service "ora10gr2" has 1 instance(s).
    Instance "ora10gr2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:25 refused:0 state:ready
    LOCAL SERVER
    Service "ora10gr2XDB" has 1 instance(s).
    Instance "ora10gr2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "D000" established:0 refused:0 current:0 max:1002 state:ready
    DISPATCHER <machine: WS2003ORA10G, pid: 2852>
    (ADDRESS=(PROTOCOL=tcp)(HOST=WS2003Ora10g)(PORT=1031))
    Service "ora10gr2_XPT" has 1 instance(s).
    Instance "ora10gr2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:25 refused:0 state:ready
    LOCAL SERVER
    The command completed successfully
    Linux
    -     Machine name ilmserver
    -     Etc/hosts
    o     127.0.0.1          localhost.localdomain localhost
    o     ::1          localhost6.localdomain6 localhost6
    o     192.168.12.1     routerip     rtrip
    o     192.168.12.110     ilmserver     ilmsvr
    o     192.168.12.10     WS2003Ora10g     winora
    system variables (in bashprofile)_
    o     export PATH=$PATH:/usr/java/jdk1.7.0/bin
    o     export PATH=$PATH:/usr/sbin
    o     export PATH=$PATH:/sbin
    o     export JAVA_HOME=/usr/java/jdk1.7.0
    o     PATH=$PATH:$HOME/bin
    o     export PATH
    o     export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
    o     export ORACLE_BASE=/home/oracle/app/oracle
    o     export ORACLE_SID=orcl
    o     export TNS_ADMIN=$ORACLE_HOME/network/admin
    o     export ORACLE_HOSTNAME=ilmserver
    o     export PATH=$PATH:$ORACLE_HOME/bin
    Both the "oracle" and the "informatica" user have these environment variables.
    listener
    Logged in as “oracle” user:*
    [oracle@ilmserver ~]$ lsnrctl status
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-AUG-2011 19:12:35
    Copyright (c) 1991, 2009, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date 24-AUG-2011 17:30:39
    Uptime 0 days 1 hr. 41 min. 55 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
    Listener Log File /home/oracle/app/oracle/diag/tnslsnr/ilmserver/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
    Services Summary...
    Service "orcl" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    Service "orclXDB" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    The command completed successfully
    [oracle@ilmserver ~]$ lsnrctl services
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-AUG-2011 19:13:28
    Copyright (c) 1991, 2009, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    Services Summary...
    Service "orcl" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:19 refused:0 state:ready
    LOCAL SERVER
    Service "orclXDB" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
    "D000" established:0 refused:0 current:0 max:1022 state:ready
    DISPATCHER <machine: ilmserver, pid: 9648>
    (ADDRESS=(PROTOCOL=tcp)(HOST=ilmserver)(PORT=52395))
    The command completed successfully
    But logged in as “informatica” user I get following:
    [informatica@ilmserver ~]$ lsnrctl status
    bash: lsnrctl: command not found
    [informatica@ilmserver ~]$ lsnrctl services
    bash: lsnrctl: command not found
    even though the oracle bin directory sits in PATH.
    Pinging from windows:
    C:\Documents and Settings\Administrator>ping ilmserver
    Pinging ilmserver [192.168.12.110] with 32 bytes of data:
    Reply from 192.168.12.110: bytes=32 time=1ms TTL=64
    Reply from 192.168.12.110: bytes=32 time<1ms TTL=64
    Reply from 192.168.12.110: bytes=32 time<1ms TTL=64
    Reply from 192.168.12.110: bytes=32 time<1ms TTL=64
    Ping statistics for 192.168.12.110:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms
    That works fine.
    Telnet from Windows:
    C:\Documents and Settings\Administrator>telnet 192.168.12.110 1521
    Connecting To 192.168.12.110...Could not open connection to the host, on port 1521: Connect failed
    This result is the same for either just having port 1521 open, or turning the Linux firewall off altogether. Also same when using IP address.
    Just to be complete, here are the results from the Linux box.
    *[oracle@ilmserver informatica]$ ping WS2003Ora10g*
    PING WS2003Ora10g (192.168.12.10) 56(84) bytes of data.
    64 bytes from WS2003Ora10g (192.168.12.10): icmp_seq=1 ttl=128 time=1.63 ms
    64 bytes from WS2003Ora10g (192.168.12.10): icmp_seq=2 ttl=128 time=0.222 ms
    64 bytes from WS2003Ora10g (192.168.12.10): icmp_seq=3 ttl=128 time=0.255 ms
    64 bytes from WS2003Ora10g (192.168.12.10): icmp_seq=4 ttl=128 time=0.258 ms
    --- WS2003Ora10g ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3000ms
    rtt min/avg/max/mdev = 0.222/0.593/1.639/0.604 ms
    *[oracle@ilmserver ~]$ telnet WS2003Ora10g 1521*
    Trying 192.168.12.10...
    Connected to WS2003Ora10g (192.168.12.10).
    Escape character is '^]'.
    ... works for all users.
    Checking out the port situation on Linux:
    [informatica@ilmserver ~]$ netstat -an | grep 1521
    tcp 0 0 127.0.0.1:1521 0.0.0.0:* LISTEN
    tcp 0 0 127.0.0.1:1521 127.0.0.1:43782 ESTABLISHED
    tcp 0 0 127.0.0.1:1521 127.0.0.1:44290 ESTABLISHED
    tcp 0 0 127.0.0.1:58289 127.0.0.1:1521 TIME_WAIT
    tcp 0 0 127.0.0.1:58287 127.0.0.1:1521 TIME_WAIT
    tcp 0 0 127.0.0.1:1521 127.0.0.1:43792 ESTABLISHED
    tcp 0 0 127.0.0.1:54116 127.0.0.1:1521 ESTABLISHED
    tcp 0 0 127.0.0.1:1521 127.0.0.1:44283 ESTABLISHED
    tcp 0 0 ::ffff:127.0.0.1:54123 ::ffff:127.0.0.1:1521 ESTABLISHED
    tcp 0 0 ::ffff:127.0.0.1:30135 ::ffff:127.0.0.1:1521 ESTABLISHED
    unix 2 [ ACC ] STREAM LISTENING 129262 /var/tmp/.oracle/sEXTPROC1521
    [ the sequence of dots means I took out a whole lot or lines with virtually the same information, only different port(s) ]
    What’s noticeable is that port 1521 seems solely assigned to the localhost IP-address, 127.0.0.1.
    Another thing I noticed is that from a different user in Linux, so not “oracle”, using SQL Developer I cannot access the local Oracle database via TNS. When choosing TNS the dropdown box for “Network Alias” – which normally is populated with entries from TNSNAMES.ORA – is completely empty. On a “users and groups” level I basically assigned all the groups the oracle user is member of, to the other user (called informatica).
    And to make it even more interesting, at first it worked using “Basic” (in SQL Developer), but since implementing the TNS_ADMIN environment variable, it doesn’t work at all !!!
    Trying it via SQLPLUS as the “informatica” doesn’t work either:
    [informatica@ilmserver ~]$ sqlplus system
    bash: sqlplus: command not found
    I’ve assigned the “dba” group to “informatica”, or rather, I have assigned all groups to the “informatica” user as the “oracle” user has.
    Needless to say I am no Linux expert, rather a quite inexperienced Linux-user.
    So bottom line, the situation I’d like to be able to create is the following:
    •     Linux Oracle DB accessible from “informatica” (or any other) user on Linux, via both TNS and java-based
    •     Linux Oracle DB accessible from remote machine (running Windows 2003 server) via both TNS and java-based
    •     And for Informatica to work properly, it says it needs the TNS_ADMIN environment variable, so the “informatica” user must have full Oracle connectivity with TNS_ADMIN in place.
    Any help is greatly appreciated.
    Thanks, Patrick

    Hi Billy,
    Thanks for your elaborate answer.
    Not sure whether I can use it though, since the application using the oracle database (i.e. Informatica ILM 5.3.2) appears to have a specific need for TNS.
    I thought I had a solution (not the prettiest for sure) by just copying TNSNAMES.ORA to an accessible location, change ownership to "informatica" user, have TNS_ADMIN point to it, and Bob should be my uncle. Well... he isn't!
    In SQL Developer when I choose TNS as connection type, the drop down box is STILL empty.....aaaaahhhh!!!!!
    I was advised to play around with primary groups, so I tried oinstall and dba as primary groups for informatica user, all to no avail.
    And I can't even test it with SQLPLUS because I don't have access to it as "informatica".
    Who knows what the exact reason for that is... I know I'm a far cry from an experienced linux user, but I assumed that having the Oracle Home bin directory in PATH, and assigning the oinstall group to informatica user, would ensure access to to any executable in there. Well... NOT!!!
    +[informatica@ilmserver ~]$ sqlplus system@orcl+
    bash: sqlplus: command not found
    This is driving me nuts. Thought that finding a solution for this wouldn't be this hard, but essentially I've been digging for 3 days now.
    To provide more background, here are the env.variables:
    [informatica@ilmserver ~]$ env
    SSH_AGENT_PID=21054
    HOSTNAME=ilmserver
    DESKTOP_STARTUP_ID=
    TERM=xterm
    SHELL=/bin/bash
    HISTSIZE=1000
    GTK_RC_FILES=/etc/gtk/gtkrc:/home/informatica/.gtkrc-1.2-gnome2
    WINDOWID=262nnnnn
    USER=informatica
    LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
    ORACLE_SID=orcl
    GNOME_KEYRING_SOCKET=/tmp/keyring-LXptz1/socket
    ORACLE_HOSTNAME=ilmserver
    ORACLE_BASE=/home/oracle/app/oracle
    SSH_AUTH_SOCK=/tmp/ssh-CFDat21018/agent.21018
    SESSION_MANAGER=local/ilmserver:/tmp/.ICE-unix/21018
    USERNAME=informatica
    TNS_ADMIN=/var/temp
    MAIL=/var/spool/mail/informatica
    PATH=/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/informatica/bin:/usr/java/jdk1.7.0/bin:/usr/sbin:/sbin:/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin
    DESKTOP_SESSION=default
    GDM_XSERVER_LOCATION=local
    INPUTRC=/etc/inputrc
    PWD=/home/informatica
    JAVA_HOME=/usr/java/jdk1.7.0
    XMODIFIERS=@im=none
    LANG=en_US.UTF-8
    GDMSESSION=default
    SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
    SHLVL=2
    HOME=/home/informatica
    GNOME_DESKTOP_SESSION_ID=Default
    LOGNAME=informatica
    CVS_RSH=ssh
    DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-axxxxxxxxo,guid=xxxxxxxxxxxxxxxxxxxxxxx
    LESSOPEN=|/usr/bin/lesspipe.sh %s
    DISPLAY=:0.0
    ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
    G_BROKEN_FILENAMES=1
    COLORTERM=gnome-terminal
    XAUTHORITY=/tmp/.gdmKEYS0V
    Thanks, Patrick

  • How to set owner-only access file permissions both on Linux and Windows

    Hi everybody.
    I have the following problem. I need to store some private user information in file system. So I need to set owner-only access permissions for some directory in user home. I did not find API for doing this. As I understand this is platform specific thing. Could anybody tell me how can I do this both on Linux and Windows?
    Thank you in advance.

    More ideas just came back to me (of something I did before)
    Each OS requires a different control.
    For Windows you will need to set the .policy file for each user (a pain if you have more than a dozen of clients) granting access (R or RW) to files/directories.
    Then you have to write some native code (access via JNI) to access/modify your authorization.
    A more professional solution that I used was J-Integra (other similar tool exist).
    Basically it is a bridge between Java and COM. It magically give you access to the COM API from Java (and vice versa).
    In my case it was to read/write/modify Winword documents transfered between PC and server.
    From memory you have to run the com2java.exe to build the bridge (classes in Java language) between the 2 families. Compile those classes and you have a "driver" for the COM (Microsoft Objects).
    Here I must confess my ignorance on Microsoft.
    Those COM objets must give you some easy/integrated access to the API for LDAP or Microsoft Active Directory Service (for centralize control with more complex setup).

  • About Java Communication API for Windows

    hi
    I'm studying Serial Communication in university.
    I'd like to know the reason why we can't downlaod Java Communication API for Windows.
    I confirmed Comm for Linux and Soralis, but I can't find Comm for Win.
    Please tell me the reason if someone know.

    For no particular reason Sun stopped supporting the windows version
    of that package. I use rxtx which happens to allow for much faster
    communication too.
    The interface is identical to Sun's version, just the package differs: "gnu.io".
    kind regards,
    Jos

  • Java Servlet/Linux issues

    Hi-
    I use an applet that works fine on Windows but fails on Linux. It stops
    on the 'Loading Applet' screen. I've tested it in Mozilla, Netscape and
    KConqueror, all with the same result. I'm guessing it has something to
    do with the applet making an external socket connection. Strange thing
    is I have set the logging to level 5 and see no exceptions.
    Below are the Java log traces between Windows and Linux.
    Any ideas! I have noticed that many people are having this problem on
    Linux without any resolution.
    Dave
    From Windows:
    Referencing classloader: sun.plugin.ClassLoaderInfo@1dba45, refcount=1
    Added trace listener: sun.plugin.AppletViewer
    Added progress listener: sun.plugin.AppletViewer
    Loading applet...
    Initializing applet...
    Starting applet...
    Connecting http://imgproc3.weathertap.com:443/radarlab/radarlab.jar with
    no proxy
    Connecting http://imgproc3.weathertap.com:443/radarlab/radarlab.jar with
    cookie "WxTAP_Session=Confirmed"
    java.io.IOException: Caching not supported for
    http://imgproc3.weathertap.com:443/radarlab/radarlab.jar
    at sun.plugin.cache.CachedJarLoader.download(CachedJarLoader.java:323)
    at sun.plugin.cache.CachedJarLoader.load(CachedJarLoader.java:131)
    at sun.plugin.cache.JarCache.get(JarCache.java:177)
    at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect
    (CachedJarURLConnection.java1)
    at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile
    (CachedJarURLConnection.java:56)
    at sun.misc.URLClassPath$JarLoader.getJarFile(URLClassPath.java:498)
    at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:459)
    at sun.misc.URLClassPath$2.run(URLClassPath.java:255)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.misc.URLClassPath.getLoader(URLClassPath.java:244)
    at sun.misc.URLClassPath.getLoader(URLClassPath.java:221)
    at sun.misc.URLClassPath.getResource(URLClassPath.java:134)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
    at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:132)
    at sun.plugin.security.PluginClassLoader.findClass
    (PluginClassLoader.java:189)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:112)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
    at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:473)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:548)
    at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1621)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:477)
    at sun.applet.AppletPanel.run(AppletPanel.java:290)
    at java.lang.Thread.run(Thread.java:536)
    WARNING: Unable to cache
    http://imgproc3.weathertap.com:443/radarlab/radarlab.jar
    Connecting http://imgproc3.weathertap.com:443/radarlab/radarlab.jar with
    no proxy
    Connecting http://imgproc3.weathertap.com:443/radarlab/radarlab.jar with
    cookie "WxTAP_Session=Confirmed"

    Hi
    I have big problem
    When i change the jdk at 1.3.1 from 1.4.0
    my applet work some time
    Is someone is able to say why
    Thanks
    The error was :
    java.io.IOException: Caching not supported for http://192.168.205.53/classes/SAComm.jar
    at sun.plugin.cache.CachedJarLoader.download(Unknown Source)
    at sun.plugin.cache.CachedJarLoader.load(Unknown Source)
    at sun.plugin.cache.JarCache.get(Unknown Source)
    at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
    at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
    at sun.misc.URLClassPath$JarLoader.getJarFile(Unknown Source)
    at sun.misc.URLClassPath$JarLoader.<init>(Unknown Source)
    at sun.misc.URLClassPath$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.misc.URLClassPath.getLoader(Unknown Source)
    at sun.misc.URLClassPath.getLoader(Unknown Source)
    at sun.misc.URLClassPath.getResource(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    bartos

  • Generate a thumbnail from HTML by pure Java on Linux without Graphics

    hi - we in a requirement where we have to generate thumbnails from HTML code. The solution must be implemented in pure Java on Linux where there is no graphics support.
    Options tried already are :--
    1. 3rd party websites - rolled out by our client.
    2. Paid products - rolled out by our client
    3. Media Tracker and other java API - no luck as there is no support after HTML 4.0
    4. Using any os dependent native library - rolled out by our client.
    5. Lobo browser - but having troubles like it opens the browser before screenshot is taken, sometimes. Gone through by putting Thread.sleep() in between and saving remote images into a local html file etc. We got some success in there but problem doesn't end here.
    Questions -
    1. In the point # 5 above, our Linux server had graphics support but in code we set the system property java.awt.headless= true before capturing and generating thumbnail. My question is, if we set this property in the code then does it mean 100% that our code will not use any graphics support, if present in the underlying OS?
    2. Is this really possible to generate images in java on Linux where there is no X window/X server installed? Are we just wasting time in order to achieve which is unachievable?
    Any suggestions are most welcome.
    Regards,
    Sanjeev

    Thanks for ur response! Yeah - we tried but requirements are little different. We have HTML that we have to first render. Whatever output comes, we have to take a screenshot. So in order to render the html we have to have a browser first and I believe every OS which is providing browser support is having Graphics capabilities because browser would have frames, windows, toolbars, menubars etc which fall under Graphics.
    The above way is the only way that I know. If there are another way which ofcourse doesn't require graphics support, please let me know.
    So the question basically is - if I follow above mentioned image (like opening browser and capture screenshot) then is it possible on Linux with no graphics support? Actually I read on internet that lobo browser (written in java) supports this kind of feature.

  • ?Compiling Linux 2 Windows?

    Hey, I was wondering if it was possible to compile Linux made Java stuff on a Windows computer. I can run Linux Java programs like this:
    @ECHO OFF
    cls
    java -jar JARHEREBut is there anyway to compile it?
    PS: I tried using just a basic compiler:
    @echo off
    javac *.java
    pausebut it just gives me tons of errors...
    Can this be because their are quiet a few directories with Java source (.java) files in them? Like should I put them all into one directory?

    java -jar JARHERE
    But is there anyway to compile it?
    PS: I tried using just a basic compiler:
    @echo off
    javac *.javaThese are two different operations that work at different times and on different files. javac works at compile time on .java files, compiling them into .class files. 'java' runs jars or classes in .class filesBut anyway, if you've got a .java file made on a linux box it is simple to compile it in a windows machine

  • Integrate Java standalone application when WIndows start

    Hello everybody.I would like to ask you if it is possible to load a Java standalone application when any Windows platform (NT/2000/98/XP) starts.
    How can I integrate an application when WIndows start?Do I have to include the bat file(which callls the java applictaion) into a Windows system file?
    Regards.

    You can do one of several things:
    1. Write a native executable that runs the Java Archive (JAR) using the java shell command.
    2. Write a Windows shortcut that runs the java shell command (again passing in the JAR).
    3. Purchase software that will produce a native executable that will run the JAR for you.
    4. Integrate JAR files as executable programs into your Kernel. In Windows this is not easy, but again, there are solutions on the Internet, but you will most likely have to purchase these.
    5. Configure the JAR file type so that when any JAR file type is double-clicked (and the default action is performed), the Java runtime is executed with the JAR as a parameter.
    5 is my usual solution, and for operating systems like Linux, and especially MacOS, it is much easier to get JARs to run 'more natively'.
    The answer to your question is simply 'Yes' but it is your choice of how to do this.
    As far as running the JAR when your desktop starts up (Explorer in this case), you can do two things - firstly there's a 'Run' item in your registery where you can place the location of your shortcut / executable, secondly, you can simply put the short-cut or the executable (I recommend a shortcut) in your 'Startup' folder of your Start Menu. (Start -> Programs -> Startup).
    I hope this helps.
    Gen.
    http://www.opetec.com/

  • Fall into a trouble when calling a dll from java in linux

    Hi, experts:
    I encountered a big trouble when using JNI to call a C++-compiled DLL from java in Linux: The DLL function didn't execute immediately after the invocation, and was deferred till the end of the Java execution. But all worked well after migrating to windows. This problem made me nearly crazy. Can somebody help me? Thanks in advance.
    Linux: fedora core 8, jdk1.6.0_10,
    compile options: g++ -fPIC -Wall -c
    g++ -shared

    It looks like the OP compiled the C source file and linked it into a Windows .dll, which would explain why it worked flawlessly in Windows. (Though I must say the usage of GCC would make someone think it was compiled in Linux for Linux, GCC also exists for Windows, so I'm not sure it's a Windows .dll either...)
    @OP: Hello and welcome to the Sun Java forums! This situation requires you to make both a .dll and a .so, for Windows and Linux. You can then refer to the correct library for the operating system using System.loadLibrary("myLibrary"); without any extension.
    s
    Edited by: Looce on Nov 21, 2008 11:33 AM

  • Problems using RMI between linux and windows.

    I have problems using RMI between linux and windows.
    This is my scenario:
    - Server running on linux pc
    - Clients running on linux and windows PCs
    When a linux client disconnect, first time that server try to call a method of this client, a rmi.ConnectException is generated so server can catch it, mark the client as disconnected and won't communicate with it anymore.
    When a windows client (tested on XP and Vista) disconnect, no exceptions are generated (I tryed to catch all the rmi exception), so server cannot know that client is disconnected and hangs trying to communicate with the windows client.
    Any ideas?
    Thanks in advance.
    cambieri

    Thanks for your reply.
    Yes, we are implementing a sort of callback using Publisher (remote Observable) and Subscribers (remote Observer). The pattern and relative code is very well described at this link: http://www2.sys-con.com/ITSG/virtualcd/java/archives/0210/schwell/index.html (look at the notifySubscribers(Object pub, Object code) function).
    Everything works great, the only problem is this: when a Publisher that reside on a Linux server try to notify something to a "dead" Subscriber that reside on a Windows PC it does't receive the usual ConnectException and so tends to hang.
    As a workaround we have solved now starting a new Thread for each update (notification), so only that Thread is blocked (until the timeout i guess) and not the entire "notifySubscribers" function (that contact all the Subscribers).
    Beside this, using the Thread seem to give us better performance.
    Is that missed ConnectException a bug? Or we are just making some mistake?
    We are using java 6 and when both client and server are Linux or Windows the ConnectException always happen and we don't have any problem.
    I hope that now this information are enough.
    Thanks again and greetings.
    O.C.

  • Different stringWidth between Linux and Windows

    When I use Ms Windows Arial Font in my Java Program running on Linux
    I found out the rendering result of the Font is different with same program running on Windows
    The Arial Font in Linux become wider, and this cause problem because i used absoule position.
    I am using Java 1.3.1, How can solve this problem??

    The Arial under Linux and Windows are not the same. Firts, they may be different font files, second, both systems uses different rendering engines to draw them. Also, some systems, as mine, won't have Arial font at all - substitute font will be used then. So, I would expect, you will have similar problems with any other font, any other operating system or even in some specific locales which uses reversed (right-to-left) line ordering. You will also be not able to do internationalization properly.
    Simply your application is not portable and written with breaking may portability rules. I hope, you are not doing it for money. The layout managers is the only existing aswer to your problem. The closest to absolute is a SpringLayout introduced in 1.4.x.
    The absolute location problem is not a bad thing in Java only - it can screw C, VisualC and CBuilder applications. Take some of them and tweek your system settings - use large fonts for buttons, tiny fonts for menu, change whatever OS provides you to be able to change in L&F and look what will happen with some of those applications. I would be really happy to have layout managers in CBuilder.
    regards,
    Tomasz Sztejka.

  • Font differs from Linux and Windows ?

    Hi, i just want to ask, are fonts different from windows and linux in applet. I use a standard courier font.
    For example, if i make an applet with courier font texts in linux, and make the texts wrap themselves, they will run ok in linux. But if i run the compiled applet in windows, the wrapped text somewhow got truncated.
    But if i compile the applet in windows, it will look ok in linux and windows.
    I've tried replacing my courier fonts in my /usr/java/jdk/jre/lib/fonts/cour*.ttf with the cour*.ttf from c:\windows\fonts with no effects .. Applets compiled and run ok in linux doesnt work in windows. They must be compiled in windows to run ok in both.
    Why is that ?
    Does the compilation use the fonts in the jdk lib or the system fonts ?
    I'm so confused T_T
    Please Help

    How do I get Mac OS 10.4.4 and Word X for Mac to see
    all the characters in the Word for PC document
    formatted in Times New Roman?
    There's no way with Office X, which can't do Unicode Greek. You need to upgrade to Office 2004 which is Unicode-savvy and installs in your Mac the same Times New Roman with Greek, Cyrillic, Hebrew, and Arabic which is used by WinXP. An alternative might be AbiWord or NeoOffice/J.

Maybe you are looking for

  • Problem with uploading a file in Clustered Environment

    Hi, I have a problem with uploading a file in a clustered environment. I have an iview component which facilitates an upload action of an xml config file. The problem is that the upload of the modified XML file is reflected only in the central instan

  • Transfer between storage types and putaway strategies

    Dear All,                     Here is my scenario and please guide me on as detailes as you gurus can on how to proceed achieve this:                                         When receiving good from a PO the materials are received in 902: How to move

  • Link invoice to existing payment via DI Server?

    Hi all, I can not link invoice to existing payment via DI Server, please see following code:         sCmd = "<?xml version=""1.0"" encoding=""UTF-16""?>"         sCmd += "<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">"        

  • MB pro late 2011: The program shuts down and then the computer "dies"

    Hi! I just bought a Mackbook pro from late 2011 but my programs (as imovie, iphoto, spotify ect) shuts down like all the time and then the computer "dies" and sometimes I have to reformat the computer... Anyone that know why my computes is acting lik

  • Click event on a item renderer stops data being passed

    Hi I'm trying to create a item renderer based on a Canvas, this renderer is then used in a List component. I'm trying to get a click event fired when the user clicks on one of the items in the List. I'm also formatting the data being passed into the