[英]How To Get Directory In To Java App From Windows Right Click Context
I have successfully added a customized right click context in my windows. 我已经在窗口中成功添加了自定义的右键单击上下文。 Whenever i click on it it launch my java app as i have already wrapped it in .exe.
每当我单击它时,它就会启动我的Java应用程序,因为我已经将它包装在.exe中。
I want to get the directory from windows right click context in my java app and display it in a jTextField as it is clicked. 我想从Windows的Java应用程序的右键单击上下文中获取目录,并在单击它时将其显示在jTextField中。
Finally got the answer to my question with the snippet bellow in my main method 终于在我的主要方法中用片段式波纹管解决了我的问题
public static void main(String args[]) {
new Main().setVisible(true);
String incomming = Arrays.toString(args).replace("[", "");
String incommingF = incomming.replace("]", "");
JOptionPane.showMessageDialog(null, incommingF) ;
}
incomming is the directore passed into the application which contains the [ ]. 传入的是指向包含[]的应用程序的控制器。 thereby replacing it with empty text.
从而将其替换为空文本。 IncommingF is the final directory passed into the java application from windows right click context
IncommingF是从Windows右键单击上下文传递到Java应用程序的最终目录
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.