Thanks a million!
Knut
import java.io.*;
import java.lang.String;
import javax.swing.*;
import java.security.*;
public class JavaTema extends JApplet {
static String text1;
static String path;
static String permissionS;
File fil;
FilePermission perm;
public JavaTema() {
path = new String("ALL FILES");
permissionS = new String("read");
perm = new FilePermission(path, permissionS);
text1 = new String(Innhold());
fil = new File("C:/CHANGES.txt");
initComponents ();
}
public String Innhold() {
String s = new String();
char[] buff = new char[500000];
InputStream is;
InputStreamReader reader;
perm.checkGuard(perm);
try {
is = new FileInputStream(fil);
reader = new InputStreamReader(is);
int nch;
while ((nch = reader.read(buff, 0, buff.length)) != -1) {
s = s + new String(buff, 0, nch);
}
} catch (IOException ex) {
showStatus("This didnt work");
}
return s;
}//Innhold
private void initComponents () {//GEN-BEGIN:initComponents
Tabulator = new javax.swing.JTabbedPane ();
IntroScroll = new javax.swing.JScrollPane ();
Intro = new javax.swing.JTextArea ();
Tabulator.setTabPlacement (4);
Intro.setEditable (false);
Intro.setText (text1);
IntroScroll.setViewportView (Intro);
Tabulator.addTab ("Introduction", IntroScroll);
getContentPane ().add (Tabulator, java.awt.BorderLayout.CENTER);
}//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTabbedPane Tabulator;
private javax.swing.JScrollPane IntroScroll;
private javax.swing.JTextArea Intro;
// End of variables declaration//GEN-END:variables
}
>¤#%&!¤/#%/&)¤&/()................
Sorry, I can't help, but may I use the above?
:-)
anthony shipley
<math> 2 + 2 = 5 for sufficiently large values of 2</math>
But it wont work ofcourse
knut
"Anthony Shipley" <ast...@iinet.net.au> wrote in message
news:g3jlus0nm5d99qhig...@4ax.com...
>If its the code you are reffering to.......
>Yes go ahead and help yourself
No, it was the ¤#%&!¤/#%/&)¤&/()................
So expressive :-)
-----8<-----------------8<--------------------
> fil = new File("C:/CHANGES.txt");
-----8<-----------------8<--------------------
Should be:
fil = new File("C:\\CHANGES.txt");
but remember that it is only works on Widows, if you would want to use the
program on other platforms and program 100% pure then you should check
os.arch en the other properties to determine the path delimiters...
Ivo
What a stupid mistake!
I suspected it was somthing about the dir.
Did try to use url: file://c:/CHANGES.txt too, but that didnt work either,
probably wrong that too.
Well....... wont do that again!
Knut
"Ivo Limmen" <lim...@furore.nl> wrote in message
news:8setri$o9g$1...@porthos.nl.uu.net...
knut
"Anthony Shipley" <ast...@iinet.net.au> wrote in message
news:qcplusc0q6q2v73vc...@4ax.com...
I assumed it was the dir. But that didnt fix anything!
Still that fuc£${$?%¤&/((/&
java.security.AccessControlException: access denied
(java.io.FilePermission ALL FILES read)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java
:272)
at
java.security.AccessController.checkPermission(AccessController.java:399)
at
java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.security.Permission.checkGuard(Permission.java:86)
at JavaTema.Innhold(JavaTema.java:38)
at JavaTema.<init>(JavaTema.java:28)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:579)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:515)
at sun.applet.AppletPanel.run(AppletPanel.java:293)
at java.lang.Thread.run(Thread.java:484)
Jon
"Knut Chr. Brinch" <k-br...@frisurf.no> wrote in message
news:dDGG5.7725$W31.1...@news1.online.no...
knut
"Jon Davis" <jon....@REMOVE.ME.ebalance.com> wrote in message
news:sun0hva...@news.supernews.com...
I made a console java app to test how to open a file:
---------------------
import java.io.*;
public class Test {
private String str;
public static void main(String[] args) {
Test t = new Test();
t.test();
t = null;
}
public void test() {
try {
FileInputStream in;
str = new String();
// completely read the template
in = new FileInputStream("C:\\CHANGES.txt");
while(in.available() > 0) {
str+=(char)in.read();
}
System.out.println(str);
in.close();
in = null;
}
catch(Exception e) { }
}
}
---------------------
<<This works....>>
Ivo
Jon
"Knut Chr. Brinch" <k-br...@frisurf.no> wrote in message
news:HISG5.8160$W31.1...@news1.online.no...
knut
"Ivo Limmen" <lim...@furore.nl> wrote in message
news:8sh00m$o8l$1...@porthos.nl.uu.net...
Forward slahes work just fine on windows, the File class will translate
them for you.
Niels
--
Mail: hydra1m...@wxs.ONIONnl (Eat your veggies)
Page: http://home.conceptsfa.nl/~hydra/
"One Ring to rule them all, One Ring to find them,
One Ring to bring Them all and in the darkness bind them
In the Land of Mordor where the Shadows lie."
> ¤#%&!¤/#%/&)¤&/()................
..
> path = new String("ALL FILES");
The API says: 'The special pathname "<<ALL FILES>>" matches all
files.' Isn't there something missing in your String?
Joni
--
Joni Niemi | All marriages are happy. It's living
Joni....@iki.fi | together afterwards that is difficult.
http://www.iki.fi/joni/ | -- Anonymous