This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 7 - Pages: 1 - Last Post: 14-Oct-2020 22:18 Last Post By: AndreWolff
AndreWolff

Posts: 1,883
Registered: 14-Dec-2007
copyFile() error
Posted: 28-Aug-2020 17:05
 
  Click to reply to this thread Reply
I have all several years in all my skins this code in finaly.bsh
 /*  Get the correct set of buttons: */
File source = new File(skinResDirectory.getParentFile(), buttonSet);
File dest = resDirectory;
//System.out.println("source: " +  source + " dest: " +   dest);
try {
      IO.copyFile(source, dest, true); // this is line 11
    } catch (IOException e) {};
to copy a number of button images to the res folder in the output folder.
But in jAlbum 21beta I get on my windows system sometimes, a crash:
se.datadosen.util.ScriptException: bsh.UtilEvalError: Attempt to resolve method: copyFile() on undefined variable or class name: IO in finally.bsh at line number 11
	at se.datadosen.util.ScriptException.of(ScriptException.java:59)
	at se.datadosen.jalbum.AlbumBean.processScript(AlbumBean.java:2569)

Most times the files are correctly copied by this code.

Any idea how to prevent this crash?

ctwist

Posts: 607
Registered: 27-Sep-2003
Re: copyFile() error
Posted: 28-Aug-2020 17:44   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Edited by: ctwist on 28-Aug-2020 11:47

Edited by: ctwist on 28-Aug-2020 19:43
ctwist

Posts: 607
Registered: 27-Sep-2003
Re: copyFile() error
Posted: 29-Aug-2020 01:43   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Ignore my previous reply.

I don't understand why you still use interpreted Java. A long time ago, I converted your interpreted code to Java classes. You thanked me for that (appreciated), but you have regressed to BeanShell interpreted Java. I don't understand why you did this. The Java compiler helps you. If you don't use it, you will spend a lot of time trying to identify errors that the Java compiler would have identified instantly.

You need to convert to compiled Java. If you don't understand how to do this, send me a private message and I will assist.

BTW When I say "Java compiler" I mean either the JDK compiler or the NetBeans compiler or the Eclipse compiler. They all serve the same purpose: debug your code before you test.
ctwist

Posts: 607
Registered: 27-Sep-2003
Re: copyFile() error
Posted: 29-Aug-2020 01:55   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
More information:

Look at Mirage's bsh files. They do not contain any Java code. Use this as a template.
AndreWolff

Posts: 1,883
Registered: 14-Dec-2007
Re: copyFile() error
Posted: 29-Aug-2020 09:43   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
ctwist wrote:
Ignore my previous reply.
Well on your advice I did add import se.datadosen.util.;* and I haven't seen the crash since that addition!
I don't understand why you still use interpreted Java. A long time ago, I converted your interpreted code to Java classes. You thanked me for that (appreciated), but you have regressed to BeanShell interpreted Java. I don't understand why you did this. The Java compiler helps you. If you don't use it, you will spend a lot of time trying to identify errors that the Java compiler would have identified instantly.
I did start converting it to compiled Java but I stuck. I am an old impatient man who like to see quick results and after all interpreted Java works still well.
You need to convert to compiled Java. If you don't understand how to do this, send me a private message and I will assist.
With your help I certainly like to give it a second try, I will send your an email.
BTW When I say "Java compiler" I mean either the JDK compiler or the NetBeans compiler or the Eclipse compiler. They all serve the same purpose: debug your code before you test.
I have only a Windows 10 PC, so what do you recommend?

What about Java with Visual Studio code?

Edited by: AndreWolff on 29-Aug-2020 10:29
AndreWolff

Posts: 1,883
Registered: 14-Dec-2007
Re: copyFile() error
Posted: 29-Aug-2020 09:45   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
ctwist wrote:
More information:

Look at Mirage's bsh files. They do not contain any Java code. Use this as a template.

As a start I converted this FancyBox album into this Mirage album.

However most slides are for too large on my monitor, for instance click thumb 11 of 32. How do I get it displayed so that I see the whole picture? I used as slide image bounds 1920x1080

Edit: With Firefox the images are displayed as I expect, but with Edge and Chrome they are too large.

Edited by: AndreWolff on 29-Aug-2020 09:47
ctwist

Posts: 607
Registered: 27-Sep-2003
Re: copyFile() error
Posted: 30-Aug-2020 04:54   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
I investigated your bsh files. It would require too much effort to convert these to compiled Java. You would have to do a lot of regression testing and it would not make sense to spend so much time on a skin that is working.

So, I withdraw my suggestion to convert to compiled Java.
AndreWolff

Posts: 1,883
Registered: 14-Dec-2007
Re: copyFile() error
Posted: 14-Oct-2020 22:18   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
ctwist wrote:
I investigated your bsh files. It would require too much effort to convert these to compiled Java.
Correct, it took me weeks to get used to the user unfriendly NetBeans program, but with help from David, RobM and jGromit I finished today the conversion. The remaining part to do is the user panel for panoramic images.
So, I withdraw my suggestion to convert to compiled Java.
I did not help, I still did it!
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums