MalformedUrlException unbekanntes Protokoll classpath in Java

Ich versuche den Wert einer URL-Instanz-variable als classpath, aber ich erhalte die folgende Fehlermeldung:

Exception in thread "main" java.net.MalformedURLException: unknown protocol: classpath
    at java.net.URL.<init>(URL.java:600)
    at java.net.URL.<init>(URL.java:490)
    at java.net.URL.<init>(URL.java:439)
    at com.foodprocessor.App.main(App.java:18)
C:\Users\admin\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)

Dies ist mein code:

    public class App {
    public static void main(String[] args) throws MalformedURLException{
        MyEnvironmentA env = new MyEnvironmentA(new URL("classpath:"+System.getProperty("java.class.path")));
        env.run("ChocolateMilk");
     }
   }

Wohin gehe ich falsch?

InformationsquelleAutor Jois | 2017-03-07
Schreibe einen Kommentar