javac

Android: javac vs Dalvik

坚强是说给别人听的谎言 提交于 2019-11-29 19:39:01
My understanding is that Google didn't like Oracle's licensing policy for using the JRE in Java ME so it just rewrote it using its own JVM specification that mimics the JRE but behaves a little bit differently, especially when it comes to making things more efficient and more secure. So, if my understanding is correct, it means that when javac is ran on some Java source code and compiled into "binary" byetcode, a compliant JVM will interpret that bytecode different than Dalvik will (in some cases). This is the inherent difference between Dalvik and other (compliant) JVMs. If anything I have

javac : command not found

自作多情 提交于 2019-11-29 19:24:51
I have installed java in my CentOS release 5.5 machine using the command yum install java . But I am unable to compile a class using javac. Do I need to install any other package? I have tried to locate the javac executable but i am unable to locate it. /usr/bin/java is linked as follows: /usr/bin/java -> /etc/alternatives/java /etc/alternatives/java -> /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java I have seen the following output by yum list installed |grep java : java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.16.b17.el5 installed tzdata-java.x86_64 2011b-1.el5 installed ax. You installed the Java

Is there a way to improve multicore / multiprocessor performance of the Java compiler?

╄→гoц情女王★ 提交于 2019-11-29 16:30:32
问题 My coworker noticed that when javac is compiling it only utilizes a single core. Is there anything like the -j command with the gcc for Java that will allow us to distribute the compiler workload across cores or processors? If not, do you think that this will ever be possible or is there some sort of fundamental restriction as a result of Java's design? The environment is Linux with the Sun J2SE 1.6.0.11 jdk. 回答1: Although not exactly an answer to your question, some build environments like

【javac添加python 列表特性2】修改openJDK7的javac,使得java支持单...

筅森魡賤 提交于 2019-11-29 16:23:14
大四的毕业设计做的是,给java语言增加一些特性(比如python的列表和字典结构)。涉及到javac编译器前端(scanner,parser)的修改。现在才刚开始着手。。 成功编译了openJDK后,才发现原来javac的这部分代码完全是由java语言实现的,所以可以把javac的代码单独提出来,放到eclipse里面,并且用eclipse编译和调试。这样真的超方便。。 刚开始做了一个很简单的修改,让java支持单引号的字符串(只作为练习)。思想很简单,找到Scanner的代码,把处理单引号的代码修改为处理双引号的代码即可。 过程如下: 1.eclipse中新建一个工程。然后把openJDK7里面目录:openjdk7\langtools\src\share\classes\com,全部导入到eclipse中,运行。可能会遇到一个版本的问题,就是编译时的javac版本和eclipse环境中,配置Preferences->compiler 和Preferences->buildpath两个里面的版本一致即可。可以生成javac,测试没有问题。。 2.进入com.sun.tools.javac.Main,里面有一个main方法就是javac最外层的调用。它调用了com.sun.tools.javac.main.Main的compile方法进入编译。 3.单步跟踪

Diamond operator(<>) not working in java 1.7

房东的猫 提交于 2019-11-29 15:47:41
I have the following error for compiling a jsp file: '<>' operator is not allowed for source level below 1.7 I'm using jdk 1.7.x and eclipse Kepler Also I have set 1.7 as compliance level in project preferences in Eclipse, still the code is not working Should I add any other config? Check the following areas within Eclipse: Right Click Project > Properties > Project Facets > Java > Version 1.7 Right Click Project > Properties > Java Build Path > Libraries > JRE Library should be 1.7 Right Click Project > Properties > Java Compiler > Compiler compliance level Window > Preferences > Server >

Java error: class, interface, or enum expected

我怕爱的太早我们不能终老 提交于 2019-11-29 15:31:55
I need to know the output of this code. But it's not working. Maybe the code is wrong. I'm still learning how to use Java, and I tried fixing this for hours but still no luck. Here is the code: public class A { public A() { System.out.println ("A"); } } public class B extends A { public B() { System.out.println ("B"); } } public class C extends B { public C() { System.out.println ("C"); } } public static void main(String args[]) { A a = new A(); B b = new B(); C c = new C(); } Can anyone tell me what is wrong or missing in the code? For example: public class Example { public static void main

Passing “-J-Duser.language” into javac through ant to ensure compilation errors are reported in the correct language

筅森魡賤 提交于 2019-11-29 15:22:05
My PC is currently set up as Japanese for testing purposes. If my java project has a compilation error the message is reported in Japanese. e.g. Compiling 1 source file to [...directory...] [...class...].java:172: シンボルを見つけられません。 I would prefer to see the errors in english. Without using ant the fix for this is to use javac -J-Duser.language=en [..java files...] which makes javac give english error messages (the -J tells javac to pass the rest of the argument to java) My question is: how do I pass this to ant [editted to remove options I tried that didn't work] Try adding a <compilerarg> to

Java generics code compiles in eclipse but not in command line

只谈情不闲聊 提交于 2019-11-29 14:58:10
I know there have been several questions in the past regarding things that compile in eclipse but not in command line, but I could not find an answer to my problem yet. In particular, I think that I was able to set eclipse to use my system compiler, but that still did not solve the problem. I am currently checking under : 'Preferences -> Java -> Installed JREs'. This contains only one JRE which is my system one. Here are the specifics of the problem I have a java generic class that takes as argument an Enum type, like so: public class MyClass<T extends Enum<T>> Somewhere inside the class I

What Java code will force javac 1.6 to use the 'swap' and 'nop' opcodes?

喜夏-厌秋 提交于 2019-11-29 13:50:43
I'm working on an amateur JVM implementation, and I'm trying to make sure I have test coverage for all of the opcodes in the spec. I've gotten it down to the last few, but nop and swap have been eluding me. For example, here's a simple function that might use swap : static int do_swap() { int a = 56; int b = 32; return b%a; } But the bytecode produced by javac 1.6 avoids swapping in lieu of local storage: static int do_swap(); Code: 0: bipush 56 2: istore_0 3: bipush 32 5: istore_1 6: iload_1 7: iload_0 8: irem 9: ireturn Any ideas? None. The Java Language Specification does not provide such

Compilation hangs for a class with field double d = 2.2250738585072012e-308

浪子不回头ぞ 提交于 2019-11-29 13:42:05
I have come across an interesting situation. A coworker committed some changes, which would not compile on my machine neither from the IDE (Eclipse) nor from a command line (Maven). The problem manifested in the compilation process taking 100% CPU and only killing the process would help to stop it. After some analysis the cause of the problem was located and resolved. It turned out be a line "double d = 2.2250738585072012e-308" (without semicolon at the end) in one of the interfaces. The following snipped duplicates it. public class WeirdCompilationIssue { double d = 2.2250738585072012e-308 }