如果想观察JVM进程占用的堆内存,可以通过命令工具jmap或者可视化工具jvisualvm.exe.JVM这些启动参数都拥有默认值,如果想了解JVM的内存分配策略,最好手动设置这些启动参数.再通过JDK提供的工具的统计结果,进行对比,就比较容易理解这些内存分配的理论知识.运行环境是win7 32位操作系统,JDK1.7.0_60版本. 测试代码和JVM启动参数如下: public class Test { public static void main(String[] args) { ; wh
[root@MSJTVL-MJSP-A01 sm01]# vim /etc/rc.d/rc.local #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /v
很多时候我们都会碰到需要在程序启动时去执行的方法,比如说去读取某个配置,预加载缓存,定时任务的初始化等.这里给出几种解决方案供大家参考. 1. 使用@PostConstruct注解 这个注解呢,可以在Spring加载这个类的时候执行一次.来看一下下方代码. 123456789101112131415161718192021 @Componentpublic class Test { public Test(){ System.out.println("我最先执行"); } /** *我
这两天也没改过eclipse和java的配置,但eclipse启动时报告错误:Java was started but returned exit code=-805306369 后来在eclipse.ini的最后加了以下一行就搞定了. -XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith