我正试图创建一种基于oleava的简单专断应用程序,要求用户从地方档案系统挑选档案。
专栏促使用户选择一种可供选择的备选办法,然后根据所提供的投入进行转换。
public Client() throws UnknownHostException, IOException {
printuseroptions();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
char userdecision = br.readLine().charAt(0);
System.out.println(userdecision);
switch(userdecision){
case 1 :
System.out.println("Which file would you like to open?");
openfile(br.readLine());
break;
case 2 :
System.out.println("Which file would you like to close?");
closefile(br.readLine());
break;
}
private boolean openfile(String path){
System.out.println("openfile("+path+")");
return false;
}
private boolean closefile(String path){
System.out.println("closefile("+path+")");
new JFileChooser().showOpenDialog(null);
return false;
}
不管我做什么,JFileChooser popup箱不会打开。 青 the没有发现任何错误,但解冻的步行显示出以下错误:
Blockquote Thread [main] (Suspended)
ClassNotFoundException(Throwable).(String, Throwable) line: 217
ClassNotFoundException(Exception).(String, Throwable) line: not available ClassNotFoundException.(String) line: not available
URLClassLoader$1.run() line: not available
AccessController.doPrivileged(PrivilegedExceptionAction, AccessControlContext) line: not available [native method]
Launcher$ExtClassLoader(URLClassLoader).findClass(String) line: not available
Launcher$ExtClassLoader.findClass(String) line: not available
Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not available Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not available Launcher$AppClassLoader.loadClass(String, boolean) line: not available
Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available
ResourceBundle$RBClassLoader.loadClass(String) line: not available
CoreResourceBundleControl(ResourceBundle$Control).newBundle(String, Locale, String, ClassLoader, boolean) line: not available
ResourceBundle.loadBundle(CacheKey, List, Control, boolean) line: not available ResourceBundle.findBundle(CacheKey, List, List, int, Control, ResourceBundle) line: not available
ResourceBundle.getBundleImpl(String, Locale, ClassLoader, ResourceBundle$Control) line: not available
ResourceBundle.getBundle(String, ResourceBundle$Control) line: not available
Toolkit$3.run() line: not available AccessController.doPrivileged(PrivilegedAction) line: not available [native method]
Toolkit.() line: not available
Component.() line: not available
Client.closefile() line: 90 Client.() line: 60
Client.main(String[]) line: 36
同一代码完全使用第32轨机器,因此我怀疑这个问题与Windows有关。
下面的代码在Windows和HCH上都按预期操作,因此,我怀疑可能是因为在Windows vsosphere(CR LF)处理青 input素投入时有不同的方式。
import javax.swing.JFileChooser;
public class Example {
public static void main(String[] args) {
new JFileChooser().showOpenDialog(null);
}
}
增 编