Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27
  1. #21
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    901
    Rep Power
    2

    Default Re: java.lang.IllegalArgumentException: URI scheme is not "file"

    I have created a little example of what I mean. It's very easy to do.

    Test drive here: http://surfman.home.xs4all.nl/forum/ListApplet.html
    The applet loads this file: http://surfman.home.xs4all.nl/forum/list.txt

    This is the applet code:
    Java Code:
    package bla;
    
    import javax.swing.*;
    import java.io.*;
    import java.net.*;
    
    public class ListApplet extends JApplet {
        private JTextArea ta = new JTextArea();
    
        @Override
        public void init() {
            super.init();
            add(ta);
        }
    
        @Override
        public void start() {
            super.start();
    
            try {
                URL url = new URL("http://surfman.home.xs4all.nl/forum/list.txt");
                HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                BufferedReader r = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String line = null;
                while ((line = r.readLine()) != null) {
                    ta.append(line + "\n");
                }
            }
            catch (IOException e) {
                JOptionPane.showMessageDialog(this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
            }
        }
    }
    In my example I put all the lines into a JTextArea, but there is nothing stopping you from putting the names inside a List and iterate over the contents and use the Strings as components for the next URL.
    Last edited by SurfMan; 06-12-2013 at 01:36 PM.

  2. #22
    Zara Thompson is offline Member
    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Default Re: java.lang.IllegalArgumentException: URI scheme is not "file"

    You can email us for java programming assignment at xxx@xxxxxxx.com.
    Last edited by JosAH; 06-13-2013 at 10:46 AM. Reason: removed email address

  3. #23
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    901
    Rep Power
    2

    Default Re: java.lang.IllegalArgumentException: URI scheme is not "file"

    Quote Originally Posted by Zara Thompson View Post
    You can email us for java programming assignment at support@***.com.
    No, you should reply here where everybody can see it and benefit from all the constructive replies. We don't need homework factories.

  4. #24
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,062
    Rep Power
    8

    Default Re: java.lang.IllegalArgumentException: URI scheme is not "file"

    Beste surfman

    I get a "java.lang.UnsupportedClassVersionError: bla/ListApplet" error
    maybe my Java is not up to date?



    asic: Oyente de progreso añadido: sun.plugin.util.GrayBoxPainter$GrayBoxProgressList ener@63d87b85
    network: Conectando http://surfman.home.xs4all.nl/forum/...stApplet.class con proxy=DIRECT
    network: Conectando http://surfman.home.xs4all.nl:80/ con proxy=DIRECT
    network: Entrada de caché no encontrada [url: http://surfman.home.xs4all.nl/forum/...stApplet.class, versión: null]
    basic: error: bla/ListApplet : Unsupported major.minor version 51.0.
    java.lang.UnsupportedClassVersionError: bla/ListApplet : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader. java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java :615)
    at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:141)
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Ap plet2ClassLoader.java:259)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(P lugin2ClassLoader.java:263)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Pl ugin2ClassLoader.java:193)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Pl ugin2ClassLoader.java:174)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plu gin2ClassLoader.java:703)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Plu gin2Manager.java:3071)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Plugin2Manager.java:1516)
    at java.lang.Thread.run(Thread.java:680)
    Excepción: java.lang.UnsupportedClassVersionError: bla/ListApplet : Unsupported major.minor version 51.0
    Ignored exception: java.lang.UnsupportedClassVersionError: bla/ListApplet : Unsupported major.minor version 51.0

  5. #25
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,062
    Rep Power
    8

    Default Re: java.lang.IllegalArgumentException: URI scheme is not "file"

    The file is there and I can see it:
    Item 1
    Item 2
    Item 3

    The real problem with my code (which is not very different from yours I believe) is that it wants to list a directory!
    You see that might be a problem, so was explained in another forum, since host bosses do not like that (you
    peaking into there server directories).
    So in my case the problem lays with the host which doe not want the grant permission in viewing a folder content
    (by saying that java should be installed..... yes I live in Spain).
    At the other forum I was informed about free hosts that are java or directory reading friendly where I am going to
    upload the page soon to find out what will happen next....

    maar in ieder geval bedankt voor de moeite en ik zal je informeren hoe deze zaak
    verder zal ontwikkelen....
    en het blijft verder de vraag: where have all the applets gone?

    tot ziens surfman
    Last edited by willemjav; 06-13-2013 at 06:02 PM.

  6. #26
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    901
    Rep Power
    2

    Default Re: java.lang.IllegalArgumentException: URI scheme is not "file"

    Getting a directory listing over HTTP is tricky. In the best case you get presented a default Apache formatted directory as the example here: Index of /download.fedora.redhat.com/linux/releases/18/Fedora/x86_64/iso

    This can be parsed ofcourse, but still, it's tricky and very error prone. Your host can install Java, but what do you want him to do? He has to write code that runs on the server responding to your requests? You could also try FTP. That, as the name implies, is very suitable to handle files and directories. In the end of the day you should keep it simple. Dropping a file in there with the filenames is very easy. You could even auto generate that file using a cronjob on the server if your host allows it (and most hosts with proper services let you do that).

  7. #27
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,062
    Rep Power
    8

    Default Re: java.lang.IllegalArgumentException: URI scheme is not "file"

    Thanks surfman, I'll soon get into internet stuff.
    Studying the javacore II book, collection for to moment.
    Next chapter internet connections, sockets etc.
    Yes I still go by the book, but making progress,
    and probably we'll meet again soon.

    salud for now, willem

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 5
    Last Post: 12-21-2011, 06:44 PM
  2. Replies: 4
    Last Post: 09-16-2011, 10:08 PM
  3. Replies: 6
    Last Post: 03-19-2011, 07:10 PM
  4. Replies: 12
    Last Post: 05-26-2009, 01:48 PM
  5. Replies: 1
    Last Post: 08-06-2007, 06:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •