当前位置:首页 » 编程语言 » java管理系统

java管理系统

发布时间: 2022-01-10 18:04:40

Ⅰ 用java编写学生管理系统

我也是初学写的不好
public class Student {
static int[] gradesArray={87,68,94,100,83,78,85,91,76,87};
public Student(int[]gradesArray){

}
public void printAllGrade(){
for (int i = 0; i < gradesArray.length; i++) {
System.out.println("学号"+(i+1)+"成绩是"+gradesArray[i]);
}
}
public void printAvarage(){
double sum = 0;
for (int i = 0; i < gradesArray.length; i++) {
sum+=gradesArray[i];
}
System.out.println("\n平均成绩是"+sum/gradesArray.length);
}
public void printMax(){
int max=gradesArray[0];
for (int i = 0; i < gradesArray.length; i++) {
if(gradesArray[i]>max){
max=gradesArray[i];
}
}
System.out.println("\n最高分时"+max);
}
public void printMin(){
int min=gradesArray[0];
for (int i = 0; i < gradesArray.length; i++) {
if (gradesArray[i]<min){
min=gradesArray[i];
}
}
System.out.println("\n最低分时"+min);
}
public void printDistribution(){
int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0;
for (int i = 0; i < gradesArray.length; i++) {
if(gradesArray[i]<10){
a++;
}else if (gradesArray[i]>=10&&gradesArray[i]<20) {
b++;
}
else if (gradesArray[i]>=20&&gradesArray[i]<30) {
c++;
}
else if (gradesArray[i]>=30&&gradesArray[i]<40) {
d++;
}
else if (gradesArray[i]>=40&&gradesArray[i]<50) {
e++;
}
else if (gradesArray[i]>=50&&gradesArray[i]<60) {
f++;
}
else if (gradesArray[i]>=60&&gradesArray[i]<70) {
g++;
}
else if (gradesArray[i]>=70&&gradesArray[i]<80) {
h++;
}
else if (gradesArray[i]>=80&&gradesArray[i]<90) {
j++;
}
else if (gradesArray[i]>=90&&gradesArray[i]<100) {
k++;
}
}
System.out.println("\n成绩分布是");
System.out.print("0-10:");
for (int i = 0; i <=a; i++) {
System.out.print("*");
}
System.out.print("10-20:");
for (int i = 0; i <=b; i++) {
System.out.print("*");
}
System.out.print("20-30:");
for (int i = 0; i <=c; i++) {
System.out.print("*");
}
System.out.print("30-40:");
for (int i = 0; i <=d; i++) {
System.out.print("*");
}
System.out.print("40-50:");
for (int i = 0; i <=e; i++) {
System.out.print("*");
}
System.out.print("50-60:");
for (int i = 0; i <=f; i++) {
System.out.print("*");
}
System.out.print("60-70:");
for (int i = 0; i <=g; i++) {
System.out.print("*");
}
System.out.print("70-80:");
for (int i = 0; i <=h; i++) {
System.out.print("*");
}
System.out.print("80-90:");
for (int i = 0; i <=j;i++) {
System.out.print("*");
}
System.out.print("90-100:");
for (int i = 0; i <=k; i++) {
System.out.print("*");
}
}
public static void main(String[] args) {
Student student=new Student(gradesArray);
student.printAllGrade();
student.printAvarage();
student.printMax();
student.printMin();
student.printDistribution();
}

}

Ⅱ Java程序:手机管理系统

手机一般不说单纯用java系统的,但是早期的半智能机必然基于java的平台,很多山寨机都这样,可以直接运行java程序,因为里面内置了JVM(java虚拟机)。由于java跨平台的特性,所以能够运行。其实现在的安卓也是如此,安卓是JAVAME的一个分支,起根源还是java平台。其实安卓的概念早在上个世纪已经被提出,然后当时硬件条件跟不上,所以才没有流行。总结:早期的半智能机和现在的安卓手机,都可以说是基于java平台的,但都不能明确说是java的系统。

