Spiga

How To Resolve Argument Too Long Error In Unix

How To Resolve Argument Too Long Error In Unix

Sometime, when we fire some commands in the unix, then it gives the 'Argument Too Long Error' on the console. We get this error when there is lots of file, suppose there are 15k files and we want to move those file or delete those files, then it gives the same error.

How To Resolve:

To resolve these error, we will use the find commands and will pass the remove command as a argument to the find command.

find . -name '*.*' xargs rm

.           : is directory name
-name  : is type of file that we want to delete.
xargs    : is Linux command that makes passing a number of arguments to a command easier.

Hope, this will solve your problem.

New Malware That Empty Your Bank Account

New Malware That Empty Your Bank Account

New Malware has been created by the hackers that can steal usernames and passwords and defeat common methods of user authentication employed by financial institutions. The important point is that it updates the bank account transaction virtually and it becomes really impossible for the account holder to know if the account has been hacked or not, as it doesn't show any changes in the transaction.

How it Works:
Through the fake mail like for job email, free game download or get unsolicited e-mail from NACHA, the Federal Reserve, or the FDIC telling him or her that there is a problem with his or her bank account or a recent ACH (Automated Clearing House) transaction. The message includes a link in the e-mail that will supposedly help resolve whatever the issue is."Unfortunately, the link goes to a phony website, and once you’re there, you inadvertently download the Gameover malware, which promptly infects your computer and steals your banking information," the FBI said.

Prevent:
The best way to prevent this fraud way of money laundering is to keep your eyes open. Don't ever clicked on any email link from unknown source or if it is asking for bank information. Verify before clicking the link. Don't disclose your Bank related Information on the internet.
Have A Happy Internet Banking :)

Java Unsupported Class Version Error-II

Java Unsupported Class Version Error - II

In the last post we have seen about the Java Unsupported Class Version. In this post we will see more on that.

What is UnSupportedClassVersionError in Java?

Java.lang.UnsupportedClassVersionError is a subclass of java.lang.ClassFormatError. This is a kind of linking error which occurs during linking phase accordingly java.lang.ClassFormatError has also derived from java.lang.LinkageError. As the name suggests "UnSupportedClassVersionError" so it’s related to unsupported class version, now questions comes what is class version in Java? Well every source file is compiled into class file and each class file has two versions associated with it, major version and minor version. Version of class file is represented as major_version.minor_version. This version is used to determine format of class file in Java.
According to Java Virtual Machine specification, “A JVM implementation can support a class file format of version v if and only if v lies in some contiguous range Mi.0 v Mj.m. Only Sun can specify what range of versions a JVM implementation conforming to a certain release level of the Java platform may support.” For example: JDK 1.2 supports class file formats from version 45.0 to version 46.0 inclusive. So if a class file has version 48.0 it means that major version of class file is "48" and minor version is "0", which tells us that JDK 1.4 has been used to compile and generate that class file


How to fix UnSupportedClassVersionError

Now we know the root cause of UnSupportedClassVersionError that we are using a lower JVM for running the program. But major problem is that stack trace of UnSupportedClassVersionError will not tell you for which class it’s coming. So if you are using multiple third party jars in your application you find that it comes at a particular part when JVM tries to load a class from a particular jar. anyway we all know that latest version of JDK is 1.6 so maximum version of class file could be generated by JDK 6, so by using JDK 6 we can solve UnSupportedClassVersionError, but many times its not easy to just move to higher JDK version. So I would suggest:
1) Find out due to which jar or class file this UnSupportedClassVersionError is coming?
2) Try to compile source code of that jar with the JDK version you are using to run your program, if source is available.
3) If you don't have source try to find the compatible version of that library.
4) Increase the JRE version you are using to run your program.

When UnSupportedClassVersionError in Java comes:


So now we got the theory behind class file format and major and minor version of class file in Java. Now a million dollar question is when UnSupportedClassVersionError in Java does occur? precise answer of this is "When JVM tries to load a class and found that class file version is not supported it throws UnSupportedClassVersionError and it generally occurs if a higher JDK version is used to compile the source file and a lower JDK version is used to run the program. for example if you compile your java source file in JDK 1.5 and you will try to run it on JDK 1.4 you will get error "java.lang.UnsupportedClassVersionError: Bad version number in .class file [at java.lang.ClassLoader.defineClass1(Native Method)]".
But its important to note is that vice-versa is not true "you can compile your program in J2SE 1.4 and run on J2SE 1.5 and you will not get any UnSupportedClassVersionError". When a higher JDK is used for compilation it creates class file with higher version and when a lower JDK is used to run the program it found that higher version of class file not supported at JVM level and results in java.lang.UnsupportedClassVersionError

Major Class Versions of Various JDK
Following are the major version of class file format in standard JDK environment.
JDK 1.1 = 45
JDK 1.2 = 46
JDK 1.3 = 47
JDK 1.4 = 48
JDK 1.5 = 49
JDK 1.6 = 50

Java Unsupported Class Version Error

Java Unsupported Class Version Error

Java Unsupported Class Version Error occurs when we try to compile the class which has a jar file attached in its classpath and that jar file has been compiled with higher version of java then the one with which  we are trying to compile the class.

This error comes on using different java versions for compilation and execution of java program. Therefore set the path of one java version and use it for compilation and execution.

java.lang.UnsupportedClassVersionError: XXXX (Unsupported major.minor version 49.0)

        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

 If you get the above errors, do the following:
       1) Check the jar file attached in the classpath.
       2) Use the higher version (or equal but not lesser) of java for compiling the class then used for creating  the jar.
      3) Set the path of one java version and use it for compilation and execution.