Java is dependent????

hi friends actualy my friend went to interview there they asked this question...
java is dependent...justifyy..
anyone can pls justify this...
thanku
byee,
keerthi.

Well it depends if there is a virtual machine to run
Java, so Java is dependent on a JVM.It's not just if there's a VM. The VM itself is platform-dependent.
Your wording is kind of vague, but I assume the question was something like, "Java claims to be platform-independent, but it is at least partially platform-dependent. Explain."
Java is platform-independent in that for many requirements, you can write and compile code where the same class files will work on any platform with a VM of the appropriate version--Windows, Linux, Mac... No need to write different code for different platforms, or even to recompile. This is because your Java code always runs on the same platform.
Java is platform-dependent in that the VM must be different for each platform. The VM provides the abstraction that lets your Java code think it's always running on the same platform, but of course a VM that runs on Windows will be different from one that runs on Linux. SOMETHING has to deal with the differences among the various platforms, and that's the VM's job.

Similar Messages

  • DES, Java version dependency?

    Hi,
    this is my first posting so please be patient :)
    i've written a module that writes DES-Encrypted email-addresses into my MySQL-database. Everything works fine, decription is working too.
    The problem is, after I've changed the Java - Version (from 1.4.2_05 to _06) and
    recompiled all classes, the addresses can't be decripted.
    Where exactly is the problem?
    Is it the recompilation itself, or java version dependency ?
    Please help me
    Thx

    The only thing that is suspect is that you don't explicitly define the block mode and the padding. Though I don't like your exception handling and I don't like the way you keep generating new byte arrays and then never using them I don't think these features cause the problem.
    Also, you should look at the SUN coding standards for method names.
    I have taken the liberty of simplifying your code. Please feel free to ignore my changes if you want.
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import java.security.*;
    import java.io.*;
    public class DEScoder
        static public class EncryptionException extends Exception
            private EncryptionException(String text, Exception chain)
                super(text, chain);
        private static final String algoName = "DESede";          // triple-DES
        private SecretKey secretKey;
        private final byte[] tripleDesKeyData;
        private Cipher cipher;
        private Cipher getCipher()
            return this.cipher;
        private SecretKey getSecretKey()
            return this.secretKey;
        private Cipher CreateCipher(String password) throws EncryptionException
            try
                secretKey = new SecretKeySpec(tripleDesKeyData, algoName);
                // /ECB/PKCS5Padding should be the default block mode and padding but just in case
                return Cipher.getInstance(algoName + "/ECB/PKCS5Padding");
            catch (Exception e)
                throw new EncryptionException("Cannot create Cipher", e);
        public synchronized String EncodeString( String originalText ) throws EncryptionException
            try
                getCipher().init( Cipher.ENCRYPT_MODE, secretKey );
                byte[] utf8 = originalText.getBytes("UTF8");
                byte[] enc = getCipher().doFinal(utf8);
                return new sun.misc.BASE64Encoder().encode(enc);
            catch (Exception e)
                throw new EncryptionException("Problem encrypting", e);
        public synchronized String DecodeString(String encryptedText) throws EncryptionException
            try
                getCipher().init(Cipher.DECRYPT_MODE, secretKey);
                byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(encryptedText);
                byte[] utf8 = getCipher().doFinal(dec);
                return new String(utf8, "UTF8");
            catch (Exception e)
                throw new EncryptionException("Problem decrypting", e);
        public DEScoder() throws EncryptionException
            try
                tripleDesKeyData = "A_key_24_characters_long".getBytes("ASCII");
                this.cipher=this.CreateCipher("allemalache");
            catch (EncryptionException e)
                throw e;
            catch (Exception e)
                throw new EncryptionException("Problem creating DESencoder", e);
        }//coder
        public static void main(String[] args)
            try
                // Make sure SUN are a valid provider
                Security.addProvider(new com.sun.crypto.provider.SunJCE());
                DEScoder dataStringEncryptAgent = new DEScoder();
                // Get the data string to encrypt from the command line
                String dataString = (args.length == 0)? "The quick brown fox jumps over the lazy dog." : args[0];
                System.out.println("Data string ....................[" + dataString + "]");
                String encodedEncryptedDataString = dataStringEncryptAgent.EncodeString(dataString);
                System.out.println("Encoded encrypted data string ..[" + encodedEncryptedDataString + "]");
                String recoveredDataString = dataStringEncryptAgent.DecodeString(encodedEncryptedDataString);
                System.out.println("Recovered data string ..........[" + recoveredDataString + "]");
            catch (Exception e)
                e.printStackTrace(System.out);
    }//classMore simplifications are possible.

  • In search of java class dependency utility

    Folks,
    We have developed a J2EE application where the "client" is a java
    application. In other words, we have created a JAR file that a user
    uses to launch our application. The manifest for this JAR file has a
    "Main-Class" attribute, so the following command is used to launch the
    (client side of) the application:
    java -jar our.jarOur entire application (both client-side and server-side) consists of
    several hundred classes. Our problem is that we don't have an accurate
    list of which classes are client-side only, which classes are
    server-side only, and which classes are required by both (client-side
    and server-side). I want our client-side JAR to only contain classes
    required by the client. Currently, we are simply bundling all the
    classes into "our.jar".
    I have found (and tried) several utilities, including:
    http://depfind.sourceforge.net/
    http://www.clarkware.com/software/JDepend.html
    http://www.horstmann.com/articles/BetterCleaner.html
    However, I don't think these are suitable. You need to supply a class
    name, and they only tell you the classes that either depend on the
    given class, or that the given class depends on. What I want is a
    "recursive" dependency finder.
    For example, let's say I have class "A". Class "A" depends on class "B"
    (in other words, class "A" needs to import class "B"). Now class "B"
    depends on class "C" and class "C" depends on class "D". Also, we have
    class "E" that depends on class "A" (in other words, class "E" needs to
    import class "A").
    The tools I mentioned above will only return (at most), classes "B" and
    "E" (when I supply them with class "A"), but what I really need them to
    return is classes "B","C" and "D" (and not necessarily class "E").
    Does anyone know how I can achieve this?
    Thanks (in advance),
    Avi.

    ClassDep from jini provides the same functionality as GenJar but I have found it better to work with. You do not need ant to run it although it does come with an ant task. ClassDep.java has a public static void main (String[] args ).
    http://java.sun.com/products/jini/2.0/doc/api/com/sun/jini/tool/ClassDep.html provides the documentation on how to use it.

  • [Solved] Pacman fails to satisfied java-runtime dependency on upgrade

    Hi. So I haven't been able to upgrade yesterday or today because of this bug. I couldn't figure out how to solve it on my own.
    This is what happens when I try to upgrade:
    jake@levi> sudo pacman -Syyu ~
    :: Synchronizing package databases...
    core 104.8 KiB 76.7K/s 00:01 [##################################################################################################] 100%
    extra 1389.5 KiB 187K/s 00:07 [##################################################################################################] 100%
    community 1549.8 KiB 191K/s 00:08 [##################################################################################################] 100%
    multilib 89.7 KiB 145K/s 00:01 [##################################################################################################] 100%
    :: Starting full system upgrade...
    resolving dependencies...
    looking for inter-conflicts...
    error: failed to prepare transaction (could not satisfy dependencies)
    :: languagetool: requires java-runtime>=6
    :: rhino: requires java-runtime
    I have jre7-openjdk-headless already installed, which provides java-runtime 7, so I don't see why I could be running into any problems.
    [1] jake@levi> pacman -Qi jre7-openjdk-headless ~
    Name : jre7-openjdk-headless
    Version : 7.b147_2.1-1
    URL : http://icedtea.classpath.org
    Licenses : custom
    Groups : None
    Provides : java-runtime=7
    Depends On : libjpeg-turbo lcms2 nss ca-certificates-java rhino
    Optional Deps : libcups: needed for Java Mauve support - libmawt.so
    fontconfig: needed for Java Mauve support - libmawt.so
    Required By : languagetool rhino
    Conflicts With : java-runtime openjdk6
    Replaces : None
    Installed Size : 107421.00 KiB
    Packager : Andreas Radke <[email protected]>
    Architecture : x86_64
    Build Date : Wed Feb 15 06:36:20 2012
    Install Date : Thu Mar 1 14:06:19 2012
    Install Reason : Installed as a dependency for another package
    Install Script : Yes
    Description : Free Java environment based on OpenJDK 7.0 with IcedTea7 replacing binary plugs - Minimal Java runtime - needed for executing non GUI Java programs
    There could be something I don't understand though. Any help is appreciated.
    Last edited by Coward (2012-03-08 00:30:57)

    mira wrote:
    Karol's advice did not worked for me, so I did this:
    pacman -Rdd jre7-openjdk-headless
    and after that this:
    pacman -S jre7-openjdk
    and then the update worked as it should. Hope that helps somebody.
    Not sure what was the issue in your case, but I did say "Try to ignore the conflicts and see if it works out." and by that I meant the '-dd' switch.
    Now I see I should have been explicit about it as my comment doesn't make it clear at all.

  • 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.

  • Date format problem in web dynpro java

    Currently, the date format that gets displayed in our webdynpro java application is MMDDYYYY...i am assuming this is because the web dynpro application has language resource set to en_US as its Current locale in the web dynpro deployed content section.  Howver i want it to display as DDMMYYYY. I have changed the default properties in visual admin for web dynpro from en to en_GB however this has no impact what so ever as the current locale is always set to en_US even after the change so am wondering this property is hidden some where else.  Now the web dynpro i am talking about is a adobe portal application. Could you give me any pointers as to where else i can look for or how i can change the current locale properly ??
    Regards
    Kal

    The date format in the Web Dynpro Java Application depends upon locale. At runtime WDJ will do the following process to get the current locale for the date format to be determined.
    1. First the WDJ Application will check for the locale set for the user in UME.
    2. If there is no default locale in UME, then the it will check for the locale in the in the browser which in most cases by default is en-us.
    3. If not, then it will check for the sap.systemLocale in the Propertysheet default of Visual Admin
    4. If there no locale specified in Visual Admin, itu2019s taken from the WAS JVM
    Please check the below SAP Note
    http://help.sap.com/saphelp_nw04/helpdata/en/a0/58db515b95b64181ef0552dc1f5c50/frameset.htm
    Regards,
    Chandran S

  • Should I use a separate JAVA instance for ADS

    My customer has Enterprise portal and R/3 installed already.  Now they want ADS installed.  Would it be best to install a new JAVA instance for ADS or should I use the existing JAVA instance that is installed for the portal?  I think the customer is preferring to use a separate instance so nothing already installed breaks.  Also, if I do use a separate JAVA instance, should I connect to the portal through SLD?
    Thanks,
    Peggy

    Hello,
    Installation of new java instance for ADS (or) using the one available inthe portal java instance depends on the following factors:-
    1) How much extra load can the existing java instance handle
    2) What is the user case and expected load for ADS in the customer landscape?
    3) Whether ADS will be used exclusively for portal ?
    Following link may give you a better idea of whether to use ADS within applicaiton portal (or) use standalone ADS
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0ce3d21-cb09-2e10-36b0-e4c8167389f6?quicklink=index&overridelayout=true
    Rgds,
    Mat.

  • Create a Table Dynamically in WEB Dynpro Java with diferent type of column

    Hi everyone, I have a question if is possible to create a table dynamically in Web Dynpro Java?, depending of the RFC consults create the rows dynamically, ,this table must have diferent type of columns, for example link column (when the user click this link execute an action and show a adobe interactive form in another view), image column (show an image depending of the information)
    Thank you everyone
    Atte Israel

    Hello,Israel.
    Yes , it is possible through dynamic programming in wdModify of the View.
    You can do this ,for example, using cell variants.
    IWDTable tab = (IWDTable) view.getElement("TABLE_NAME");               
    IWDTableStandardCell cellV= (IWDTableStandardCell) view.createElement(IWDTableStandardCell.class,"TableStandardCell"+i); 
    cellV.setVariantKey("NotEditableVariant");
    cellV.setCellDesign((WDTableCellDesign)wdContext.nodeTableDaysTitle().currentTableDaysTitleElement().getAttributeValue("CellDesign"+i));
    IWDTextView textViewi= (IWDTextView) view.createElement(IWDTextView.class,"TextView"+i);  // -- here you control the type of the object that is displayed in the cell
    textViewi.bindText(dayAttrib);
    cellV.setEditor(textViewi);          
    tabColumn.addCellVariant(cellV);
    tab.addGroupedColumn(tabColumn,tab.numberOfGroupedColumns());     
    Using this code you can control even specific cells in the table and not only columns.
    Hope this helps you,
    Constantine

  • Hardware identification using Java-application

    Hi,
    please help me! I would like to get some hardware-specific information using a Java-application? Is it possible?
    Thanks everybody,
    dzsitter

    Probably not, in pure Java. Depends on what the "hardware" is that you had in mind.

  • ADS in the Java stack of a Dialog instance on Windows + CI on iSeries

    Hi,
    I read the document "Using Adobe Document Services with SAP on IBM DB2 for i5/OS".
    Summary of the document -
    There are two possible technical scenarios:
    1. ADS in the Java stack of a Dialog instance on Windows
    1.1. ABAP+Java dialog instance on Windows
    1.2. Java dialog instance on Windows
    2. ADS in a SAP system on a supported platform
    2.1. ABAP+Java central instance on Windows/Unix
    2.2. Java central instance on Windows/Unix
    The document recomammeds technical scenario 1, that is, install a Windows Dialog instance.
    Choosing an ABAP+Java or Java system depends on the usage scenario for Interactive Forms:
    - Interactive PDF use: Java mandatory, ABAP+Java possible
    - Interactive use in SAP Maanger Self_Services/batching of forms:
    ABAP+Java mandatory but Note 993612 describes the status for NW04s SP12 onwards.
    End of summary -
    Our prefered rechnical scenario is: "1.2. Java dialog instance on Windows" to minimice resources.
    Our usage scenario for Interactive Forms includes "SAP Manager Self- Services".
    Our interpretation of note 993612 is that we do not need double stack installation. Could you confirnm this ?.
    If yes, we are going to install a Java Dialog instance on Windows connected to our Java Central instance on iSeries (our SAP Portal system) to use ADS.
    Best regards.

    Hello Torrell,
    your statements sound reasonable, also including SAP Note 993612.
    To decide, though, whether a single stack would be enough (especially based on the aforementioned note), you will need the advise of an ADS application expert (or someone else who has implemented your scenario, independent of the platform).
    I thus assume that you will not get an answer in this forum. Your question is ADS application specific.
    When you know for sure that a single stack will be enough, your approach to use a Windows dialog instance will be fine.
    Best regards, Barbara

  • AM Client java file question.

    Hello,
    I am learning OAF, when configured an AM to expose methods by Client Interface, a java file is created under /client, a reference is also made in the AM.xml:
      ComponentClass="...server.PeRatingAMImpl"
       ComponentInterface="...server.common.PeRatingAM"
       ClientProxyName="...server.client.PeRatingAMClient"The questions:
    1. Do I have any use for ClientProxyName java file or it is there to serve as adapter/glue code between my interface (AM.java and AMImpl.java?
    (Depends on answer to Q1)
    2. I'm suppose to use in my controller the AM.java, or the generated AMClient?
    Thanks in advance.

    What you will do in your controller is get a reference to the AM via the pageContext object.
    Like this:
    OAApplicationModule am=(OAApplicationModule)pageContext.getRootApplicationModule();
    Use the am ref to call methods in the am.
    Kristofer Cruz

  • How to open ppt in java

    Hello,
    i am trying to open powerpoint presentation file in my application. i donn't it is possible or not.if possible then tell me how i can do that.
    plz send me coding.
    i m wating your reply
    Thank in advance
    sandy

    It seems what you're asking is - how to open the file (xyz.ppt) for your power point presentation and read it into memory and do something useful with it. The first part is obvious, including classes from java.io or java.nio depending on your preference. However, what to do with it afterward.
    Well, there is the POI project at apache.org ... it's a set of Java classes that know how to decode Microsoft's proprietary file formats. Last I looked, the powerpoint support was minimal and fragmentary.
    It is possible, because ThinkFree (http://thinkfree.com) Office reads PPT files quite well, and writes PPT files good enough that real Power Point can read them. But they own their code and didn't release it to the public.
    - David

  • Java class size

    hi,
    a general question.
    does the size of the running java class depend upon the number of jar files in its classpath?
    for exampl, i have three jar files, only one of which is used by my java class. when i run the java class does the memory size gets bigger if i include all three jar files in my classpath?
    thanks a lot

    i think not. it matter only which of these files you load.
    but if you have lotsa classes in your path, then it might be little harder for your JVM to locate these classes that are needed and therefore your app might run little slower.
    but when you have initialiced your classes, then loding them again will not need classloader to look for your class from classpath... so that cost you'll be paying is onetime cost for very JVM execution.

  • After installing Java 6 update 11, unable to open .jnlp files.

    Appears to download application then quits without an error message. When clicking on the .jnlp file again, nothing happens. I can go into java preferences and remove the application from the cache, but it does the same thing, redownloads the application then doesn't open it.

    Java is notoriously responsible for many vulnerabilities, if you must run it then these are the instructions:
    Turning on Java
    Why will Applets not run after getting Java through Apple Software Update?
    Apple disables the Java plug-in and Webstart applications when the Java update is done using Software Update. Also, if the Java plug-in detects that no applets have been run for an extended period of time it will again disable the Java plug-in.
    To enable the Java plug-in
    Go to Finder > Applications > Utilities > Java Preferences.
    In the Java Preferences window check the box for Enable Applet plug-in and Webstart applications.
    Installing and updating Java
    I DO NOT have Mac version 10.7.3 (Lion) or higher. How do I get Java for other Mac versions?
    For Java versions 6 and below, Apple supplies their own version of Java. Use the Software Update feature (available on the Apple menu) to check that you have the most up-to-date version of Apple's Java for your Mac.
    I DO have Mac version 10.7.3 (Lion) or higher.
    Users of Lion Mac OS X 10.7.1 and 10.7.2 should upgrade to 10.7.3 or later versions via Software Update, so you can get the latest Java 7 version from Oracle.
    Download page here:
    https://www.java.com/en/download/manual.jsp#mac
    Why is Java 7 available only for Mac OS X 10.7.3 and above?
    The Java Runtime depends on the availability of an Application programming interface (API). Some of the API were added in Mac OS X 10.7.3. Apple has no plans to make those API available on older versions of the Mac OS.
    Further Hardening your Mac against web based Java attacks
    Harden your Mac against malware attacks

  • How to compile and run a java program?

    I am getting this error message, what to do?
    Exception in thread "main" java.lang.NoClassDefFoundError:
    Thanks for you help.
    Ajay

    Hello,
    I believe that this error is caused because when you
    compile and run a java program, you have to use the
    same name that is next to public class. For example,
    the program name is next to the word public class.
    For example, if a program began like this:
    public class Concat
    then the name of the program in this case is Concat
    and when you compile it you type: javac Concat.java
    when you run it type: java Concat
    depending on the name of your program.and depending on whether the class is in a package. And depending on what directory you are currently in.
    Also depending on if you set your class path you might
    have to type the above like this: jdk1.2.1\bin\javac
    Concat.java to compile, and to run you would have to
    type jdk1.2.1\bin\java Concat where you would replace
    Concat with the name of your program and replace
    jdk1.2.1 with the name of your version of java, that
    is again if you do not have your classpath set. Hope
    this helps.Your examples have nothing to do with whether the CLASSPATH is set--only with whether the PATH is set. And, it may not be jdkXXX\bin. The path to the JDK (in this case, to javac and java executables) could be anything. Classpath should be set on the command line. The OP probably did NOT set a classpath on the command line (preferred), or in the environment variables.
    Also, make sure you did not forget to put:
    public static void main(String[ ] args)
    on the line underneath the line where it says "public
    class Concat" where Concat is the name of your
    program. Again, I hope this helps.Irrelevant (with the info we have from the OP so far). The error says that the JVM can't even find the class--not that the class doesn't have a main. The "main" referred to in the error message is within the JVM itself.
    OP: Did you fix your problem? If not, what directory are your files in? Are they in a package? What command are you typing to get that error? That is, please tell us your entire command line.

Maybe you are looking for

  • In unicode programs how to handle unix files

    Hi Abapers, In Unicode programs.   while transfering  file from unix directory to pdf format, logo is missing in that pdf file . how to handle this error. Thanks, Praveen

  • My volume is lock what do i use to unlock?

    My Ipod Classic Volume is lock,just bought it today,what numbers will unlock volume?

  • Upgrade to Mac OS X 10.5

    Need help, I´ve an Imac with OS X 10.4.11 procesor 2.4 ghz Intel Core 2 Duo, I need to upgrade to 10.5 in order to continue all the others upgrades in order to make my Iphone works. Where can I get this software?

  • Aperture 3: multiple export hangs while generating thumbnails?

    Sigh. I was almost ready to write a blog post claiming that while AP3 has its share of bugs, it's not the unusable mess some have painted it to be. This morning I'm no so sure anymore. I think this is stellar update with tons of potential. When it wo

  • Azure: Updating a label on a VM

    I have a need to update VM labels; not Cloud Service labels. Right now the VM label is blank and I cannot find how to update this field from PowerShell. Any advice would be appreciated.