Ⅲ java信息管理系统

采用面对对象的设计思想,一个类的各种属性都要在里面。。肯定一个用户类包含所有的用户信息,不光是这个,还要包含用户的状态信息。分类类别。等等信息。。
不用网络和数据库的话肯定要用流的思想,就是为每一个用户建立一个文件,然后采用查询的方式,调用文件信息。读出信息。。
查询的话可以采用一些关键字索引。。可以采用希尔排序的类似方法来采取高效查找关键字,(折半查找也可行)

Ⅳ 如何做一个java管理系统

首先你打算用什么技术来实现这个系统,先想好用哪些东西,是纯粹的jsp,servlet+javabean还是用到struts,spring等框架,将用到的技术想到后,再进行下一步.
其次你要搭建基于你使用的开发技术的环境,如果用jsp,servlet,javabean的话只需要个tomcat类似的容器就行了,如果要用到struts或者spring等相关的框架的话,就去下载相关的文件,如果用EJB的话,去装个jboss或者weblogic等EJB容器.
再次,环境搭建好之后就进入真正的开发了,进行需求分析,uml建模,设计好层次结构,然后进行编码,编码好后进行测试,不断改进,最后交付使用了.
呵呵,如果你不懂的话现看看相关的资料再进行开发,不要茫无目的的动手编码。

Ⅳ java控制台学生信息管理系统

你好,你要的学生信息管理系统。


(1) Student类

importjava.io.Serializable;

/**
*@authorliuxe
*@sinceJDK1.7.0_79
*/
{
privateintstuId;
privateStringname;
privateStringmajor;
privateStringsex;
privateStringcontactWay;

publicintgetStuId(){
returnstuId;
}

publicvoidsetStuId(intstuId){
this.stuId=stuId;
}

publicStringgetName(){
returnname;
}

publicvoidsetName(Stringname){
this.name=name;
}

publicStringgetMajor(){
returnmajor;
}

publicvoidsetMajor(Stringmajor){
this.major=major;
}

publicStringgetSex(){
returnsex;
}

publicvoidsetSex(Stringsex){
this.sex=sex;
}

publicStringgetContactWay(){
returncontactWay;
}

publicvoidsetContactWay(StringcontactWay){
this.contactWay=contactWay;
}
}

(2) StuMis类

importjava.io.*;
importjava.util.ArrayList;
importjava.util.List;

/**
*@authorliuxe
*@sinceJDK1.7.0_79
*/
publicclassStuMis{
publicstaticList<Student>studentList=newArrayList<Student>();

publicstaticbooleanadd(Studentstudent){
returnstudentList.add(student);
}

publicstaticbooleanremove(Studentstudent){
returnstudentList.remove(student);
}

publicstaticbooleanupdate(Studentstudent){
for(Studentdto:studentList){
if(student.getStuId()==dto.getStuId()){
studentList.remove(dto);
}
}
returnstudentList.add(student);
}

(intid){
for(Studentdto:studentList){
if(id==dto.getStuId()){
returndto;
}
}
returnnull;
}

publicstaticList<Student>queryByName(Stringname){
List<Student>returnList=newArrayList<Student>();
for(Studentdto:studentList){
if(name.equals(dto.getName())){
returnList.add(dto);
}
}
returnreturnList;
}

publicstaticvoidsaveToFile(){
try{
ObjectOutputStreamoo=newObjectOutputStream(newFileOutputStream(
newFile("."+File.separator+"student.dat")));
oo.writeObject(studentList);
}catch(Exceptionex){
ex.printStackTrace();
}
}

publicstaticvoidreadFromFile(){
try{
ObjectInputStreamois=newObjectInputStream(newFileInputStream(
newFile("."+File.separator+"student.dat")));
studentList=(List<Student>)ois.readObject();
}catch(Exceptionex){
ex.printStackTrace();
}
}
}

