eclipse不能自动构建class文件
来源:互联网 发布:linux虚拟机 限制cpu 编辑:程序博客网 时间:2024/04/30 04:11
环境配置
JDK1.5+Eclipse 3.1.1
文件源代码
package cimage;import java.io.*;import javax.servlet.http.*;import javax.servlet.*;import java.util.*;import java.awt.*;import java.awt.image.*;import javax.imageio.*;//import com.sun.image.codec.jpeg.*;public class Cimage extends HttpServlet{ /** * */private static final long serialVersionUID = -6836950231563427102L;public void init(ServletConfig conf) throws ServletException { super.init(conf); } public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException { res.setContentType("image/jpeg"); res.setHeader("Pragma","No-cache"); res.setHeader("Cache-Control","no-cache"); res.setDateHeader("Expires", 0); HttpSession session = req.getSession(); String chose="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; char display[]={'0',' ','0',' ','0',' ','0'},ran[]={'0','0','0','0'},temp; // 在内存中创建图象 int width=60, height=20; BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // 获取图形上下文 Graphics g = image.getGraphics(); // 生成随机类 Random random = new Random(); // 设定背景色 g.setColor(getRandColor(200,250)); g.fillRect(0, 0, width, height); // 设定字体 g.setFont(new Font("Times New Roman",Font.PLAIN,18)); // 画边框 //g.setColor(new Color()); //g.drawRect(0,0,width-1,height-1); // 随机产生155条干扰线,使图象中的认证码不易被其它程序探测到 g.setColor(getRandColor(160,200)); for (int i=0;i<155;i++) { int x = random.nextInt(width); int y = random.nextInt(height); int xl = random.nextInt(12); int yl = random.nextInt(12); g.drawLine(x,y,x+xl,y+yl); } for (int i=0;i<4;i++) { temp=chose.charAt(random.nextInt(chose.length())); display[i*2]=temp; ran[i]=temp; String randnum=String.valueOf(display[i*2]); g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110))); // 调用函数出来的颜色相同,可能是因为种子太接近,所以只能直接生成 g.drawString(randnum,13*i+6,16); } // 将认证码存入SESSION session.setAttribute("rand",String.valueOf(ran)); // 图象生效 g.dispose(); // 输出图象到页面 ImageIO.write(image, "JPEG", res.getOutputStream()); //JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(res.getOutputStream()); //encoder.encode(image); } public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException { doGet(req,res); } //给定范围获得随机颜色 private Color getRandColor(int fc,int bc) { Random random = new Random(); if(fc>255) fc=255; if(bc>255) bc=255; int r=fc+random.nextInt(bc-fc); int g=fc+random.nextInt(bc-fc); int b=fc+random.nextInt(bc-fc); return new Color(r,g,b); }}
出现的问题:
不知道是什么回事,关闭eclipse后,也不产生class文件,不知道哪位能不能告诉我?
- eclipse不能自动构建class文件
- Eclipse 或 MyEclipse 不能自动编译 class文件(转)
- Eclipse 或 MyEclipse 不能自动编译 class文件
- Eclipse 或 MyEclipse 不能自动编译 class文件(综合)
- Eclipse 或 MyEclipse 不能自动编译 class文件
- eclipse不能自动编译生成class文件的解决办法
- eclipse不能自动编译生成class文件的解决办法
- eclipse不能自动编译生成class文件的解决办法
- eclipse不能自动编译生成class文件的解决办法
- eclipse不能自动编译生成class文件的解决办法
- eclipse不能自动编译生成class文件的解决办法
- eclipse不能自动编译生成class文件的解决办法
- Eclipse不能自动编译 java文件,不会生成CLASS
- eclipse不能自动编译生成class文件的解决办法
- Eclipse不能自动编译 java文件,不会生成CLASS
- Eclipse 或 MyEclipse 不能自动编译 class文件及不能识别项目
- eclipse clean后不能自动编译生成class文件的问题
- MyEclipse 不能自动编译 class文件,class目录为空
- 开博拉!
- JRTPLIB在arm和pc间收不到数据包的问题
- 大连一游
- 通用缓存信息类
- 读后感:软件开发的葵花宝典
- eclipse不能自动构建class文件
- Oracle监听器启动失败的解决办法
- MySQL++在Visual studio 2005上配置
- word目录生成与页码处理
- 苏联27.5万亿美元消失的真相
- SRAM、DRAM;SDRAM、DDRSDRAM(DDR)、RDRAM;SARAM、DARAM的区别
- 数据库连接字符串大全 之 MYSQL篇
- 少年中国说
- 还敢用手机吗!手机也能炸爆米花?!视频!