开发者

Compiling code using openjdk1.6 or sun jdk1.6

开发者 https://www.devze.com 2023-02-18 23:58 出处:网络
I am trying to compile a software using javac. The problem is i removed开发者_Go百科 open-jdk using yum remove and downloaded sun jdk and installed it in the /usr/java folder.

I am trying to compile a software using javac. The problem is i removed开发者_Go百科 open-jdk using yum remove and downloaded sun jdk and installed it in the /usr/java folder.

I don't know how to figure out if the current jvm is openjdk running or sunjdk.

I removed the java and javac files from the /usr/bin folder and made the PATH variable contain the new path in /usr/java/jdk1.6-0/bin.

I still see the java file in bin folder everytime I restart the system.

Could some one help me with this?

Also if this is gonna be helpful, I am trying to compile a software and it gives the following warnings:

List is a raw type. References to generic type List should be parameterized

I think it is because of open-jdk. I'm not able to figure out how to completely remove open-jdk.

Thanks


  1. From the perspective of application behaviour, there should be no perceptible difference between OpenJDK and the equivalent Oracle JDK. The differences are down in the low levels of the JVM; e.g. performance improvements in the JIT compiler and the garbage collectors.

  2. If you need to tell which version you are actually running, use java -version, or (in a running application) look at the properties in the object System.getProperties(). (The javadoc explains what standard properties to expect.)

  3. The message about raw types is nothing to do with whether your system is OpenJDK or Oracle JDK. You will get similar warning messages with all Java 5 / 6 / 7 compilers ... including compilers from IBM and other places.

    The actual problem is in the code that you are compiling. You can safely ignore the warning in the short term ... or if the code has to remain compilable by /runnable on pre-Java 5 JVMs.


There's really nothing to worry about as for the environment details. You just need to parameterize your Collection classes like your javac warnings indicate. Learn about generics. Also post your code so that we can pinpoint the warnings.


As other people mentioned, the different JVM is nothing to worry about. Use java -version in the console to figure out which one it is.

As for the raw type message, you are probably using a Generic class without specifying the type. I.e. you use List instead of List<String>. You can simply set it to List<?> if you do not want a type, or explicitly set it to a type.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号