(3)、StuMisTest类:主函数测试学生信息管理系统

importjava.util.List;

/**
*@authorliuxe
*@sinceJDK1.7.0_79
*/
publicclassStuMisTest{
publicstaticvoidmain(String[]args){
Studentstudent=newStudent();
student.setStuId(1);
student.setName("AAA");
student.setMajor("AAAA");
student.setSex("A");
student.setContactWay("AA");
Studentstudent2=newStudent();
student2.setStuId(2);
student2.setName("BBB");
student2.setMajor("BBBB");
student2.setSex("B");
student2.setContactWay("BB");
Studentstudent3=newStudent();
student3.setStuId(3);
student3.setName("CCC");
student3.setMajor("CCCC");
student3.setSex("C");
student3.setContactWay("CC");

//A、增加一个学生记录
StuMis.add(student);
StuMis.add(student2);
StuMis.add(student3);

//B、删除一个学生记录
StuMis.remove(student2);

//C、修改学生信息
student.setMajor("DDDD");
StuMis.update(student);

//D、根据学号查找学生
StudentstudentXX=StuMis.queryByStuId(3);

//E、根据姓名查找学生。。。
List<Student>studentOO=StuMis.queryByName("AAA");

//F、将集合中所有学生信息存储到student.dat中。
StuMis.saveToFile();

//G、再次运行系统时加载student.dat中的学生信息,后支持A~E基本操作。
StuMis.readFromFile();
}
}

Ⅵ 用java设计一个数据库管理系统

import java.sql.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
//import java.awt.event.*;
public class DisplayDemo extends JFrame
//implements ActionListener
{
// private String dbURL="jdbc:microsoft:sqlserver://202.115.26.181:1433"; // 数据库标识名
private String user="devon"; // 数据库用户
private String password="book"; // 数据库用户密码
private JTable table;
private JButton ok,canel;
public DisplayDemo(){
super("显示数据库查询结果"); //调用父类构造函数
String[] columnNames={"用户名","年龄","性别","Email"}; //列名
Object[][] rowData=new Object[5][4]; //表格数据
ok=new JButton("确定");
canel=new JButton("取消");
// ok.addActionListener(this);
// canel.addActionListener(this);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:example","sa","");
// Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); //加载驱动器
// Connection con=DriverManager.getConnection(dbURL,user,password); //获取连接
String sqlStr="select * from users"; //查询语句
PreparedStatement ps=con.prepareStatement(sqlStr); //获取PreparedStatement对象
ResultSet rs=ps.executeQuery(); //执行查询
String name,sex,email; //查询结果
int age;
int count=0;
while (rs.next()){ //遍历查询结果
rowData[count][0]=rs.getString("name"); //初始化数组内容
rowData[count][1]=Integer.toString(rs.getInt("age"));
rowData[count][2]=rs.getString("sex");
rowData[count][3]=rs.getString("email");
count++;
}

con.close(); //关闭连接
}
catch(Exception ex){
ex.printStackTrace(); //输出出错信息
}

Container container=getContentPane(); //获取窗口容器
//container.setLayout(null);
container.add(ok);container.add(canel); ok.setBounds(10,120,70,20);
canel.setBounds(100,120,70,20);
table=new JTable(rowData,columnNames); //实例化表格
table.getColumn("年龄").setMaxWidth(25); //设置行宽
container.add(new JScrollPane(table),BorderLayout.CENTER); //增加组件

setSize(300,200); //设置窗口尺寸
setVisible(true); //设置窗口可视
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //关闭窗口时退出程序
}

public static void main(String[] args){
new DisplayDemo();
}
}

-----------------
这是其中一个例子 你照着上面做就可以了

Ⅶ java学生管理系统

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.lang.*;

