Dim clsIntCmn As New WxsIntCmn
Dim strpath As String = txtPath.Text
clsIntCmn.Openfile(strpath, Page)
System.Diagnostics.Process.Start(strpath)
2.上传文件
Public Function Savefile(ByVal strFilepath As String, ByVal Request As HttpFileCollection) As Boolean
Dim bolflag As Boolean = True
Dim uploadedFiles As HttpFileCollection = Request
For i As Integer = 0 To uploadedFiles.Count - 1
Dim userPostedFile As HttpPostedFile = uploadedFiles(i)
Try
'要保存文件的路径
Dim strPath As String = strFilepath &"\" &_
System.IO.Path.GetFileName(userPostedFile.FileName)
If (userPostedFile.ContentLength >0) Then
'保存文件
userPostedFile.SaveAs(strPath)
End If
txtPath.Text = strPath
txtDelPath.Text = strPath
Catch ex As Exception
bolflag = False
i = uploadedFiles.Count
End Try
Next
Return bolflag
End Function
这是我曾经写过的,也已经用过,试试吧!应该可以帮助你的,不过你要改用一下语言
import java.awt.FileDialogpublic class Mytest extends java.awt.Frame{
public static void main(String args[]) {
FileDialog fd=new FileDialog(new Mytest(),"打开文件")
fd.setVisible(true)
fd.setFile("*.*")
}
}
这样就可以啊
win7/xp 双击执行jar包出现:could not find the main class今天同学问我双击jar包在有的机子上可以运行,但在有的机子上确没法运行,我就我遇到的问题和解决办法拿出来分享:
1.elipse打jar包一般有两种:一种是普通的jar file,另外一种是Runnable jar file;要想可执行当然选择第二种了
2.确人java -jar xxx.jar 在控制台或制作的bat文件中是否正常运行,如果不能正常运行说明jar包有问题;问题一般是没有
指定main方法入口,具体的方法是修改jar包内目录META-INF下的MANIFEST.MF文件,看是否有Main-Class属性,并且对应的类shifoulujing、书写等正确;
3.由于机子上装了压缩软件,jar包被压缩软件所关联,导致双击jar包无法运行,解决办法当然是改变打开方式:
将默认打开方式改为jre/bin目录下的javaw.exe
4.由于文件打开类型配置的问题,导致双击jar包出现找不到main函数,该类问题不管是xp,还是Win7比较统一的解决办法是修改关联程序的注册表,修改方法如下:
注意:"C:\Program Files\Java\jre6\bin\javaw.exe"应为你所装的javaw.exe的实际路径
注册表项的路径为:
\HKEY_CLASSES_ROOT\Aplications\javaw.exe\shell\open\command
在此路径下有一默认键值, 不正常的情况下, 键值是:"C:\Program Files\Java\jre6\bin\javaw.exe" "%1"
将键值改为"C:\Program Files\Java\jre6\bin\javaw.exe" -jar "%1"
然后依然用上述的javaw.exe关联jar文件, 问题完美解决.