Java完全独立于平台吗?
如果没有,那么需要注意看看用Java编写的代码可以在多平台上运行.基本上它应该适用于Windows(各种版本),Linux(所有版本),Mac和Solaris等目标平台.
使用Java Timer,然后切换到ScheduledExecutorService,但我的问题没有修复.在系统时间更改之前安排的任务(通过ntpd)不会在指定的延迟时执行.没有任何日志记录:(.
在64位linux上使用我的目标中的jre 1.6.0_26 64位.
更新: ScheduledExecutorService在Windows上运行正常.问题仅出在运行64位JVM的基于64位Linux的系统上.它在运行32位JVM的64位linux上运行良好......很奇怪.在任何博客上都没有找到任何相同的参考.
IBM的JAVA SDK也存在同样的问题(ibm-java-sdk-7.0-0.0-x86_64-archive.bin).
我已经提交了针对JDK 7139684的缺陷,它被接受但已被关闭并标记为 6900441的副本.请投票给它,如果你觉得它的价值得到修复...我不知道为什么它已经修复了几年以上
以下是我用来测试此问题的示例代码:
package test;
import java.io.IOException;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* @author yogesh
*
*/
public class TimerCheck implements Runnable {
ScheduledExecutorService worker;
public TimerCheck(ScheduledExecutorService worker) {
super();
this.worker = worker;
this.worker.schedule(this, 1, TimeUnit.SECONDS);
}
private static void update() {
System.out.println("TimerCheck.update() "+new Date(System.currentTimeMillis()));
}
@Override
public void run() {
update();
worker.schedule(this, 1, TimeUnit.SECONDS);
}
/**
* @param args
*/
public static void …Run Code Online (Sandbox Code Playgroud) 我的构建服务器是基于linux的.我需要protoc将它集成到我的基于ant的构建系统中.
我在build.xml中使用以下内容:
<exec executable="tools/protoc.exe" failonerror="true">
<arg value="--java_out=../protos/java/generated" />
<arg value="--proto_path=../protos/proto" />
<arg value="../protos/proto/*.proto" />
</exec>
Run Code Online (Sandbox Code Playgroud)
我找到了windows二进制文件,但是没有为protoc找到linux二进制文件.
找到一个或构建静态链接的protoc二进制文件的任何帮助都会很好.
几个问题:):
如何识别当前安装的JVM?(64位/ 32位)
在为64位JVM目标平台编程时,是否需要做一些考虑?
我的Java代码可以在32位以及64位JVM上运行吗?
如何在64位JVM上运行我的Java App?
如何识别我的Java App使用的JVM?
使用SSL添加对网络通道加密的支持.
需要一些参考和示例代码.
Doc http://docs.jboss.org/netty/3.2/guide/pdf/netty.pdf文件仅指使用SSLHandler可能.
我对使用什么感到困惑.我看到的选项是awt,Swing和swt.
我的问题是哪个应该最适合所有平台(Mac,Windows和Linux)上的桌面Java应用程序,并且具有最小的平台相关代码?
class A
{
int i,j;
A (int x, int y)
{
i = x;
j = y;
}
void show()
{
System.out.println("the value of i and j are " + i + " " + j);
}
}
class B extends A // here is the error
{
int k;
B (int z, int a, int b )
{
k = z;
i = a;
j = b;
}
void display()
{
System.out.println("the value of k is " +k);
} …Run Code Online (Sandbox Code Playgroud)