Is there any way to find the java version from a compiled java .class file ?
122057
Do any of you know of a tool that will search for .class files and then display their compiled versions?  I know you can look at them individually in a hex editor but I have a lot of class files to look over (something in my giant application is compiling to Java6 for some reason).
67142
I just installed Oracle's Java version 7u7 on my Mac (running OSX Mountain Lion). However, when I run java -version it still displays the old version (6u29).    How do I fix this? Do I even need to fix this? What version will browsers (Firefox) use in this case? And what version will be used when I run Java applications directly?  I've seen  but this doesn't work in my situation (probably because this question is about the JRE and the other question about the JDK). In my case the Java Preferences app only displays Java 6 versions (32 bit and 64 bit).    Update:   which java points to /usr/bin/java /usr/bin/java is a symlink to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java /System/Library/Frameworks/JavaVM.framework/Versions/ only contains the folder A (awesome version name) - which Current points to.
1580
Given a hotkey, how can I find which program owns it?
120453
I would like to print the "object reference" of an object in Java for debugging purposes. I.e. to make sure that the object is the same (or different) depending on the situation.  The problem is that the class in question inherits from another class, which has overriden both toString() and hashCode() which would usually give me the id.  Example situation: Running a multi-threaded application, where I (during development) want to check if all the threads use the same instance of a resource object or not.
13369
I have an Object[] array, and I am trying to find the ones that are primitives. I've tried to use Class.isPrimitive(), but it seems I'm doing something wrong:  int i = 3; Object o = i;  System.out.println(o.getClass().getName() + ", " +                    o.getClass().isPrimitive());   prints java.lang.Integer, false.  Is there a right way or some alternative?
14648
Is it possible to find all classes or interfaces in a given package? (Quickly looking at e.g. , it would seem like no.)
47000
How can I completely remove all traces of Java on my system?   I already know  in case I need it again.
108432
I'm trying to launch java:  $ java -version java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory  $ ldd /usr/lib/jvm/java-6-openjdk/jre/bin/java         linux-gate.so.1 =&gt;  (0xb779f000)         libz.so.1 =&gt; /usr/lib/libz.so.1 (0xb7780000)         libpthread.so.0 =&gt; /lib/i686/cmov/libpthread.so.0 (0xb7767000)         libjli.so =&gt; /usr/lib/jvm/java-6-openjdk/jre/bin/../lib/i386/jli/libjli.so (0xb7762000)         libdl.so.2 =&gt; /lib/i686/cmov/libdl.so.2 (0xb775e000)         libc.so.6 =&gt; /lib/i686/cmov/libc.so.6 (0xb7603000)         /lib/ld-linux.so.2 (0xb77a0000 $ ls /usr/lib/jvm/java-6-openjdk/jre/bin/../lib/i386/jli/ libjli.so   But java works under root:  $ sudo java -version java version "1.6.0_18" OpenJDK Runtime Environment (IcedTea6 1.8.7) (6b18-1.8.7-2~lenny1) OpenJDK Client VM (build 14.0-b16, mixed mode, sharing)   UPD:  /usr/lib/jvm/java-6-openjdk/jre/bin/java is actually my java command:  $ type java java is hashed (/usr/bin/java) $ ls -l /usr/bin/java lrwxrwxrwx 1 root root 22 Jul 14 10:15 /usr/bin/java -&gt; /etc/alternatives/java $ ls -l /etc/alternatives/java lrwxrwxrwx 1 root root 40 Jul 14 10:36 /etc/alternatives/java -&gt; /usr/lib/jvm/java-6-openjdk/jre/bin/java   UPD2:  I've also tried to set root PATH:  $ sudo su # echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin # exit $ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin $ java -version java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory   UPD3:  I'm tried:  # comm -3 &lt;(declare | sort) &lt;(declare -f | sort)   under root. But there is no usable environment variables for java.  UPD4:  strace -f java -version result:
97259
When I look at System Preferences > Java > Update, I see      Your system has the recommended version of Java.   Java 7 Update 79  From Terminal, java -version:     java version "1.7.0_71"   Java(TM) SE Runtime Environment (build 1.7.0_71-b14)   Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)  From Terminal, export:     JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home"  In addition to that, I also have the Java from Apple/Oracle installed as well (when first prompted to install when opening a Java-based app when there's no Java yet installed)   Questions:   Is Java 7 Update 79 == jdk1.7.0._71.jdk? Or are these separate? When running some thing with Java, there is always the following:      objc[63077]: Class JavaLaunchHelper is implemented in both   /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/jre/bin/java   and   /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/jre/lib/libinstrument.dylib.   One of the two will be used. Which one is undefined.    I'd be more than willing starting from scratch had I understood the steps to do that properly (remove, re-install). If it matters, am running OS X 10.10.
30764
We need to get all the instances of objects that implement a given interface - can we do that, and if so how?
18590
Is it possible to access the Abstract Syntax Tree(AST) inside the javac.exe programmatically? Could you provide an example?
122919
How do you check the windows version in Win32 at runtime?
3732
For example:  javac Foo.java Note: Foo.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
37164
Is there a way to get the name of the currently executing method in Java?
82102
I have installed JDK 6, but I can't execute a Java program.   For example, I have made test.java.  I compile it with javac tes.java and there's no error when I compile it, but when I want to execute that program it always displays an error.  I execute the Java program with java tes.  Exception in thread "main" java.lang.UnsupportedClassVersionError: tes : Unsupported major.minor version 51.0     at java.lang.ClassLoader.defineClass1(Native Method)     at java.lang.ClassLoader.defineClass(ClassLoader.java:634)     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)     at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)     at java.net.URLClassLoader.access$000(URLClassLoader.java:73)     at java.net.URLClassLoader$1.run(URLClassLoader.java:212)     at java.security.AccessController.doPrivileged(Native Method)     at java.net.URLClassLoader.findClass(URLClassLoader.java:205)     at java.lang.ClassLoader.loadClass(ClassLoader.java:321)     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)     at java.lang.ClassLoader.loadClass(ClassLoader.java:266) Could not find the main class: tes. Program will exit.   My javac version is 1.7.0, my java version is 1.6.0.  Here is my tes.java code:  class tes{      public static void main(String[]args){         System.out.println("hello");         }     }
22377
Some time ago, I came across a piece of code, that used some piece of standard Java functionality to locate the classes that implemented a given interface. I know the functions were hidden in some non-logical place, but they could be used for other classes as the package name implied. Back then I did not need it, so I forgot about it, but now I do, and I can't seem to find the functions again. Where can these functions be found?  Edit: I'm not looking for any IDE functions or anything, but rather something that can be executed within the Java application.
75933
Is it possible to specify a Java classpath that includes a JAR file contained within another JAR file?