public class Students extends Applet implements ActionListener
{
Vector StuInf=new Vector();
StudentInf SI;
String xm;
String bj;
int i,j,xh,cj;
static int mid;
Label prompt1=new Label("学生成绩管理系统");
Label prompt2=new Label(" 用户:");
Label prompt3=new Label(" 密码:");
Label prompt4=new Label(" 班级:");
Label prompt5=new Label(" 成绩:");
TextField input1=new TextField(8);
TextField input2=new TextField(8);
TextField input3=new TextField(8);
TextField input4=new TextField(8);
Button btn1=new Button("登录");
Button btn2=new Button("增加");
Button btn3=new Button("修改");
Button btn4=new Button("删除");

public void init()
{
setLayout(new GridLayout(6,3));
add(new Label());
add(prompt1);
add(new Label());
add(prompt2);
add(input1);
add(new Label());
add(prompt3);
add(input2);
add(btn1);
add(prompt4);
add(input3);
add(new Label());
add(prompt5);
add(input4);
add(new Label());
add(btn2);
add(btn3);
add(btn4);
prompt4.setVisible(false);
prompt5.setVisible(false);
input3.setVisible(false);
input4.setVisible(false);
btn2.setVisible(false);
btn3.setVisible(false);
btn4.setVisible(false);
btn1.addActionListener(this);
btn2.addActionListener(this);
btn3.addActionListener(this);
btn4.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand()=="登录")
{
String a,b;
a=input1.getText();
b=input2.getText();
input1.setText("");
if((a.equals("12")==true)&&(b.equals("12")==true))
{
prompt2.setText(" 姓名:");
prompt3.setText(" 学号:");
prompt4.setVisible(true);
prompt5.setVisible(true);
input3.setVisible(true);
input4.setVisible(true);
btn2.setVisible(true);
btn3.setVisible(true);
btn4.setVisible(true);
btn3.setEnabled(false);
btn4.setEnabled(false);
btn1.setLabel("查询");
input1.setText("登录成功");
input1.selectAll();
}
else
input2.setText("用户名或密码错");
}
if(e.getActionCommand()=="增加")
{
boolean scucss=true;
try
{
XingMing();
}
catch(EmptyException as)
{
input1.setText("姓名不能为空");
scucss=false;
}
try
{
xh=Integer.parseInt(input2.getText());
}
catch(NumberFormatException m)
{
input2.setText("学号为空或格式错");
scucss=false;
}
bj=input3.getText();
try
{
ChengJi();
}
catch(EmptyException as)
{
cj=-1;
}
catch(OverException dd)
{
input4.setText("应在0-100间");
scucss=false;
}
catch(NumberFormatException cm)
{
input4.setText("成绩应为数据");
scucss=false;
}
if(scucss==true)
{
SI=new StudentInf(xm,xh,bj,cj);
Insert(SI);
}
}
if(e.getActionCommand()=="修改")
{
xm=input1.getText();
xh=Integer.parseInt(input2.getText());
bj=input3.getText();
cj=Integer.parseInt(input4.getText());
SI=new StudentInf(xm,xh,bj,cj);
StuInf.setElementAt(SI, mid);
btn3.setEnabled(false);
}
if(e.getActionCommand()=="删除")
{
StuInf.removeElementAt(mid);
btn4.setEnabled(false);
input1.setText("删除成功");
input2.setText("");
input3.setText("");
input4.setText("");
}
if(e.getActionCommand()=="查询")
{
boolean right=true;
try
{
xh=Integer.parseInt(input2.getText());
}
catch(NumberFormatException m)
{
input2.setText("学号为空或格式错");
right=false;
}
if(right==true)
{
search(xh);
btn3.setEnabled(true);
btn4.setEnabled(true);
}
}

}
//查找方法
public void search(int k)
{
boolean exist=false;
int low=0;
int high=StuInf.size()-1;
while(low<=high)
{
mid=(high+low)/2;
StudentInf a1=(StudentInf) StuInf.elementAt(mid);
if(a1.getStuNo()==k)
{
SI=(StudentInf) StuInf.elementAt(mid);
String x = String.valueOf(SI.getStuNo());
exist=true;
input1.setText(SI.getname());
input1.selectAll();
input2.setText("0"+x);
input3.setText(SI.getClassNo());
if(SI.getLevel()==-1)
input4.setText("未参加考试");
else
{
String y = String.valueOf(SI.getLevel());
input4.setText(y);
}
break;
}
else if(a1.getStuNo()<k)
low=mid+1;
else
high=mid-1;
}
if(exist==false)
{
input1.setText("无此学号学生信息");
input1.selectAll();
}
}
//添加方法
public void Insert(StudentInf q)
{
int i=0;

if(StuInf.isEmpty()==true)
{
StuInf.addElement(q);
input1.setText("");
input2.setText("");
input3.setText("");
input4.setText("");
}
else
{
StudentInf xh;
xh=(StudentInf) StuInf.firstElement();
while(xh.getStuNo()<q.getStuNo())
{
i++;
if(i<StuInf.size())
xh=(StudentInf) StuInf.elementAt(i);
else
break;
}
if(xh.getStuNo()==q.getStuNo())
{
input2.setText("此学生信息已存在");
input2.requestFocus();
input2.selectAll();
}
else
{
StuInf.insertElementAt(q,i);
input1.setText("");
input2.setText("");
input3.setText("");
input4.setText("");
}
}
}

