Convert a vfs url string to url object

In java i created a virtual file system url string (as a String object). But when i convert this String into URL Object i got unknown protocol: vfs exception. My java code looks like follows


String urlString = "vfs:/E:/Servers/jboss7/standalone/deployments/isms.war/WEB-INF/lib/aribaweb.jar/META-INF/aribaweb.properties";
        URL url = new URL(urlString);

and the exception looks like follows


Exception in thread "main" java.net.MalformedURLException: unknown protocol: vfs
    at java.net.URL.(URL.java:574)
    at java.net.URL.(URL.java:464)
    at java.net.URL.(URL.java:413)
    at RegExpression.main(RegExpression.java:15)

Answers


Yes, like doing this. The URL is invalid when we convert the String to URL. So, I think we can do this, like follows:

String urlString = "vfs:/E:/Servers/jboss7/standalone/deployments/isms.war/WEB-INF/lib/aribaweb.jar/META-INF/aribaweb.properties";
File file = new File(urlString);
URL url = file.toURI().toURL();

Like this. Don't show exception what you say.

Good luck


Need Your Help

How can I prevent DataGridRow visibility from changing when I sort my DataGrid?

c# xaml sorting datagrid wpfdatagrid

I have an application that needs to display a set of rows that is filtered by some external criteria. For reasons I won't explain here, I don't really want to remove the rows from the DataTable the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.