Java
文章平均质量分 53
lantianjialiang
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Judge Swing Thread
private void clear(){}if(SwingUtilities.isEventDispatchThread()) { clear();//判断当前线程是否是EDT,是的话,就直接调用clear} else {//否则的话,将它放入EDT队列中 SwingUtilities.invokeLater(new Runnable() { public void原创 2008-10-22 09:50:00 · 547 阅读 · 0 评论 -
SwingUtilities.invokeLater 和SwingUtilities.invokeAndWait
SwingUtilities.invokeLater :是将Runnable包起来的语句放到EDT队列中,立即返回;SwingUtilities.invokeAndWait :是将Runnable包起来的语句放到EDT队列中,并且等待语句运行完成返回;原创 2008-10-22 09:51:00 · 685 阅读 · 0 评论 -
怎样在浏览器中修改applet使用的jre版本
在windows下,对IE/firefox1.将OBJECT中的classid设置成下面的值,他的意思是说使用系统的最新jre; 2.安装最新的jre版本(当前是jre1.6.0_10),他会在applet运行环境设置对话框中添加一列"有效"3.如果要使用那个版本的话,将其他的比之版本更高的jre禁用掉;4.连接包含applet的网页。在Linux下,对firefox在firefo的安装目录下的p原创 2008-10-24 11:19:00 · 3159 阅读 · 0 评论 -
Java中调用DOS命令的问题
最近遇到一个问题,就是我的mail文件夹下面的mail太多了,使得Becky的浏览速度变得很慢,所以必须先备份原先的数据,但是又不能将目录结构删除,所以我想写一个java程序来完成这个工作。刚开始我的思路是用java中出需要删除的文件或文件夹,保存在一个set中,然后对这个set进行遍历,每一项拼成一个DOS命令,然后用Runtime.getRuntime().exec()来运行,思路是对的,但原创 2008-11-06 16:18:00 · 1116 阅读 · 0 评论 -
64位的jre和32位的jre
下面一段话是从sun的官网上得到的: There are no 64-bit versions of the Java Plugin, Java Web Start or JavaControl Panel; however the 32-bit versions of the JRE can be installedo原创 2008-12-04 10:11:00 · 10414 阅读 · 2 评论 -
CodeCoverage的使用方法
1.安装Borland Optimizeit Enterprise Suite 6.0套件,然后注册; 2.打开Code Coverage工具,进行设置,见下图: 3.点击Start now,开始运行applet;4.进行完操作后,回到Code Coverage,可以查看结果。原创 2008-12-18 13:27:00 · 1237 阅读 · 0 评论 -
从Eclipse中给程序传参数时路径的问题
在windows下如果路径中包含空格,在eclipse下传给函数时会从空格处截断,这时只要将路径名用双引号括起来就好了。原创 2008-12-18 13:30:00 · 939 阅读 · 2 评论 -
理解ThreadLocal
前一段时间看别人的source,发现使用了ThreadLocal,但是当时不知道ThreadLocal是什么,于是在网上查了一下。下面的链接将的比较详细。我就不转贴了。 参见: http://blog.csdn.net/qjyong/archive/2008/03/08/2158097.aspx转载 2009-04-29 12:57:00 · 634 阅读 · 0 评论 -
Java的一个错误提示
最近在写代码时,遇到一个错误提示,老是不知道为什么,于是google了一下,将结果写下来,供大家学习和交流。 错误提示:No enclosing instance of type Foo is accessible. Must qualify the allocation with an enclosing instance of type Foo (e.g. x.new A() wh原创 2009-05-19 15:39:00 · 1110 阅读 · 1 评论 -
关于hibernate的两个问题
1.SQL VS HQLThe Hibernate SQLQuery bypasses the Hibernate Session cache and queries ONLY against thedatabase. By the same token, HQL and the Hibernate Criteria queries check the Session cachebe原创 2009-05-25 14:16:00 · 547 阅读 · 0 评论 -
我开发一个jsp系统时碰到的问题
1.No getter method for property name problem(struts)有一种可能是Bean没有写相应的get方法,例如变量userName的get方法是getUserName;还有就是这个Bean为空; 2.MyEclipse的自动添加struts和hibernate功能不能返回,请注意!所以我先使用MyEclipse导入strut原创 2009-09-08 10:48:00 · 1145 阅读 · 0 评论 -
让tomcat支持https/ssl
◆ set path=C:/Program Files/Java/jdk1.6.0_16/bin◆ 生成certificate keystore,windows生成的文件是.keystore,在 Documents and Settings/yourloginname目录下(让输入的两个密码要一样,否则tomcat会说Cannot recover key)D:/work/now>k原创 2009-12-02 11:55:00 · 1267 阅读 · 0 评论 -
log4j 多进程写问题
可以使用socketappender解决多进程写问题。 server端代码:package log4j;import org.apache.log4j.Logger;import org.apache.log4j.net.SimpleSocketServer;public class Server{ static Logger cat = Logger.getLo原创 2009-12-02 11:57:00 · 3143 阅读 · 0 评论 -
install x64 jdk on opensolaris
first install jdk 32bithttp://java.sun.com/javase/6/webnotes/install/jdk/install-solaris.html#install-pkgthe install jdk x64http://java.sun.com/javase/6/webnotes/install/jdk/install-solaris-原创 2010-03-11 15:52:00 · 640 阅读 · 0 评论 -
Visualvm Working with Remote Applications
Visualvm可以用来监视java程序的运行状况,它可以监视本地或远端的java程序,但是在监视远端的程序时,必须进行设置。 1.在远端机器上安装jdk,必须是jdk;2.在远端及其上启动jstatd;参照http://java.sun.com/javase/6/docs/technotes/tools/share/jstatd.html,在jstatd的目录下创建一个策略文件,原创 2010-03-31 13:27:00 · 834 阅读 · 0 评论 -
有关opensolaris的一些调查和链接
所有帮助文档的集合地点:http://docs.sun.com/source/820-7679/index.html 用户管理:http://docs.sun.com/app/docs/doc/819-2379/userconcept-30?a=viewhttp://www.kobhi.com/solaris/user_management/solaris_user_m原创 2010-03-31 13:38:00 · 787 阅读 · 0 评论 -
java来做CLI
<br />使用java来做CLI的话,就要用java来接管terminal,来处理用户的输入和将结果显示给用户,还有可能要去的terminal的宽度和高度<br />等属性,但是这些在java里坐起来都是力不从心的,那该怎么办了?<br />只能使用java来调用系统的命令来控制terminal了,有一个现成的jar可以支持java来控制terminal,那就是jline,参考网址是:<br />http://jline.sourceforge.net/<br /> <br />使用它可以实现命令补全等功原创 2010-07-16 16:38:00 · 2465 阅读 · 0 评论 -
java的string format
总的格式是:%[argument_index$][flags][width][.precision]conversion例如:%2$-5.2s//2$:取第二个参数//-: 指定为左对齐,默认右对齐//5:最大输出宽度为20,不够会补空格,实际若超过则全部输出//.2:在此表示输出参数2的最大字符数量,如果是浮点数字,则表示小数部分显示的位数//s :表示输入参数是原创 2010-05-24 17:36:00 · 1080 阅读 · 0 评论 -
Java中的overload和override
<br />今天去笔试,有一个问题是请写出overload和override的区别,<br />我愣了半天,最终还是没有写出来,没写出来的理由也是一大堆,<br />所以今天重温一下.<br /> <br />Overriding a method means that its entire functionality is being replaced. Overriding is something done in a child class to a method defined in a paren转载 2010-08-09 16:18:00 · 648 阅读 · 0 评论 -
java gridbaglayout
前段时间帮同事调试一个java 程序,当作用到gridbag layout,很长时间已经不用java,所以找了下面两个链接。一个是demo一个是具体的讲解转载 2012-02-27 11:17:01 · 521 阅读 · 0 评论 -
java中的final
The final keyword can be applied to classes, methods, or fields. When applied to a class, it means that the class cannot be subclassed. 不能被继承When applied to a method, it means that the method cann转载 2012-03-30 16:50:57 · 580 阅读 · 0 评论 -
如何获得渐变的颜色(java Color Gradient)
http://www.java2s.com/Code/Java/2D-Graphics-GUI/ColorGradient.htm转载 2012-05-11 08:57:10 · 2470 阅读 · 1 评论 -
java中如何实现检查一个数是不是2的幂次方
if((i & (i-1)) == 0) { i 是2的幂次方}public class Test { public static void main(String args[]) { isPowerOfTwo(2); isPowerOfTwo(4); isPowerOfTwo(6); isPowerOfTwo(9);转载 2012-08-03 16:53:12 · 1575 阅读 · 0 评论 -
java中的bitwize操作符
Bitwise and Bit Shift Operators~ Unary bitwise complement<< Signed left shift>> Signed right shift>>> Unsigned right shift& Bitwise AND^ Bitwise exclusive OR|转载 2012-08-03 16:51:25 · 589 阅读 · 0 评论 -
UNOjava组件的创建流程
UNO ComponentsThis section will explain some very basic things about UNO components. You can skip it if you already know it. First I will explain what a component is and its main parts. Afterwards,转载 2012-09-26 11:16:09 · 1283 阅读 · 0 评论 -
javaldx是干什么的
javaldx is necessary to make Java work on some UNIX platforms.It prints a string to std out that consists of directories which have to be included into the LD_LIBRARY_PATH variable.The setting of the转载 2012-09-26 17:10:25 · 1661 阅读 · 0 评论 -
如何识别class文件的版本号
javap -verbose youclassfile| grep versionfile yourclassfile运行例:[jialiang@localhost test]$ javap -verbose HelloWorld.class | grep version minor version: 0 major version: 46[jialiang@l转载 2012-09-26 17:13:04 · 595 阅读 · 0 评论 -
java jni的资料
http://java.sun.com/docs/books/jni/html/jniTOC.html一个不错的图,直接copy过来。转载 2012-09-11 16:07:37 · 399 阅读 · 0 评论 -
java中的volatile是干什么的
Synchronization represses this caching behavior. According to the Java memorymodel, a thread's local memory is reset to the values stored in main memorywhen the thread acquires a lock. Furthermore转载 2012-10-10 10:50:38 · 570 阅读 · 0 评论 -
java中的classloader
Because class loaders exist, the Java run time does not need to know anything about files and file systems when running Java programs.A class loader starts by being a subclass of java.lang.Class转载 2012-10-10 14:56:59 · 441 阅读 · 0 评论 -
什么是OSGi
什么是OSGiThe Open Services Gateway Initiative (OSGi), also known as the Dynamic Module System for Java,OSGi也被称为Dynamic Module System for Javadefines an architecture for modular application devel转载 2012-10-12 14:13:18 · 478 阅读 · 0 评论 -
eclipse中的plugin.xml和plugin.properties没有关联起来
检查 MANIFEST.MF文件是否包含"Bundle-Localization: plugin" ,没有的话,就表示两种没有关联起来;http://stackoverflow.com/questions/1831117/what-is-the-osgi-bundle-package-structure常用的OSGi Manifest header:http://wiki.osgi原创 2011-11-10 10:32:23 · 689 阅读 · 0 评论 -
如何debug UNO的java组件
只需要将以下参数加入到OO的preference中就可以了。-Xdebug-Xnoagent-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000(jvm会等待) 或者-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000(jvm不会等待)转载 2012-09-26 11:06:35 · 568 阅读 · 0 评论 -
The Java IAQ: Infrequently Answered Questions (有关Java的不经常被问到的问题)
有关Java的不经常被问到的问题作者 Peter Norvig问题:什么是不经常被问到的问题?一个不经常被问到的问题,有可能是因为只有很少的人知道答案或者因为这个问题比较含糊(但是有时这个问题对你解决问题很重要)。我认为是我先发明这个词的,但是它在信息量很大的一个网站上也出现过(About.com Urban Legends)。这里有很多Java FAQs(有关Java的经翻译 2012-11-03 11:00:11 · 804 阅读 · 0 评论 -
Java中的wait方法
以下的的代码都是从http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4的阅读而来。1.wait抛出IllegalMonitorStateException异常,表示当前的线程没有获得w的锁package thread;public class WaitTest2 { static class W原创 2013-04-19 14:07:39 · 1323 阅读 · 0 评论 -
20非常有用的Java程序片段
20非常有用的Java程序片段http://coolshell.cn/articles/889.html转载 2013-05-20 10:27:14 · 648 阅读 · 0 评论 -
How to compile openjdk 7 in RHEL5
1. 为什么要编译openjdk的code? 因为从Eclipse调试JDK的代码时,方法中的局部变量不能显示,这样是因为编译JDK时,没有编译成debug版本。2. RHEL5中自带的开发者JDK已经是debug版本了,所以可以直接使用。 例如:java-1.6.0-openjdk-devel-1.6.0.0-1.24.1.10.4.el53. 在Eclipse中如何使用其它原创 2013-06-28 12:11:38 · 1107 阅读 · 0 评论 -
编译Java时的debug信息对class文件大小的影响
-rw-rw-r-- 1 jialiang users 107 Jul 22 11:20 Bar.java[jialiang@root java_debug_flag]$ javac -g:none Bar.java[jialiang@root java_debug_flag]$ ls -orttotal 8-rw-rw-r-- 1 jialiang 107 Jul 22 11:2原创 2013-07-24 09:42:49 · 1279 阅读 · 0 评论 -
AHK中定义变量的两种方式
;Storing & Retrieving values in/from variables; 1. traditionalMyVar = "123"MsgBox %MyVar%; 2. expressionMyVar := "123"MsgBox %MyVar%MsgBox % MyVar; In the MsgBox line above, a percent sign a转载 2013-07-25 14:07:50 · 3243 阅读 · 0 评论 -
Java中的SoftReference,WeakReference和PhantomReference
SoftReference,WeakReference和PhantomReference都是继承自Reference抽象类,在这个类中有一个static代码块,会给当前 /* High-priority thread to enqueue pending References */ private static class ReferenceHandler ex转载 2013-09-23 14:23:26 · 774 阅读 · 0 评论
分享