//异常类
class OverException extends Exception
{
String over;
}
class EmptyException extends Exception
{
String empty;
}
void XingMing() throws EmptyException
{
if((input1.getText()).equals(""))
throw (new EmptyException());
else
xm=input1.getText();
}
void ChengJi() throws OverException,EmptyException
{
if((input4.getText()).equals(""))
throw(new EmptyException());
else
cj=Integer.parseInt(input4.getText());
if(cj<0||cj>100)
throw (new OverException());
}

//学生信息类
public class StudentInf
{
private String name;
private int StuNo;
private String ClassNo;
private int Level;
StudentInf(String xingming,int xuehao,String banji,int chengji)
{
name=xingming;
StuNo=xuehao;
ClassNo=banji;
Level=chengji;
}
public int getStuNo()
{
return StuNo;
}
public String getname()
{
return name;
}
public String getClassNo()
{
return ClassNo;
}
public int getLevel()
{
return Level;
}
}

}

Ⅷ 用java来实现一个进程管理系统

构造方法摘要
ProcessBuilder(List<String> command)
利用指定的操作系统程序和参数构造一个进程生成器。
ProcessBuilder(String... command)
利用指定的操作系统程序和参数构造一个进程生成器。

方法摘要
List<String> command()
返回此进程生成器的操作系统程序和参数。
ProcessBuilder command(List<String> command)
设置此进程生成器的操作系统程序和参数。
ProcessBuilder command(String... command)
设置此进程生成器的操作系统程序和参数。
File directory()
返回此进程生成器的工作目录。
ProcessBuilder directory(File directory)
设置此进程生成器的工作目录。
Map<String,String> environment()
返回此进程生成器环境的字符串映射视图。
boolean redirectErrorStream()
通知进程生成器是否合并标准错误和标准输出。
ProcessBuilder redirectErrorStream(boolean redirectErrorStream)
设置此进程生成器的 redirectErrorStream 属性。
Process start()
使用此进程生成器的属性启动一个新进程。

2.1.2 Runtime
每个 Java 应用程序都有一个 Runtime 类实例,使应用程序能够与其运行的环境相连接。可以通过 getRuntime 方法获取当前运行时。
应用程序不能创建自己的 Runtime 类实例。但可以通过 getRuntime 方法获取当前Runtime运行时对象的引用。一旦得到了一个当前的Runtime对象的引用,就可以调用Runtime对象的方法去控制Java虚拟机的状态和行为。

