javaforwindows
1. jdk for windows 32位下载地址有么,和java翻译器下载地址。
对于第二条答案,我有补充,如果看不懂,可以换成Google浏览器,有自动翻译
还有32位地址是http://download.oracle.com/otn-pub/java/jdk/7u51-b13-demos/jdk-7u51-windows-i586-demos.zip
2. java能开发windows程序吗
JAVA开发的程序可以通过JVMforwindows在Windows上运行,但并不能用来开发Windows原生程序,正如现回在的HTML5开发的答应用可以再Andriod上运行,但并不是安卓的原生应用一样。Java语言的一个非常重要的特点就是与平台的无关性。而使用Java虚拟机(JavaVirtualMachine)是实现这一特点的关键。JVM是(Java虚拟机)的缩写,JVM是一种用于计算设备的规范,它是一个虚构出来的计算机,是通过在实际的计算机上仿真模拟各种计算机功能来实现的。一般的高级语言如果要在不同的平台上运行,至少需要编译成不同的目标代码。而引入Java语言虚拟机后,Java语言在不同平台上运行时不需要重新编译。Java语言使用Java虚拟机屏蔽了与具体平台相关的信息,使得Java语言编译程序只需生成在Java虚拟机上运行的目标代码(字节码),就可以在多种平台上不加修改地运行。Java虚拟机在执行字节码时,把字节码解释成具体平台上的机器指令执行。这就是Java的能够“一次编译,到处运行”的原因。
3. 如何在JAVA中调用windows
虽然JAVA是平台无关性的,但是在企业中很多时候还是在为特定的系统在开发,会要求调用一些当前系统的其他程序或命令。最常见的是在WINDOWS中。其实JAVA是可以通过Runtime去调用系统中的一些程序的,下面是一个例子:
try {
ps = Runtime.getRuntime().exec( " E:\\test.exe " );
// ps = Runtime.getRuntime().exec("ipconfig"); ---- For execute windows commands
// ps = Runtime.getRuntime().exec("E:\\test.bat"); ---- For run BAT files
BufferedReader in = new BufferedReader( new InputStreamReader(ps.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null ) {
result += inputLine + " \n " ;
}
in.close();
System.out.println( " Output: " + result);
} catch (Exception ex) {
System.out.println( " Error " + ex.getMessage());
}
上面的代码片断中后面一部分是在取返回的参数,如果不需要可以不取。不取的话可能也就不需要取得到Process了。用这个方法可以运行windows中的exe或者bat文件。
4. 如何用java启动windows命令行程序
先请编译和运行下面程序:
import java.util.*;
import java.io.*;
public class BadExecJavac2
{
public static void main(String args[])
{
try
{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("javac");
int exitVal = proc.waitFor();
System.out.println("Process exitValue: " + exitVal);
} catch (Throwable t){
t.printStackTrace();
}
}
}
我们知道javac命令,当不带参数运行javac
程序时,它将输出帮助说明,为什么上面程序不产生任何输出并挂起,永不完成呢?java文档上说,由于有些本地平台为标准输入和输出流所提供的缓冲区大小
有限,如果不能及时写入子进程的输入流或者读取子进程的输出流,可能导致子进程阻塞,甚至陷入死锁。所以,上面的程序应改写为:
import java.util.*;
import java.io.*;
public class MediocreExecJavac
{
public static void main(String args[])
{
try
{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("javac");
InputStream stderr = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line = null;
System.out.println("");
while ( (line = br.readLine()) != null)
System.out.println(line);
System.out.println("");
int exitVal = proc.waitFor();
System.out.println("Process exitValue: " + exitVal);
} catch (Throwable t){
t.printStackTrace();
}
}
}
下面是正确的输出:
D:\java>java MediocreExecJavac
Usage: javac <options>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath Specify where to find user class files
-cp Specify where to find user class files
-sourcepath Specify where to find input source files
-bootclasspath Override location of bootstrap class files
-extdirs Override location of installed extensions
-endorseddirs Override location of endorsed standards path
-d Specify where to place generated class files
-encoding Specify character encoding used by source files
-source Provide source compatibility with specified release
-target Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J Pass directly to the runtime system
Process exitValue: 2
D:\java>
下面是一个更一般的程序,它用两个线程同步清空标准错误流和标准输出流,并能根据你所使用的windows操作系统选择windows命令解释器command.com或cmd.exe,然后执行你提供的命令。
import java.util.*;
import java.io.*;
class StreamGobbler extends Thread
{
InputStream is;
String type; //输出流的类型ERROR或OUTPUT
StreamGobbler(InputStream is, String type)
{
this.is = is;
this.type = type;
}
public void run()
{
try
{
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line=null;
while ( (line = br.readLine()) != null)
{
System.out.println(type + ">" + line);
System.out.flush();
}
} catch (IOException ioe)
{
ioe.printStackTrace();
}
}
}
public class GoodWindowsExec
{
public static void main(String args[])
{
if (args.length < 1)
{
System.out.println("USAGE: java GoodWindowsExec ");
System.exit(1);
}
try
{
String osName = System.getProperty("os.name" );
System.out.println("osName: " + osName);
String[] cmd = new String[3];
if(osName.equals("Windows XP") ||osName.equals("Windows 2000"))
{
cmd[0] = "cmd.exe" ;
cmd[1] = "/C" ;
cmd[2] = args[0];
}
else if( osName.equals( "Windows 98" ) )
{
cmd[0] = "command.com" ;
cmd[1] = "/C" ;
cmd[2] = args[0];
}
Runtime rt = Runtime.getRuntime();
System.out.println("Execing " + cmd[0] + " " + cmd[1]+ " " + cmd[2]);
Process proc = rt.exec(cmd);
// any error message?
StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");
// any output?
StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
// kick them off
errorGobbler.start();
outputGobbler.start();
// any error???
int exitVal = proc.waitFor();
System.out.println("ExitValue: " + exitVal);
} catch (Throwable t){
t.printStackTrace();
}
}
}
下面是一个测试结果:
D:\java>java GoodWindowsExec " Test.java Test1.java"
osName: Windows XP
Execing cmd.exe /C Test.java Test1.java
OUTPUT>已复制 1 个文件。
ExitValue: 0
D:\java>
下面的测试都能通过(windows xp+jdk1.5)
D:\java>java GoodWindowsExec dir
D:\java>java GoodWindowsExec Test.java
D:\java>java GoodWindowsExec regedit.exe
D:\java>java GoodWindowsExec NOTEPAD.EXE
D:\java>java GoodWindowsExec first.ppt
D:\java>java GoodWindowsExec second.doc
function TempSave(ElementID)
{
CommentsPersistDiv.setAttribute("CommentContent",document.getElementById(ElementID).value);
CommentsPersistDiv.save("CommentXMLStore");
}
function Restore(ElementID)
{
CommentsPersistDiv.load("CommentXMLStore");
document.getElementById(ElementID).value=CommentsPersistDiv.getAttribute("CommentContent");
}
5. 如何用JAVA快速开发WINDOWS桌面应用
java 图形界面,主要是几种技术来实现 AWT, Swing, SWT, JavaFX .
AWT性能好, 内存占用小, 但是外观不太美观, 组件不版够丰富
Swing 内存略大, 但是功能权扩张起来还是有点麻烦. 很长时间没有更新了
推荐JavaFX , 新技术, 外表美观, 功能强大, 组件丰富. webview 等新组件, 非常实用.
如果想用java快速开发windows程序 .那么就需要推荐一些插件了
比如windowbuilder 可以对swing进行可视化开发
Scene Builder 可以对javaFX进行可视化开发
6. 用java控制windows窗口方便吗
java控制window系统音量有两种办法,一是JNA或者JNI调用,二是执行VBS脚本。
这里推荐使用第二种方式,它比较灵活,控制可以放在程序内,也可以将控制文件独立出来,便于后期维护更改。
核心代码如下:
public static void main(String[] args){
File file = File.createTempFile("ylkz_vba",".vbs");
file.deleteOnExit();
FileWriter fw = new FileWriter(file);
String vbs ="'以下命令实现音量减(用循环可以实现一直减):\n" +
"Set WshShell = CreateObject(\"WScript.Shell\")\n" +
"WshShell.SendKeys(chr(&hAE))\n" +
"'音量增(用循环可以实现一直增):\n" +
"Set WshShell = CreateObject(\"WScript.Shell\")\n" +
"WshShell.SendKeys(chr(&hAF))";
fw.write(vbs);
fw.close();
Runtime.getRuntime().exec("wscript " + file.getPath()).waitFor();
7. java代码可以做成windows程序吗
JAVA开发的程序可以通过JVM for windows在Windows上运行,但并不能用来开发Windows原生程序,正如现在的HTML5开发的应用可以再Andriod上运行,但并不是安卓的原生应用一样。
Java语言的一个非常重要的特点就是与平台的无关性。而使用Java虚拟机(Java Virtual Machine)是实现这一特点的关键。JVM是(Java虚拟机)的缩写,JVM是一种用于计算设备的规范,它是一个虚构出来的计算机,是通过在实际的计算机上仿真模拟各种计算机功能来实现的。
一般的高级语言如果要在不同的平台上运行,至少需要编译成不同的目标代码。而引入Java语言虚拟机后,Java语言在不同平台上运行时不需要重新编译。Java语言使用Java虚拟机屏蔽了与具体平台相关的信息,使得Java语言编译程序只需生成在Java虚拟机上运行的目标代码(字节码),就可以在多种平台上不加修改地运行。Java虚拟机在执行字节码时,把字节码解释成具体平台上的机器指令执行。这就是Java的能够“一次编译,到处运行”的原因。
8. 安装eclipse出现Java for Windows Missing
安装eclipse出现Java for Windows Missing的原因是32位的jdk,而windows是64位版本不一致产生的。
错误提示如图:
解决办法:建议下载64位的jdk安装后,再运行installer来安装eclipse。
9. java可以开发windows程序吗
JAVA开发的程序可以通过JVM for windows在Windows上运行,但并不能用来开发Windows原生程序,正如现在的版HTML5开发的应用权可以再Andriod上运行,但并不是安卓的原生应用一样。
Java语言的一个非常重要的特点就是与平台的无关性。而使用Java虚拟机(Java Virtual Machine)是实现这一特点的关键。JVM是(Java虚拟机)的缩写,JVM是一种用于计算设备的规范,它是一个虚构出来的计算机,是通过在实际的计算机上仿真模拟各种计算机功能来实现的。
一般的高级语言如果要在不同的平台上运行,至少需要编译成不同的目标代码。而引入Java语言虚拟机后,Java语言在不同平台上运行时不需要重新编译。Java语言使用Java虚拟机屏蔽了与具体平台相关的信息,使得Java语言编译程序只需生成在Java虚拟机上运行的目标代码(字节码),就可以在多种平台上不加修改地运行。Java虚拟机在执行字节码时,把字节码解释成具体平台上的机器指令执行。这就是Java的能够“一次编译,到处运行”的原因。