Exception in thread "main" java.lang.NullPointerException怎么解决??? [问题点数:40分,结帖人wanwangzi]

Bbs1
本版专家分:0
结帖率 100%
Bbs1
本版专家分:0
Bbs1
本版专家分:0
main" java.lang.NullPointerException如何解决?">Exception in thread "main" java.lang.NullPointerException如何解决?
对于许多初学java的人来说,这个异常最常见了,那么什么时候会产生这个异常呢? 切记:对于新手来说,大多数情况因为SQL语句错误会报许多错误,包括空指针异常; 1.首先javaSE中AWTswing里面,当我们写组件时会产生这个异常; 例如: 当我添加工具栏时会产生NullPointerException(我将//this.toolBar = new JToolBar();这行代码注释掉了);为...
main" java.lang.NullPointerException at Server.main(Server.java:22)">Exception in thread "main" java.lang.NullPointerException at Server.main(Server.java:22)
详见代码,结果如下: 正在监听Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException at Server.<em>main</em>(Server.java:
main" java.lang.NullPointerException">JAVA类对象的数组报错Exception in thread "main" java.lang.NullPointerException
今天学了JAVA对象的数组。数组元素可以是任意类型的数据,因此尝试使用自己构建的数据类型的数组。 一开始对这个概念不<em>怎么</em>理解,代码是这样的 public class HelloWorl { public static void <em>main</em>(String[] args) { Test[] c = new Test[2]; for(int k = 0;k < c.length ;k
main" java.lang.NullPointerException">java使用类数组 报错Exception in thread "main" java.lang.NullPointerException
转载。 参考来源链接: https://zhidao.baidu.com/question/494551043.html https://www.cnblogs.com/iAmSoScArEd/p/9762674.html 可能有以下几种情况发生空指针异常:解释是"程序遇上了空指针"。简单地说就是调用了未经初始化的对象或者是不存在的对象,这个错误经常出现在创建图片,调用数组这些操作中,比如...
main" java.lang.NullPointerException">Java中使用数组报错:Exception in thread "main" java.lang.NullPointerException
今天在用JAVA写栈的时候报了这样一个错误,出错源码部分如下: private int maxSize; private char[] array= new char[5]; private int top; public Stacks(int size) { this.maxSize = size; top = -1; } public void Push(char...
main" java.lang.NullPointerException">Exception in thread "main" java.lang.NullPointerException
希望高手指点
main" java.lang.NullPointerException的问题">Exception in thread "main" java.lang.NullPointerException的问题
[TOC]问题叙述 出现Exception in <em>thread</em> &amp;amp;quot;<em>main</em>&amp;amp;quot; java.lang.NullPointerException一般是因为指针为空,也就是说这个时候你要注意你的对象是否已经初始化(new)了 例如 ![例子Path类](https://img-blog.csdn.net/20180909120307226?watermark/2/text/aHR0cHM6Ly9ibG...
main" java.lang.NullPointerException">JDBC编程中出现这样的问题Exception in thread "main" java.lang.NullPointerException
package com.jdbc.dbutils; import java.sql.Connection; import java.sql.DriverManager; import java.sql
java.lang.NullPointerException这个怎么解决
import java.awt.Point; import javax.swing.JOptionPane; import java.text.DecimalFormat; class Triangl
main" java.lang.NullPointerException">java程序抛出异常 Exception in thread "main" java.lang.NullPointerException
程序的全部代码如下: import java.awt.*; import java.awt.event.*; import java.net.*; import javax.swing.*; publ
main" java.lang.NullPointerException报错原因">Exception in thread "main" java.lang.NullPointerException报错原因
今天写了这么一段代码: class Books{ String title; String author; } class BooksTestDrive{ public static void <em>main</em>(String [] args){ Books[] myBooks = new Books[3]; int x = 0; myBooks[0].title = &quot;java aaaa&quot;; my...
main" java.lang.NullPointerException一例解决">Exception in thread "main" java.lang.NullPointerException一例解决
完整报错信息是: Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException at scala.io.Source$.fromURL(Source.scala:141) at RunGeoTime$.<em>main</em>(RunGeoTime.scala:66) at RunGeoTime.<em>main</em>(RunGeoTime.scala) at ...
main" java.lang.NullPointerException问题">Exception in thread "main" java.lang.NullPointerException问题
Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException 该问题多半是由于用到的某个对象只进行了声明,而没有初始化,即没有被new 比如说: 一个类Person,有一个对象p1 声明对象 Person p1; 使用该对象(调用它的某个方法等)  p1.setXXX(...); 这种情况下就会产生上述错误。 改正方法: 在使用
java.lang.NullPointerException 空指针异常 求解决
java.lang.NullPointerException com.psger.dao.UserBeanDao.getUserBeanByUsername(UserBeanDao.java:33)
main" java.lang.NullPointerException at test.AdjMGraph.InitateAaj(AdjMGraph.jav">Exception in thread "main" java.lang.NullPointerException at test.AdjMGraph.InitateAaj(AdjMGraph.jav
Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException at test.AdjMGraph.InitateAaj(AdjMGraph.java:48 at test.AdjMGraph.InitateAaj(AdjMGraph.java:48) at test.Main.<em>main</em>(Main.java:10)) 出错的原因原来是定义数...
main" java.lang.NullPointerException问题的解决">Hadoop---Exception in thread "main" java.lang.NullPointerException问题的解决
Hadoop---Exception in <em>thread</em> &quot;<em>main</em>&quot; java.lang.NullPointerException问题的<em>解决</em>     Exception in <em>thread</em> &quot;<em>main</em>&quot; java.lang.NullPointerException问题的<em>解决</em>  <em>解决</em>:   首先我们来分析下这个问题,我是使用debug测试看哪里是空的。     然后跑去百度...
main" java.lang.NullPointerException">连接数据库连接池 Exception in thread "main" java.lang.NullPointerException
今天测试数据库连接池发现一直是空指针错误。一般都是配置文件出了问题。找了半天才发现,在没有密码的情况下不要加入password=null,估计是没有加入关键字解析的。直接省去不写就好了 driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/igeek2?useUnicode=true&amp;amp;character...
main" java.lang.NullPointerException,同时发现很多问题。">爬取数据,但是写入数据库时,提示Exception in thread "main" java.lang.NullPointerException,同时发现很多问题。
主函数 package com.company.spriderjd; import com.company.dao.ProductDao; import com.company.do<em>main</em>.Product; import com.google.gson.Gson; import org.apache.http.client.methods.CloseableHttpRespon...
main" java.lang.NullPointerException">Java报错异常-----Exception in thread "main" java.lang.NullPointerException
异常提示: Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException at java.awt.Container.addImpl(Container.java:1045) at java.awt.Container.add(Container.java:365) at com.Textarea.JT_area.(JT_area.ja
main" java.lang.NullPointerException 怎么解决。">异常Exception in thread "main" java.lang.NullPointerException 怎么解决
我写了一个两个机器通信的程序,这个服务器端的代码rn[code=Java]rnpackage mySocket;rnrn//服务器端程序rnimport java.io.*;rnimport java.net.*;rnimport java.awt.*;rnimport java.awt.event.*;rnrnpublic class Server1 extends Frame implements ActionListener rn Label label = new Label("输入信息");rn TextField tf = new TextField(20);rn TextArea ta = new TextArea();rn Panel panel = new Panel();// 创建面板对象rn ServerSocket server;rn Socket Client;rn InputStream DataIn;rn OutputStream DataOut;rnrn @SuppressWarnings("deprecation")rn public Server1() rn super("通信--服务器端");rn setSize(300, 180);rn panel.add(label);// 在面板上添加标签rn panel.add(tf);// 在面板上添加文本框rn tf.addActionListener(this);// 注册rn add("North", panel);// 在窗体上添加面板rn add("Center", ta);// 在窗体上添加文本区rn addWindowListener(new WindowAdapter() rn public void windowClosing(WindowEvent e) rn System.exit(0);rn rn );rn show();rn try rn server = new ServerSocket(8888);rn Client = server.accept();rn ta.append("已经和客户端建立连接:" + Client.getInetAddress().getHostName()rn + "\n\n");rn DataIn = Client.getInputStream();rn DataOut = Client.getOutputStream();rn catch (IOException ioe) rn rn while (true) rn try rn byte buff[] = new byte[512];// 缓冲数组rn DataIn.read(buff);rn String str = new String(buff);// 接受客户端发送的数据包rn ta.append("Client :" + str + "\n");rn ta.append("\n");rn catch (IOException ioe) rn rn rn rnrn public static void <em>main</em>(String args[]) rn new Server1();rn rnrn public void actionPerformed(ActionEvent e)// 事件处理程序rn rn try rn String str = new String(tf.getText());rn byte buf[] = str.getBytes();rn tf.setText(" ");rn DataOut.write(buf);rn ta.append("Server :" + str + "\n");rn catch (IOException ioe) rn rn rnrnrn[/code]rn运行有rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at mySocket.Server1.(Server1.java:46)rn at mySocket.Server1.<em>main</em>(Server1.java:56)rn这样的异常rn界面还是能出来的。rn初学java,大家帮忙看看。rn谢谢各位了。
main\" java.lang.LinkageError错误的解决">Exception in thread \"main\" java.lang.LinkageError错误的解决
NULL 博文链接:https://utopialxw.iteye.com/blog/1138133
main" java.lang.NullPointerException">如何解决:Exception in thread "main" java.lang.NullPointerException
各位高手,本人新手上路.玩个简单的程序却遇到了个问题.编译时没报错,但是运行就有问题,麻烦大家帮忙看一下.小弟不胜感激!!! 源程序如下: package swing; import java.awt
连接oracle数据库,为什么报错java.lang.NullPointerException。
import java.sql.*; class sql { private static Connection con=null; private static Statement stmt=nul
java.lang.NullPointerException解决方法
严重: Exception starting filter struts2 java.lang.NullPointerException
main" java.lang.NullPointerException怎么解决啊">Exception in thread "main" java.lang.NullPointerException怎么解决
[b]StudentMain.java[/b]rnpackage com.lele.jdbc.<em>main</em>;rnrnimport java.util.Scanner;rnrnimport com.lele.jdbc.menu.Menu;rnimport com.lele.jdbc.menu.Menu;rnrnrnpublic class StudentMain rn public static void <em>main</em>(String[] args)rn Scanner s=new Scanner(System.in);rn boolean ok = true;rn while(ok)rn Menu.startInterface();rn int i = s.nextInt(); //输入一个整数rn switch(i )rn case 1:rn Menu.look();rn break;rn case 2:rn Menu.Insert();rn break;rn case 3:rn Menu.alter();rn break;rn case 4:rn Menu.query();rn break;rn case 5:rn System.out.println(" 欢迎使用学生信息管理系统,再见!");rn ok = false;rn break;rn rn rn rn rnrnrnrn[b]Menu.java[/b]rnpackage com.lele.jdbc.menu;rnrnimport java.util.List;rnimport java.util.Scanner;rnrnimport com.lele.jdbc.dao.StudentD;rnimport com.lele.jdbc.model.Student;rnrnpublic class Menu rn rn public static StudentD sD = new StudentD();rn public static Scanner s = new Scanner(System.in);rn rn public static void startInterface()rn System.out.println("***********欢迎使用学生信息管理系统************");rn System.out.println("1.浏览信息数据");rn System.out.println("2.增加信息数据");rn System.out.println("3.修改信息数据");rn System.out.println("4.查询信息数据");rn System.out.println("5.退出");rn rnrn public static void look() rn List< Student > l = sD.getAllStudent();rn System.out.println("所有的学生信息为:");rn System.out.println("-------------------");rn System.out.println("学生编号\t学生学号\t学生姓名\t学生性别\t学生年龄");rn for( Student s : l )rn System.out.println(s.getId()+"\t"+s.getNumber()+"\t"+s.getName()+"\t"+s.getSex()+"\t"+s.getAge());rn rn if( l.size()==0 )rn System.out.println("您所查询的 数据不存在!");rn rn methodEnd();rn rnrn public static void Insert() rn Student student = new Student();rn System.out.println("学生信息输入");rn Scanner s = new Scanner(System.in);rn System.out.println("请输入学生学号:");rn int number= s.nextInt();rn System.out.println("请输入学生姓名:");rn String name=s.next();rn System.out.println("请输入学生性别:");rn String sex=s.next();rn System.out.println("请输入学生年龄:");rn int age=s.nextInt();rn sD.save(student);rn System.out.println("添加成功!");rn methodEnd();rn rnrn public static void alter() rn List< Student > l = sD.getAllStudent();rn System.out.println("全部学生信息:");rn System.out.println("-------------------");rn System.out.println("学生编号\t学生学号\t学生姓名\t学生性别\t学生年龄");rn for( Student s : l )rn System.out.println(s.getId()+"\t"+s.getNumber()+"\t"+s.getName()+"\t"+s.getSex()+"\t"+s.getAge());rn rn Student student = new Student();rn System.out.println("请输入要修改的学生的编号");rn Scanner a=new Scanner(System.in); rn int ID=a.nextInt();rn System.out.println("请输入学生学号:");rn int number= a.nextInt();rn System.out.println("请输入学生姓名:");rn String name=a.next();rn System.out.println("请输入学生性别:");rn String sex=a.next();rn System.out.println("请输入学生年龄:");rn int age=a.nextInt();rn try rn sD.updateById(student);rn catch (Exception e) rn System.out.println("更新失败,请检查您的输入!");rn return ;rn rn System.out.println("更新成功");rn methodEnd();rn rnrn public static void query() rn System.out.println("请输入要查询的学生编号:");rn String num = s.next();rn int number = 0 ;rn try rn number = Integer.parseInt(num);rn catch (NumberFormatException e) rn rn if( number==0 )rn System.out.println("输入的学号不正确,请重新输入:");rn query();rn elsern Student s = sD.getById(number);rn if( s==null )rn System.out.println("所查询的学生不存在!");rn elsern System.out.println(s);rn methodEnd();rn rn rn rn public static void methodEnd()rn System.out.println("请按任意键并回车继续......");rn new Scanner(System.in).next();rn rnrnrnrnrnrnrn[b]DataBase。java[/b]rnrnrnpackage com.lele.jdbc.util;rnrnimport java.sql.Connection;rnimport java.sql.DriverManager;rnimport java.sql.SQLException;rnrnpublic class DataBase rn static rn tryrn Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");rn catch (ClassNotFoundException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn public static Connection getConnection() throws SQLException rn Connection con = null;rn String url = "jdbc:odbc:Driver=MicroSoft Access Driver (*.mdb);DBQ=D:\\study software\\java\\java实验\\综合性实验\\stu.mdb"; rn Connection conn = DriverManager.getConnection(url, "", ""); rn return con;rn rnrnrnrnrnrn[b]StudentD.java[/b]rnpackage com.lele.jdbc.dao;rnrnimport java.sql.Connection;rnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnimport java.sql.Statement;rnimport java.util.ArrayList;rnimport java.util.List;rnrnimport com.lele.jdbc.model.Student;rnimport com.lele.jdbc.util.DataBase;rnrnpublic class StudentD rnrn private Connection con = null;rn private Statement stmt = null;rn private ResultSet rs = null;rn rn public List getAllStudent() rn List list = new ArrayList();rn try rn con = DataBase.getConnection();rn stmt = con.createStatement();rn String sql = "select * from student";rn rs = stmt.executeQuery(sql);rn while(rs.next()) rn Student po = new Student();rn po.setId(rs.getInt(1));rn po.setNumber(rs.getInt(2));rn po.setName(rs.getString(3));rn po.setSex(rs.getString(4));rn po.setAge(rs.getInt(5));rn list.add(po);rn rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn finally rn try rn rs.close();rn stmt.close();rn con.close();rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn return list;rn rn public boolean save(Student po) rn System.out.println(po);rn boolean b =false;rn try rn con = DataBase.getConnection();rn stmt = con.createStatement();rn String sql = "insert into student values(null,"+po.getNumber()+",'"+po.getName()+"','"+po.getSex()+"',"+po.getAge()+")";rn int i =stmt.executeUpdate(sql);rn if(i>0) b = true;rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn finally rn try rn stmt.close();rn con.close();rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn return b;rn rn rn public Student getById(int id) rn Student po = null;rn try rn con = DataBase.getConnection();rn stmt = con.createStatement();rn String sql = "select * from student where Id="+id;rn rs = stmt.executeQuery(sql);rn if(rs.next()) rn po = new Student();rn po.setId(rs.getInt(1));rn po.setNumber(rs.getInt(2));rn po.setName(rs.getString(3));rn po.setSex(rs.getString(4));rn po.setAge(rs.getInt(5));rn rn rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn finally rn try rn stmt.close();rn con.close();rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn return po;rn rn public boolean updateById(Student po) rn boolean b =false;rn try rn con = DataBase.getConnection();rn stmt = con.createStatement();rn String sql = "update student set name='"+po.getName()+"',age="+po.getAge()+",gender='"+po.getSex()+"',studyNumber='"+po.getNumber()rn +"' where Id="+po.getId();rn int i = stmt.executeUpdate(sql);rn if(i>0) b = true;rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn finally rn try rn stmt.close();rn con.close();rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn return b;rn rnrnrnrnrnrnrn[b]rnStudent.java[/b]rnrnrnpackage com.lele.jdbc.model;rnrnpublic class Student rn rn /**rn * 学生编号rn */rn private int id;rn /**rn * 学好rn */rn private int number;rn /**rn * 姓名rn */rn private String name;rn /**rn * 性别rn */rn private String sex;rn /**rn * 年龄rn */rn private int age;rn rn rn rn rn public int getId() rn return id;rn rn public void setId(int id) rn this.id = id;rn rn public int getNumber() rn return number;rn rn public void setNumber(int Number) rn this.number = Number;rn rn public String getName() rn return name;rn rn public void setName(String name) rn this.name = name;rn rn public String getSex() rn return sex;rn rn public void setSex(String sex) rn this.sex = sex;rn rn public int getAge() rn return age;rn rn public void setAge(int age) rn this.age = age;rn rn @Overridern public String toString() rn return "学生 [编号=" + id + ", 学号=" + number + ", 名字="rn + name + ", 性别=" + sex + ", 年龄=" + age + "]";rn rn rn rnrnrnrnrnrn一下是异常提示rnrnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at com.lele.jdbc.dao.StudentD.getAllStudent(StudentD.java:40)rn at com.lele.jdbc.menu.Menu.look(Menu.java:24)rn at com.lele.jdbc.<em>main</em>.StudentMain.<em>main</em>(StudentMain.java:18)
main" java.lang.NullPointerException错误怎么解决">Exception in thread "main" java.lang.NullPointerException错误怎么解决
下面这段程序,编译没问题,但运行时候会报错rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at operation.GetFileInfo.getFileNum(GetFileInfo.java:20)rn at operation.ExtractOperation.extraction(ExtractOperation.java:11)rn at operation.ExtractOperation.<em>main</em>(ExtractOperation.java:30)rn报错定位在下面红色的语句上,我知道这是说有空指针存在,可是我找不到。rn麻烦大家帮我找找错误!!rnrn此外,我的程序是从html源代码中匹配文字,然后输入到文件parameter.txt中,有一次运行成功了,建立了txt文件,却没内容,麻烦大家帮个忙!谢谢!rnrn[code=Java]rnpublic class ExtractOperation rn static String filePath = "./source/";rn public void extraction(String filePath) throws IOExceptionrn GetFileInfo gfn = new GetFileInfo();rn filePath=filePath+gfn.getFileName(filePath)+"/";rn [color=#FF0000]long num = gfn.getFileNum(filePath); [/color] for(int i=1;i;//匹配参数名称 rn Pattern p1=Pattern.compile(s1);rn Matcher m1=p1.matcher(str);rn while(m1.find())rn rn String s=m1.group(); rn bw.write(s);rn rn bw.close(); rn rnrn[/code]rn
main" java.lang.NullPointerException怎么解决">Exception in thread "main" java.lang.NullPointerException怎么解决
以下是我写的一个简单的程序,编译时没问题,运行时却抛出异常rnimport java.util.Scanner;rnpublic class Coursernrnrn /**rn * @param argsrn */rn public String course;rn public String[] student = new String[100];rn public int count;rn public void getcourse()rn rn Scanner keyboard = new Scanner(System.in);rn System.out.println("输入课程名称");rn course=keyboard.nextLine();rn rn public void getstudent()rn rn Scanner keyboard = new Scanner(System.in);rn System.out.println("输入选修课程"+course+"的学生姓名,输入1结束");rn boolean flat=true; rn while(flat)rn rn int i=0;rn count=0;rn student[i]=new String();rn student[i++]=keyboard.nextLine();rn count++;rn if(student[i].equals("1"))rn flat=false;rn rn rn public void print()rn rn for(int i=0;i
main" java.lang.NullPointerException">出现Exception in thread "main" java.lang.NullPointerException
import java.io.Console;rnpublic class ConsoleDemo rnpublic static void <em>main</em> (String[] args) rnSystem.out.print("请输入名称: ");rnConsole console = System.console();rnString name = console.readLine();rnSystem.out.println("你输入的名称..." + name);rnrnrn/** Creates a new instance of ConsoleDemo */rnpublic ConsoleDemo() rnrnrnrnrn直接在命令行编译运行通过,jdk6环境rn在netbeans5.5中编译通过,运行出现错误,请大家帮忙看看rn错误提示如下 :rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrnat ConsoleDemo.<em>main</em>(ConsoleDemo.java:19)rn请输入名称:
main" java.lang.NullPointerException at brut.androlib.res.data.value.R">apk反编译 Exception in thread "main" java.lang.NullPointerException at brut.androlib.res.data.value.R
<em>解决</em>方法: 将ApkTool更新新版 地址:https://ibotpeaches.github.io/Apktool/
main" java.lang.ExceptionInInitializerError">Exception in thread "main" java.lang.ExceptionInInitializerError
问题描述:我在利用cxf生成wsdl并编写客户端访问 运行<em>main</em>方法时出现这个问题 报错信息: Exception in <em>thread</em> "<em>main</em>" java.lang.ExceptionInInitializerError at org.apache.axis.handlers.BasicHandler.&lt;clinit&gt;(BasicHandler.java:43) at org...
main" java.lang.RuntimeException: java.lang.NullPointerExc">Java 连接 HBASE 空指针异常 Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerExc
环境:Win10;JDK 1.7    jre 1.7HBASE : 1.1.2低版本eclipse参考信息 :https://community.hortonworks.com/questions/90267/unable-to-use-hbase-from-java-api.html报错信息:(建议:有些技术,百度上并不全面,可以在谷歌上搜索)Exception in <em>thread</em> &quot;<em>main</em>...
java.lang.NullPointerException 空指针异常之一:对象真的为空吗?
    在开发中,需要传入页面表单作为查询条件,在DAO层进行数据库的select操作,如果form为空,那么查询所有的数据出来,如果form不为空,那么查询满足form条件的数据。我们把这个开发需求形象化一点:一个学生登录教务处查看自己的成绩,刚登录成绩查询页面的时候,什么参数都没有(form没有值),看到的是他所有的成绩;当他在课程名称,课程所在学期(年),授课老师名字等输入框输入正常的数据后...
main" java.lang.NullPointerException">20170204Exception in thread "main" java.lang.NullPointerException
Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException  at com.txw.Ftest.getControlPanel(Ftest.java:28)  at com.txw.Ftest.getJContentPane(Ftest.java:93)  at com.txw.Ftest.initialize(Ftest.java:8
main" java.lang.NullPointerException">运行时Exception in thread "main" java.lang.NullPointerException
这是我的源代码~不知道哪里错了~请教~谢谢rnimport java.io.*;rnpublic class Gradernrn public static void <em>main</em>(String args[])rn rn int num,average,num1,num2;rn char ch;rn FileInputStream fin;rn DataInputStream din=null;rn tryrn while ((ch=din.readChar())!='\n')rn rn fin=new FileInputStream("d:\\test\\1.txt");rn din=new DataInputStream(fin);rn ch=din.readChar();rn num1=din.readInt();rn num2=din.readInt();rn num=num1+num2;rn average=((num1+num2)/2);rn System.out.println(ch+num+average);rn rn System.out.println("输出完毕");rn rn catch (Exception e)rn rn System.out.println("Error!");rn rn rn rnrnrn运行出现Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException
main" java.lang.NullPointerException">求解:Exception in thread "main" java.lang.NullPointerException
直接上代码哈。视频里的例子,我编译通过了,但是运行就报这个错误,我找不到错误在哪儿啊。rnpackage zicheng;rnrnpublic class Josephu rnrn public static void <em>main</em>(String[] args)rn rn rn CycLink cyclink = new CycLink();rn cyclink.setLen(8);rn cyclink.creatLink();rn cyclink.setk(2);rn cyclink.setm(2);rn rn //cyclink.show();rn cyclink.play();rnrn rnrnrnclass Childrn int no;rn Child nextChild = null;rn public Child(int no)rn rn //给一个编号rn this.no=no;rn rn rnrn class CycLinkrnrn //先定义一个指向链表第一个小孩的引用rn Child firstchild = null;rn Child temp =null;rn int len = 0; //共有几个小孩rn int k=0;rn int m=0;rn rn //设置链表的大小rn public void setLen(int len)rn rn this.len = len;rn rn public void setk(int k)rn rn this.k=k;rn rn public void setm(int m)rn rn this.m=m;rn rn rn public void play()rn rn //1.知道开始数数的人rn for(int i=1;i
main" java.lang.NullPointerException">请教:Exception in thread "main" java.lang.NullPointerException
运行内容如下的UseDriver.java文件,rnrnrnimport java.sql.*;rnpublic class UseDriver rn public static void <em>main</em>(String[] args) rn String url = "jdbc:mysql://localhost/sql_test";rn String userName = "root";rn String password = " ";rn String sql = null;rn Connection conn = null;rn Statement stmt = null;rn try rn //第一步:加载驱动器rn Class.forName("com.mysql.jdbc.Driver");rn catch(ClassNotFoundException e) rn System.err.print("ClassNotFoundException");rn rn rn try rn //第二步:调用DriverManager.getConnection静态方法得到数据库连接rn conn = DriverManager.getConnection(url, userName, password);rn //创建Statement语句rn stmt = conn.createStatement();rn sql = "INSERT INTO student " +rn "VALUES('12', 'zhangjun', 'tianjin', '1981-01-01')";rn //使用Statement语句对象执行SQL语句rn stmt.executeUpdate("DELETE FROM student WHERE stu_id='12'");rn stmt.executeUpdate(sql);rn System.out.println("Insert a row successful!");rn catch(SQLException e) rn System.err.println("Insert SQLException");rn finally rn //关闭语句和数据库连接rn try rn stmt.close();rn conn.close();rn catch(SQLException e) rn System.err.println("Close SQLException");rn rn rn rn rnrnrnrnrn在DOS窗体下运行,不知<em>怎么</em>出现如下的错误,请问一下这可能是什么错误啊,谢谢!rnrnrnG:\>javac UseDriver.javarnrnG:\>java UseDriverrnInsert SQLExceptionrnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at UseDriver.<em>main</em>(UseDriver.java:35)rn
main" java.lang.NullPointerException">报错:Exception in thread "main" java.lang.NullPointerException
报错:Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrnrnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at org.shp.dao.InputData.getInt([color=#FF0000]InputData.java:20)[/color]rn at org.shp.dao.Menu.showMain(Menu.java:23)rn at org.shp.dao.Menu.(Menu.java:12)rn at org.shp.dao.Main.<em>main</em>(Main.java:5)rn我的InputData 中的第20 行是:rnrnif(!(str.matches("\\[d]"))) // 是对输入字符的校验,rnrn不知道是什么地方错了呀,各位大哥帮忙看看。。rnrn还有就是:Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException 是什么地方错了呀。。。
main" java.lang.NullPointerException">求助:Exception in thread "main" java.lang.NullPointerException
import java.io.*; public class DirFile{ static String fileResult; public static void printDirect(Fil
main" java.lang.NullPointerException 1 解决方法">ionic项目 Exception in thread "main" java.lang.NullPointerException 1 解决方法
Debug ionic项目的时候,报了这么一个错误: TypeError:undefinedisnotafunction 进入输出列表里查看,提示: MSBUILD : cordova-build error :Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException 1 at org.gradle.wrapper.Gra...
main" java.lang.NullPointerException">Hadoop下载文件到本地报错Exception in thread "main" java.lang.NullPointerException
log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.o...
main" java.lang.NoClassDefFoundError">解决问题:Exception in thread "main" java.lang.NoClassDefFoundError
<em>解决</em>问题: Exception in <em>thread</em> “<em>main</em>” java.lang.NoClassDefFoundError
java.lang.NullPointerException
之前一篇文章聊过异常排名《Java异常排行榜:哪个异常最常见?》,里面谈到国外一个网站对 Java 异常进行数据分析并排名,结果是 NullPointerException 排第一,本文正好对空指针异常做一个总结,希望对各位同学有所帮助。 在本文中,我展示了一个关于如何处理空指针异常的综合示例。在Java中,null 作为一个特殊值被对象引用,用来表示该对象当前指向的是一块未知内存数据。然而Nu...
main" java.lang.NullPointerException">错误信息 Exception in thread "main" java.lang.NullPointerException
今天复习了以下hibernate 尽然出现Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException at com.java.move.test.save(test.java:28)rn at com.java.move.test.<em>main</em>(test.java:10)rn错误rn废话不多说请观代码rn-------------------------------------------------------------------------------------------------------------------------------------------------------rn[code=java]package com.java.move;rnrnimport org.hibernate.Session;rnimport org.hibernate.Transaction;rnrnimport com.pb.hibernate.util.HibernateSessionFactory;rnrnpublic class test rn public static void <em>main</em>(String args[])rn save();rn rn public static void save()rn Grade g = new Grade();rn g.setGid(110701);rn g.setGname("计应一班");rn g.setGdesc("计算机应用一班");rn rn Student stu1 = new Student();rn stu1.setSid(11070101);rn stu1.setSname("大姑爷");rn stu1.setSex("男");rn rn Student stu2 = new Student();rn stu2.setSid(11070102);rn stu2.setSname("老婆婆");rn stu2.setSex("女");rn rn Session session = HibernateSessionFactory.getSessionFactory().openSession();rn Transaction tr = session.beginTransaction();rn session.save(g);rn session.save(stu1);rn session.save(stu2);rn tr.commit();rn session.close();rn rnrn[/code]rn如何?
main" java.lang.NullPointerException">提示错误Exception in thread "main" java.lang.NullPointerException
<em>main</em>文件rnpublic class MMain rn public static void <em>main</em>(String[] args)rn rn //tryrn Mankey[] mk=new Mankey[100];rn Mankey.Inroad(mk);rn System.out.println(Mankey.clean(mk)); rn //catch(Exception Ex);rn rn rnrnMankey文件rnpublic class Mankey rn public int num,prior,next;rn public Mankey()rn rn rn rn static void Inroad(Mankey[] m)rn rn int last=m.length;rn for (int i=0;i
main" java.lang.NullPointerException">如何解决Exception in thread "main" java.lang.NullPointerException
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import j
main" java.lang.NullPointerException错误求解">关于Exception in thread "main" java.lang.NullPointerException错误求解
package fddffd; class Customer { private int personcode,type,money; Customer(){} Customer(int t1,int
main" java.lang.UnsupportedClassVersionError...">基于Web的Kafka管理器工具之Kafka-manager启动时出现Exception in thread "main" java.lang.UnsupportedClassVersionError...
问题详情   我在Kafka-manager启动时出现 [hadoop@master kafka-manager-1.3.2.1]$ nohup bin/kafka-manager -Dconfig.file=/home/hadoop/app/kafka-manager-1.3.2.1/conf/application.conf -Dhtt...
main" java.lang.UnsupportedClassVersionError: org/apach">Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apach
1.启动tomcat报错的原因,可能是tomcat版本和JDK版本的兼容问题。 2.下载其他版本的tomcat试试。 我出错的时候是jdk1.7和tomcat9不兼容,将tomcat换成7版本的就可以啦! ...
main" java.lang.NullPointerException at company.insertAe">请教:Exception in thread "main" java.lang.NullPointerException at company.insertAe
[code=Java]rnrnpublic class company rn rn static employee intArray[] = null;rn static int i = 0;rn rn static void insertAemployee(employee A) rn intArray[i] = A;rn i ++;rn rn rn void deleteAemployee(String name)rn for(int m = 0;m < i; m ++)rn while(intArray[m].name == name)rn intArray[m] = null;rn rn rn rn rn void showPay(String name)rn double salary = 0;rn for(int m = 0;m < i; m ++)rn while(intArray[m].name == name)rn salary = intArray[m].countPay(intArray[m]);rn rn rn rn System.out.println("员工" + name + "的工资为:" + salary);rn rn rn rn static void showAllpay(company A)rn double allSalary = 0;rn for(int m = 0;m < i; m ++)rn allSalary = allSalary + intArray[m].countPay(intArray[m]);rn rn System.out.println("所有员工的工资和为:" + allSalary);rn rn rn rnpublic static void <em>main</em>(String[] args) rn rn company company1 = new company(); rn employee hourEmployee1 = new hourEmployee(200,10);rn employee hourEmployee2 = new hourEmployee(230,10); rn employee sellEmployee1 = new sellEmployee(5000);rn employee sellEmployee2 = new sellEmployee(200000);rn employee commonEmployee1 = new commonEmployee(205);rnrn rn insertAemployee(hourEmployee1);rn insertAemployee(hourEmployee2);rn insertAemployee(sellEmployee1);rn insertAemployee(sellEmployee2);rn insertAemployee(commonEmployee1);rn showAllpay(company1);rn rn rn employee headgearEmployee1 = new headgearEmployee(30);rn insertAemployee(headgearEmployee1);rn showAllpay(company1);rn rn rnrnrnrnrnrn[/code]
main" java.lang.NullPointerException">What's wrong ---Exception in thread "main" java.lang.NullPointerException
Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at java.awt.Container.addImpl(Container.java:341)rn at java.awt.Container.add(Container.java:267)rn at Frame1.(Frame1.java:59)rn at Frame1.<em>main</em>(Frame1.java:69)rn请问这是什么错?
main" java.lang.NullPointerException">新人问题。Exception in thread "main" java.lang.NullPointerException
最近开始学习java, 做作业遇到理解不了的问题,请教一下。rn-----------------------------------------rnpublic class Assign3 rnrn public static void <em>main</em>(String[] args) rn // TODO Auto-generated method stubrn CodeBreaker a3 = new CodeBreaker();rn a3.display();rnrn // end of methodrn // end if classrnrn-----------------------------------rnpublic class CodeBreaker rn private CodeLetter letter1;rn private CodeLetter letter2;rn private CodeLetter letter3;rn rn public CodeBreaker()rn CodeLetter letter1 = new CodeLetter();rn CodeLetter letter2 = new CodeLetter();rn CodeLetter letter3 = new CodeLetter();rn letter1.display();rn letter2.display();rn letter3.display();rn System.out.println(); rn rnrn public void display()rn System.out.print("The code was "); rn letter1.display();rn letter2.display();rn letter3.display();rn rn rn// end of classrnrn-----------------------rnimport java.util.Random;rnrnpublic class CodeLetter rn private char letterValue;rn Random rnd = new Random();rn rn public CodeLetter()rn letterValue = (char) (rnd.nextInt(5)+'A');rn rn rn public void display()rn System.out.print(letterValue);rn rnrnrn---------------------------rn运行结果:rnDCBrnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at CodeBreaker.checkGuess(CodeBreaker.java:18)rn at Assign3.<em>main</em>(Assign3.java:6)rnrn我的问题是,为什么在public class CodeBreaker里,同样是调用public class CodeLetter的public void display(),在public CodeBreaker()可以打印字母(DCB),但是在public void display()却出错,不能打印了呢?
main" java.lang.NullPointerException">初学者遇到问题~Exception in thread "main" java.lang.NullPointerException
各位大虾,帮帮忙,小女子初学java,就遇到想不明白的问题了:(rnimport java.awt.*;rnimport java.awt.event.ActionEvent;rnimport java.awt.event.ActionListener;rnrnimport javax.swing.JButton;rnimport javax.swing.JFrame;rnimport javax.swing.JLabel;rnrnpublic class QRFrame extends JFramernrnrn QRFrame frame; rn public QRFrame()rn rn super("hello");rn Container cp=frame.getContentPane();rn JLabel labName=new JLabel("name"); rn cp.setLayout(new BorderLayout());rn cp.add(labName,BorderLayout.NORTH);rn rn rn rn public static void <em>main</em>(String[] args) rn rn JFrame frame=new QRFrame();rn frame.setSize(600,800);rn frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn frame.setVisible(true); rn rnrnrn错误如下:Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at com.songlyric.QRFrame.(QRFrame.java:21)rn at com.songlyric.QRFrame.<em>main</em>(QRFrame.java:34)rn不明白,呜呜~
main" java.lang.NullPointerException at A.main(A.java:8)">Exception in thread "main" java.lang.NullPointerException at A.main(A.java:8)
public class A rn rn B b1; rn B b2=new B(); rn public static void <em>main</em>(String args[]) rn rn A a1=new A(); rn System.out.println(a1.b1.x); //这一行出错了rn System.out.println(a1.b2.x);rn rn rnrnclass B rn rn int x=10; rn rnrn请问对象作为成员必须要new一个空间吗?为什么会出现这样的错误。
Exception in thread "Thread-0" java.lang.NullPointerException
Exception in <em>thread</em> "Thread-0" java.lang.NullPointerException  分享| 2014-01-15 09:59ljh404 | 浏览 3082 次 package server; import java.io.IOException; import java.io.ObjectInputStream; import java.
main" java.lang.NullPointerException">4,spring注解获取sessionFactory为空问题Exception in thread "main" java.lang.NullPointerException
4,spring注解获取sessionFactory为空问题Exception in <em>thread</em> &quot;<em>main</em>&quot; java.lang.NullPointerException  1,@Resource(name=&quot;sessionFactory&quot;) private SessionFactory sessionFactory; public  Session getSession(){ return...
main"java.lang.NoClassDefFoundError的错?">为什么执行JAVA程序时,会出现Exception in thread"main"java.lang.NoClassDefFoundError的错?
http://hi.baidu.com/%C7%B9%BB%A899/blog/item/9f485b66b37c5b24aa184c7b.html应该这样检查你的环境和你的操作: 1、你的文件名对吗?JAVA要求你的文件和你的类名严格对应的。比如 public class HelloWorld{ .....那么文件名一定只能是HelloWorld.java,看仔细了!2、你的程序中有<em>main</em>方法吗?参数什么的对吗?<em>main</em>方法的声明应该是这样子的:public static void <em>main</em>(Stri
main" java.lang.NullPointerException">Reduce join时报错Exception in thread "main" java.lang.NullPointerException
本文仅是此错误的一种特例情况,与一般空指针错误不同,所以写出来为大家作为参考 我做reduce join实验时,第一次运行程序没有出错,但是重复运行时却出现以下错误 问题就是下图中我们在第一次运行程序时产生的out5文件夹,reduce join默认处理的是文件,你在其指向的文件夹下放入文件夹,他就无法处理了   <em>解决</em>问题的方法就是删除这个文件夹   问题<em>解决</em>...
main" java.lang.NullPointerException怎么解决">我的程序中Exception in thread "main" java.lang.NullPointerException怎么解决
以下是我写的一个简单的程序,编译时没问题,运行时却抛出异常 Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException at home1.<in
main" java.lang.NullPointerException……………………在线等。。。。。。。">Exception in thread "main" java.lang.NullPointerException……………………在线等。。。。。。。
写了一个关于链表的简单程序,出现RT的异常,高手指点一下。先谢了。代码如下:rn[code=Java]class Personrn public String name;rn public void setname(String b)rn name=b;rn rn String getname()rn return name;rn rnrnclass Node rn public Person person;rn public Node head;rn public Node next;rn public boolean isEmpty()rn return head==null;rn //判断链表是否为空rn public void printAll()rn Node tmp=head;rn if(isEmpty())rn System.out.println("这是一个空链表");rn while(tmp!=null)rn System.out.print(tmp.person.getname()+" ");rn tmp=tmp.next;rn rn //遍历链表打印结果rn rnrnrnpublic class LianBiao rn public static void <em>main</em>(String [] args)rn Node nod=new Node();rn nod.person.setname("qq");rn nod.next=new Node();rn nod.head=nod;rn Node tem=new Node();rn tem=nod.next;rn tem.person.setname("qw");rn nod.printAll();rn rn[/code]
main" java.lang.NullPointerException问题求教!">Exception in thread "main" java.lang.NullPointerException问题求教!
下面是源代码出现的异常是rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at com.qq.server.db.Text10.(Text10.java:58)rn at com.qq.server.db.Text10.<em>main</em>(Text10.java:39)rn58行是 jp2.add(jb2);,39行是Text10 text= new Text10();求教这问题<em>怎么</em><em>解决</em>??rnrnrnrnpackage com.qq.server.db;rnimport javax.swing.*;rnimport javax.xml.soap.Text;rnrnimport java.awt.*;rnimport java.awt.event.*;rnimport java.util.*;rnimport java.sql.*;rn//完成一个迷你版的用户信息管理系统rnpublic class Text10 extends JFrame implements ActionListenerrn rn JPanel jp1,jp2;rn rn JLabel jl1;rn JButton jb1,jb2,jb3,jb4;rn JTable jt;rn JScrollPane jsp;rn JTextField jtf;rn rn rn Vector rowData, columnNames;rn //rowData用户来存放行数据rn //后者用来存放列明rn rn rn //数据库操作需要定义的变量rn PreparedStatement ps= null;rn Connection ct = null;rn ResultSet rs= null;rn rn String url="jdbc:sqlserver://127.0.0.1:1433;databaseName=QQ";rn String user="sa";rn String passwd="322008";rn /**rn * @param argsrn */rn public static void <em>main</em>(String[] args) rn // TODO Auto-generated method stubrn Text10 text= new Text10();rn rnrn public Text10()rn rn jp1=new JPanel();rn jtf=new JTextField(10);rn jb1 = new JButton("查询");rn jb1.addActionListener(this);rn jl1 = new JLabel("请输入名字:");rn rn jp1.add(jl1);rn jp1.add(jtf);rn jp1.add(jb1);rn rn jb2= new JButton("添加");rn jb3= new JButton("修改");rn jb4= new JButton("注销");rn rn rn jp2.add(jb2);rn jp2.add(jb3);rn jp2.add(jb4);rn rn //中间rn //设置列名rn columnNames= new Vector();rn columnNames.add("号码");rn columnNames.add("昵称");rn columnNames.add("性别");rn columnNames.add("密码");rn columnNames.add("状态");rn rn rowData= new Vector();rn //从数据库读取数据rn rn tryrn //1.加载驱动rn Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");rn ct=DriverManager.getConnection(url,user,passwd);rn rn ps=ct.prepareStatement("select * from personalinfo ");rn rs=ps.executeQuery();rn rn while(rs.next())rn Vector hang = new Vector();rn hang.add(rs.getString(1));rn hang.add(rs.getString(2));rn hang.add(rs.getString(3));rn hang.add(rs.getString(4));rn hang.add(rs.getString(5));rn rn rowData.add(hang);rn rn rn rn catch(Exception e)rn e.printStackTrace();rn finallyrn try rn if(rs!=null)rn rs.close();rn if(ps!=null)rn ps.close();rn if(ct!=null)rn ct.close();rn rn catch (Exception e) rn // TODO: handle <em>exception</em>rn e.printStackTrace();rn rn rn rn jt = new JTable( rowData,columnNames);rn rn jsp= new JScrollPane(jt);rn rn this.add(jsp);rn this.add(jp1,"North");rn this.add(jp2,"South");rn rn this.setVisible(true);rn this.setSize(500, 400);rn this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn rn rn rn
main" java.lang.NullPointerException问题求助">Exception in thread "main" java.lang.NullPointerException问题求助
问题描述如下:rninit:rndeps-jar:rncompile:rnrun:rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at sun.awt.image.codec.JPEGImageEncoderImpl.getDefaultJPEGEncodeParam(JPEGImageEncoderImpl.java:174)rn at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:205)rn at waterset.P4.createJpg(P4.java:26)rn at waterset.Main.<em>main</em>(Main.java:77)rnJava Result: 1rn成功生成(总时间:1 秒)rn源程序如下:rnpackage waterset;rnimport java.awt.*;rnimport java.awt.image.*;rnimport java.awt.AlphaComposite.*;rnimport java.io.*;rnimport javax.imageio.ImageIO;rnimport javax.swing.*;rnimport com.sun.image.codec.jpeg.*;rn/**rn *rn * @author Ownerrn */rnpublic class P4 rn BufferedImage image;rnrn public void createJpg(String path) rn try rn FileOutputStream fos = new FileOutputStream(path);rn BufferedOutputStream bos = new BufferedOutputStream(fos);rn JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);rn [color=#FF0000]encoder.encode(image);[/color] rn bos.close(); rn catch(FileNotFoundException fnfe) rn System.out.println(fnfe);rn catch(IOException ioe) rn System.out.println(ioe);rn rn rn public void overlapPictures(BufferedImage p1, BufferedImage p2,int startOverlap)rn int amountOverlap = p1.getWidth() - startOverlap;rn Graphics g =p1.getGraphics();rn Graphics2D g2 = (Graphics2D) g;rn rn g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,(float) 1.0f));rn g2.drawImage(p2,0,0,startOverlap,p1.getHeight(),null);rn g2.drawImage(p1,startOverlap,0,p1.getWidth(),p1.getHeight(),null);rn rn g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,0.5f));rn rn g2.drawImage(p2,startOverlap,0,p1.getWidth(),p2.getHeight(),0,0,amountOverlap,p2.getHeight(),null);rn rn g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,(float) 1.0f));rn g2.drawImage(p2,p1.getWidth(),0,p2.getWidth()+startOverlap,p2.getHeight(),amountOverlap,0,p2.getWidth(),p2.getHeight(),null);rn rn rnrnrnrnrnrnrn主类:rnpublic class Main rnpublic static void <em>main</em>(String[] args) rn File file1=new File("d:\\1A.jpg");rn File file2=new File("d:\\1B.jpg");rn P4 p1=new P4();rn P4 p2=new P4();rn P4 p3=new P4();rn try rn p1.image = ImageIO.read(file1);rn p2.image = ImageIO.read(file2);rn catch(IOException ioe) rn System.out.println(ioe);rn rn p3.overlapPictures(p1.image,p2.image,0);rn [color=#FF0000]p3.createJpg("d:\\waterset.jpg");[/color] rn rnrnrnrnrn请大家帮我看看<em>怎么</em>回事啊~~~~
main" java.lang.NullPointerException">求助问题:Exception in thread "main" java.lang.NullPointerException
出错祥细:rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at awt.GridLayoutTest.init(GridLayoutTest.java:36)rn at awt.GridLayoutTest.(GridLayoutTest.java:24)rn at awt.GridLayoutTest.<em>main</em>(GridLayoutTest.java:57)rn程序如下:rnpackage awt;rnrnimport java.awt.Button;rnimport java.awt.Color;rnimport java.awt.Frame;rnimport java.awt.GridLayout;rnimport java.awt.Panel;rnimport java.awt.TextField;rnrnpublic class GridLayoutTest rn Frame frame = null;rn Panel pn,pm,pc,ps;rn String[] s = "7","8","9","/",rn "sprt","4","5","6",rn "*","%","1","2",rn "3","-","1/x","0",rn "+/-",".","+","=";rn String[] m = "MC","MR","MS","M+";rnButton[] bs = new Button[s.length];rnButton[] bm = new Button[m.length];rnTextField tf = new TextField("0.",150);rnrn public GridLayoutTest() rn init();rn rnrn private void init() rn frame = new Frame("计算器 v1.0");rn frame.setLayout(new GridLayout(4,5,3,3));rn for(int i=0;i
main" java.lang.NullPointerException">请教一个问题:Exception in thread "main" java.lang.NullPointerException
错误提示:rnException in <em>thread</em> "<em>main</em>" java.lang.NullPointerExceptionrn at awt.GridLayoutTest.init(GridLayoutTest.java:40)rn at awt.GridLayoutTest.(GridLayoutTest.java:28)rn at awt.GridLayoutTest.<em>main</em>(GridLayoutTest.java:70)rn程序如下:rnpackage awt;rnrnimport java.awt.Button;rnimport java.awt.Color;rnimport java.awt.Frame;rnimport java.awt.GridLayout;rnimport java.awt.Panel;rnimport java.awt.TextField;rnrnpublic class GridLayoutTest rn Frame frame = null;rn Panel pm = null;rn Panel pc = null;rn Panel ps = null;rn String[] s = "7","8","9","/",rn "sprt","4","5","6",rn "*","%","1","2",rn "3","-","1/x","0",rn "+/-",".","+","=";rn String[] m = "MC","MR","MS","M+";rn String[] c = "Backspace","CE","C";rnButton[] bs = new Button[s.length];rnButton[] bm = new Button[m.length];rnButton[] bc = new Button[c.length];rnTextField tf = new TextField("0.",150);rnrn public GridLayoutTest() rn init();rn rnrn private void init() rn frame = new Frame("计算器 v1.0");rn frame.setLayout(new GridLayout(4,5,3,3));rn for(int i=0;i
main" java.lang.NullPointerException">hdfs下载出现Exception in thread "main" java.lang.NullPointerException
hdfs使用copyToLocalFile下载文件时出现Exception in <em>thread</em> "<em>main</em>" java.lang.NullPointerException。
main" java.lang.NullPointerException求指教,急急急">出现Exception in thread "main" java.lang.NullPointerException求指教,急急急
public class txtTOarray { public static void <em>main</em>(String args){ try { File file = new File("D:\\arra
解决Exception in threadmain" java.lang.UnsupportedClassVersionError
Exception in <em>thread</em> “<em>main</em>" java.lang.UnsupportedClassVersionError 这个是典型的用高版本的JDK编译产生的class文件,用低版本的JDK运行这个class文件时产生的异常。 当这个问题在doc命令行产生时,应该用两个命令看一下: 用javac -version得到编译器的版本,用Java -version获得jdk的版本,
main" java.lang.NullPointerException问题!急………………">高手进!关于Exception in thread "main" java.lang.NullPointerException问题!急………………
package Lession1; import java.io.File; import java.util.List; import org.dom4j.Attribute; import or
一般报java.lang.NullPointerException的原因有以下几种
一般报java.lang.NullPointerException的原因有以下几种: ·字符串变量未初始化; ·接口类型的对象没有用具体的类初始化,比如: List lt; 会报错 List lt = new ArrayList(); 则不会报错了 ·当一个对象的值为空时,你没有判断为空的情况。 你可以试着把下面的代码前加一行代码: if(rb!=null);   ..................
main" java.lang.NoClassDefFoundError :~~ 。怎么解决?">Exception in thread "main" java.lang.NoClassDefFoundError :~~ 。怎么解决
javac通过但java的时候出现了错误,大家帮我看看,为什么会出现这样的错误?根本原因是什么?多谢指教!!rnException in <em>thread</em> "<em>main</em>" java.lang.NoClassDefFoundError:XXXX/class
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
在做一个C/S聊天窗口界面,用netbeans的swing拖的窗口,加了个buttonActionPerformer后,点击按钮发生异常:rnException in <em>thread</em> "AWT-EventQueue-0" java.lang.NullPointerExceptionrn at myserver.myserver.jButton8MouseClicked(myserver.java:163)rn at myserver.myserver.access$000(myserver.java:12)rn at myserver.myserver$1.mouseClicked(myserver.java:87)rn at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)rn at java.awt.Component.processMouseEvent(Component.java:6270)rn at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)rn at java.awt.Component.processEvent(Component.java:6032)rn at java.awt.Container.processEvent(Container.java:2041)rn at java.awt.Component.dispatchEventImpl(Component.java:4630)rn at java.awt.Container.dispatchEventImpl(Container.java:2099)rn at java.awt.Component.dispatchEvent(Component.java:4460)rn at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)rn at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4247)rn at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)rn at java.awt.Container.dispatchEventImpl(Container.java:2085)rn at java.awt.Window.dispatchEventImpl(Window.java:2478)rn at java.awt.Component.dispatchEvent(Component.java:4460)rn at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)rn at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)rn at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)rn at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)rn at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)rn at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)rn at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)rnrn private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) rnrn String info = textField1.getText();//从textfield读你所打的数据rn if(info != null)rn pw.println(info); //info写入pw,用来把pw的内容传给socketrn textField1.setText("");rn elsern info = "";rnrn rn rn
英语口语考试常见问题下载
口语考试常见问题口语考试常见问题口语考试常见问题口语考试常见问题口语考试常见问题口语考试常见问题口语考试常见问题口语考试常见问题 相关下载链接:[url=//download.csdn.net/download/aaxxdd/1994452?utm_source=bbsseo]//download.csdn.net/download/aaxxdd/1994452?utm_source=bbsseo[/url]
Pro Objective-C Design Patterns for iOS下载
Pro Objective-C Design Patterns for iOS 相关下载链接:[url=//download.csdn.net/download/weiyanwu19840511/3979157?utm_source=bbsseo]//download.csdn.net/download/weiyanwu19840511/3979157?utm_source=bbsseo[/url]
使用Annotation和反射实现Bean转SQL语句Demo下载
使用Annotation和反射实现Bean转SQL语句Demo 相关下载链接:[url=//download.csdn.net/download/u011638883/6462119?utm_source=bbsseo]//download.csdn.net/download/u011638883/6462119?utm_source=bbsseo[/url]
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数
我们是很有底线的