Java代码
void addShutdownHook(Thread hook)
注册新的虚拟机来关闭挂钩。
int availableProcessors()
向 Java 虚拟机返回可用处理器的数目。
Process exec(String command)
在单独的进程中执行指定的字符串命令。
Process exec(String[] cmdarray)
在单独的进程中执行指定命令和变量。
Process exec(String[] cmdarray, String[] envp)
在指定环境的独立进程中执行指定命令和变量。
Process exec(String[] cmdarray, String[] envp, File dir)
在指定环境和工作目录的独立进程中执行指定的命令和变量。
Process exec(String command, String[] envp)
在指定环境的单独进程中执行指定的字符串命令。
Process exec(String command, String[] envp, File dir)
在有指定环境和工作目录的独立进程中执行指定的字符串命令。
void exit(int status)
通过启动虚拟机的关闭序列,终止当前正在运行的 Java 虚拟机。
long freeMemory()
返回 Java 虚拟机中的空闲内存量。
void gc()
运行垃圾回收器。
InputStream getLocalizedInputStream(InputStream in)
已过时。 从 JDK 1.1 开始,将本地编码字节流转换为 Unicode 字符流的首选方法是使用 InputStreamReader 和 BufferedReader 类。
OutputStream getLocalizedOutputStream(OutputStream out)
已过时。 从 JDK 1.1 开始,将 Unicode 字符流转换为本地编码字节流的首选方法是使用 OutputStreamWriter、BufferedWriter 和 PrintWriter 类。
static Runtime getRuntime()
返回与当前 Java 应用程序相关的运行时对象。
void halt(int status)
强行终止目前正在运行的 Java 虚拟机。
void load(String filename)
加载作为动态库的指定文件名。
void loadLibrary(String libname)
加载具有指定库名的动态库。
long maxMemory()
返回 Java 虚拟机试图使用的最大内存量。
boolean removeShutdownHook(Thread hook)
取消注册某个先前已注册的虚拟机关闭挂钩。
void runFinalization()
运行挂起 finalization 的所有对象的终止方法。
static void runFinalizersOnExit(boolean value)
已过时。 此方法本身具有不安全性。它可能对正在使用的对象调用终结方法,而其他线程正在操作这些对象,从而导致不正确的行为或死锁。
long totalMemory()
返回 Java 虚拟机中的内存总量。
void traceInstructions(boolean on)
启用/禁用指令跟踪。
void traceMethodCalls(boolean on)
启用/禁用方法调用跟踪。

2.1.3 Process
不管通过那种方法启动进程后,都会返回一个Process类的实例代表启动的进程,该实例可用来控制进程并获得相关信息。Process 类提供了执行从进程输入、执行输出到进程、等待进程完成、检查进程的退出状态以及销毁(杀掉)进程的方法:

Java代码
void destroy()
杀掉子进程。
一般情况下,该方法并不能杀掉已经启动的进程,不用为好。
int exitValue()
返回子进程的出口值。
只有启动的进程执行完成、或者由于异常退出后,exitValue()方法才会有正常的返回值,否则抛出异常。
InputStream getErrorStream()
获取子进程的错误流。
如果错误输出被重定向,则不能从该流中读取错误输出。
InputStream getInputStream()
获取子进程的输入流。
可以从该流中读取进程的标准输出。
OutputStream getOutputStream()
获取子进程的输出流。
写入到该流中的数据作为进程的标准输入。
int waitFor()
导致当前线程等待,如有必要,一直要等到由该 Process 对象表示的进程已经终止。

通过该类提供的方法,可以实现与启动的进程之间通信,达到交互的目的。

2.2 实例

2.2.1 创建子进程
要创建子进程可以通过使用使用ProcessBuilder的start()方法和Runtime的exec()方法。
(1)Runtime.exec()

Java代码
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;

