java应用程序已java8阻止被阻止,应该怎么设置

java程序如何阻止二次运行~ - ITeye问答
我现在有一个程序我希望它只出现一个界面窗口
就是第二次运行的时候不要打开新窗口。。什么都不做。。或者弹出已打开的那个窗口
好像C++这类程序都可以。。
javase桌面程序没找到方法。。
百度也百度不到。。所以到这里发帖。。
问题补充:但是貌似所有的javase程序开启在windows进程列表,都显示为一个javaw.exe进程,不是很明白你们代码,可以讲讲流程吗?
&br /&
&br /&&div class="quote_title"&牟盖东 写道&/div&&div class="quote_div"&&pre name="code" class="java"&
public static int getProcessId(int port,String protype) throws Exception{
& Process pro = Runtime.getRuntime().exec("cmd /c netstat -ano");
&&&&&&& BufferedReader in = new BufferedReader(new InputStreamReader(pro.getInputStream()));&
&&&&&&& StreamTokenizer stok = new StreamTokenizer(in);
&&&&&&& StreamTokenizer stok2 = new StreamTokenizer(in);
&&&&&&& stok.parseNumbers();
&&&&&&& stok.nextToken();
&&&&&&&
&&&&&&& int Interval = 0;
&&&&&&& if(protype.equals("UDP")){
&&&&&&&& Interval = 1;
&&&&&&& }
&&&&&&& else Interval = 5;//跳跃间隔
&&&&&&&
&&&&&&& int processIdposition = 0;
&&&&&&& int portposition = 0;
&&&&&&& boolean isprocess =
&&&&&&& while(in.readLine() != null){
&&&&&&&& while (stok2.ttype != StreamTokenizer.TT_EOF) {
&&&&&&&&& if((stok2.sval != null) && (stok2.sval.equals(protype))){
&&&&&&&&&& while(stok.ttype != StreamTokenizer.TT_EOF){
&&&&&&&&&&& if (stok.ttype == StreamTokenizer.TT_NUMBER){
&&&&&&&&&&&& processIdposition ++;
&&&&&&&&&&&& portposition++;
&&&&&&&&&&&& if((processIdposition == Interval)&& isprocess ){
&&&&&&&&&&&&& return (int)stok.
&&&&&&&&&&&& }
&&&&&&&&&&&& if(((int)stok.nval == port)&&(portposition == 4)){&&&&&&&&&&&&
&&&&&&&&&&&&& isprocess =
&&&&&&&&&&&&& processIdposition = 0;
&&&&&&&&&&&& }
&&&&&&&&&&& }
&&&&&&&&&&& if((stok.sval != null) && (stok2.sval.equals(protype))){
&&&&&&&&&&&& portposition = 0;
&&&&&&&&&&& }
&&&&&&&&&&&
&&&&&&&&&&& stok.nextToken();
&&&&&&&&&&& }
&&&&&&&&& }
&&&&&&&&& stok2.nextToken();
&&&&&&&&&& }
&&&&&&& }
& return -1 ;//没有该端口号匹配的进程ID,则返回-1;
}
&/pre&
&br /&
&br /&以上是java实现依据端口号的进程寻找 的实现,看看你能不能不用上吧&/div&
&br /&
public static int getProcessId(int port,String protype) throws Exception{
Process pro = Runtime.getRuntime().exec("cmd /c netstat -ano");
BufferedReader in = new BufferedReader(new InputStreamReader(pro.getInputStream()));
StreamTokenizer stok = new StreamTokenizer(in);
StreamTokenizer stok2 = new StreamTokenizer(in);
stok.parseNumbers();
stok.nextToken();
int Interval = 0;
if(protype.equals("UDP")){
Interval = 1;
else Interval = 5;//跳跃间隔
int processIdposition = 0;
int portposition = 0;
boolean isprocess =
while(in.readLine() != null){
while (stok2.ttype != StreamTokenizer.TT_EOF) {
if((stok2.sval != null) && (stok2.sval.equals(protype))){
while(stok.ttype != StreamTokenizer.TT_EOF){
if (stok.ttype == StreamTokenizer.TT_NUMBER){
processIdposition ++;
portposition++;
if((processIdposition == Interval)&& isprocess ){
return (int)stok.
if(((int)stok.nval == port)&&(portposition == 4)){
isprocess =
processIdposition = 0;
if((stok.sval != null) && (stok2.sval.equals(protype))){
portposition = 0;
stok.nextToken();
stok2.nextToken();
return -1 ;//没有该端口号匹配的进程ID,则返回-1;
以上是java实现依据端口号的进程寻找 的实现,看看你能不能不用上吧
请找程序设置端口的相关部分
已解决问题
未解决问题当前位置: >
win7系统运行Java提示“应用程序已安全设置被阻止”问题的解决方
时间: 11:56来源: 作者:admin浏览:次
相关推荐:
我要分享:
win7系统教程
热门系统教程
win7烟雾头最新调法 cf烟雾头...
热门系统下载
本类教程排行
最新系统下载
热门软件下载
Copyright©2016
(.cn/) 版权所有 粤ICP备号
本站发布的系统与软件仅为个人学习测试使用,请在下载后24小时内删除,不得用于任何商业用途,否则后果自负,请支持购买微软正版软件!
如侵犯到您的权益,请及时通知我们,我们会及时处理。

我要回帖

更多关于 应用程序已被java阻止 的文章

 

随机推荐