public class Test1 {
public static void main(String[] args) {
try {
Process p = null;
String line = null;
BufferedReader stdout = null;

//list the files and directorys under C:\
p = Runtime.getRuntime().exec("CMD.exe /C dir", null, new File("C:\\"));
stdout = new BufferedReader(new InputStreamReader(p
.getInputStream()));
while ((line = stdout.readLine()) != null) {
System.out.println(line);
}
stdout.close();

//echo the value of NAME
p = Runtime.getRuntime().exec("CMD.exe /C echo %NAME%", new String[] {"NAME=TEST"});
stdout = new BufferedReader(new InputStreamReader(p
.getInputStream()));
while ((line = stdout.readLine()) != null) {
System.out.println(line);
}
stdout.close();
} catch (Exception e) {
e.printStackTrace();
}
}

(2)ProcessBuilder

Java代码
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Test2 {
public static void main(String[] args) {
try {
List<String> list = new ArrayList<String>();
ProcessBuilder pb = null;
Process p = null;
String line = null;
BufferedReader stdout = null;

//list the files and directorys under C:\
list.add("CMD.EXE");
list.add("/C");
list.add("dir");
pb = new ProcessBuilder(list);
pb.directory(new File("C:\\"));
p = pb.start();

stdout = new BufferedReader(new InputStreamReader(p
.getInputStream()));
while ((line = stdout.readLine()) != null) {
System.out.println(line);
}
stdout.close();

//echo the value of NAME
pb = new ProcessBuilder();
pb.command(new String[] {"CMD.exe", "/C", "echo %NAME%"});
pb.environment().put("NAME", "TEST");
p = pb.start();

stdout = new BufferedReader(new InputStreamReader(p
.getInputStream()));
while ((line = stdout.readLine()) != null) {
System.out.println(line);
}
stdout.close();
} catch (Exception e) {
e.printStackTrace();
}
}

从启动其他程序的Java进程看,已启动的其他程序输出就是一个普通的输入流,可以通过getInputStream()和getErrorStream来获取。对于一般输出文本的进程来说,可以将InputStream封装成BufferedReader,然后就可以一行一行的对进程的标准输出进行处理。
通常,一个程序/进程在执行结束后会向操作系统返回一个整数值,0一般代表执行成功,非0表示执行出现问题。有两种方式可以用来获取进程的返回值。一是利用waitFor(),该方法是阻塞的,执导进程执行完成后再返回。该方法返回一个代表进程返回值的整数值。另一个方法是调用exitValue()方法,该方法是非阻塞的,调用立即返回。但是如果进程没有执行完成,则抛出异常。

Ⅸ 求助:一个简单的java信息管理系统

你说的这些好麻烦的,倒是不难,但是包括设计数据库,录入数据,搭好框架,然后专业点的话用mvc结构、ssh框架写好这个软件,我估计。。。都值一些钱啦。这个不是一个小时两个小时能做完的。高手也得仅一天吧。但是我认为高手是不会为了你的50分牺牲他的工作时间或者是休息时间的。
只能说你发错地方啦,你到csdn上面看下有人能做吗,或者是帮你设计一下数据库。
估计不会有人帮你全部做完的。。。还是要自己动手啊。
希望我的回答能帮助你
如果自己做的过程中遇到问题,很愿意帮助你

热点内容
聚合脚本平台 发布:2024-09-20 17:51:55 浏览:180
访问拦截怎么解除安卓 发布:2024-09-20 17:28:48 浏览:275
萝卜干存储 发布:2024-09-20 17:21:37 浏览:715
苹果手机如何迁移软件到安卓手机 发布:2024-09-20 17:21:34 浏览:692
查看服务器ip限制 发布:2024-09-20 16:56:27 浏览:389
p搜系统只缓存1页为什么 发布:2024-09-20 16:48:51 浏览:839
上网的账号和密码是什么东西 发布:2024-09-20 16:31:31 浏览:612
安卓手机王者荣耀如何调超高视距 发布:2024-09-20 16:31:30 浏览:428
安卓G是什么app 发布:2024-09-20 16:23:09 浏览:81
iphone怎么压缩文件 发布:2024-09-20 16:08:18 浏览:356