Permlink Replies: 7 - Pages: 1 - Last Post: 03-Mar-2020 21:25 Last Post By: RobM Threads: [ Previous | Next ]
ctwist

Posts: 559
Registered: 27-Sep-2003
Tool Tutorial for Eclipse
Posted: 01-Mar-2020 00:12
  Click to reply to this thread Reply
A few months ago, we had a discussion about developing tools in compiled Java instead of BeanShell. One developer did not know how to do this, so I said I would provide instructions. Here they are.

This is a temporary location for the tutorial. I will move it to the Developer Centre after all feedback has been incorporated.

Some of you are familiar with Netbeans but not Eclipse. At my Java Introduction course many years ago, the instructor told me that Eclipse was the best Java IDE. I'm sure that Netbeans has improved since then, and I don't know which is better now. Anyway, I am not curious enough to try Netbeans, so you will have to manage with an Eclipse tutorial.

Edited by: ctwist on 02-Mar-2020 10:11
Updated the final screen print in "Eclipse Tool Tutorial.pdf".

Edited by: ctwist on 02-Mar-2020 10:33
Provided better instructions for downloading the latest version of Eclipse.
RobM

Posts: 3,114
Registered: 4-Aug-2006
Re: Tool Tutorial for Eclipse
Posted: 01-Mar-2020 00:43   in response to: ctwist in response to: ctwist
  Click to reply to this thread Reply
Thanks for this, I for one will have a proper look at it on Sunday and let you know how I get on with it.
davidekholm

Posts: 3,158
Registered: 18-Oct-2002
Re: Tool Tutorial for Eclipse
Posted: 02-Mar-2020 10:54   in response to: RobM in response to: RobM
  Click to reply to this thread Reply
Thanks for this effort Chris!
RobM

Posts: 3,114
Registered: 4-Aug-2006
Re: Tool Tutorial for Eclipse
Posted: 03-Mar-2020 00:06   in response to: ctwist in response to: ctwist
  Click to reply to this thread Reply
I downloaded Eclipse and got the project setup, I think ok. But I have deleted it all and started over, to go over the process again. Now I'm having trouble 'seeing' the src files. The folder is linked correctly but no files show up, even after doing a refresh.

Will have another go tomorrow as the battery is nearly flat and it will soon be bed time.

I also tried the plugin itself, which of course worked. Then I renamed it from SampleTool.jaext to SampleTool.zip and then compressed the resulting SampleTool folder using the Mac's built in compression function. After renaming it to SampleTool.jaext and installing it, then restarting jAlbum I get this error:
We're sorry. jAlbum is unable to start. Please pass this error report to support@jalbum.net
Thank you for your patience.
 
java.lang.NoClassDefFoundError: SampleToolPlugin (wrong name: SampleTool/SampleToolPlugin)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
	at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
	at java.base/java.net.URLClassLoader.defineClass(Unknown Source)
	at java.base/java.net.URLClassLoader$1.run(Unknown Source)
	at java.base/java.net.URLClassLoader$1.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.net.URLClassLoader.findClass(Unknown Source)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	at se.datadosen.jalbum.PluginManager.createPlugin(PluginManager.java:103)
	at se.datadosen.jalbum.PluginManager.loadPlugins(PluginManager.java:77)
	at se.datadosen.jalbum.PluginManager.loadPlugins(PluginManager.java:40)
	at se.datadosen.jalbum.JAlbum.<init>(JAlbum.java:123)
	at se.datadosen.jalbum.JAlbum.main(JAlbum.java:370)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at se.datadosen.jalbum.Main.main(Main.java:44)

Now that is weird, and leaves me wondering how I'm going to compress other tools I might want to make.
ctwist

Posts: 559
Registered: 27-Sep-2003
Re: Tool Tutorial for Eclipse
Posted: 03-Mar-2020 00:45   in response to: RobM in response to: RobM
  Click to reply to this thread Reply
When you delete a project, select "Delete project contents on disk", otherwise when you recreate the project Eclipse will reuse the project settings. However, this also causes the src folder to be deleted, and in Windows the files do not go to the recycle bin. Make sure you have a copy of the src files.

I think the error is because the zip file contains the SampleTool folder. Unlike skin projects, you should zip the contents of the folder, but not the folder itself.

Edited by: ctwist on 02-Mar-2020 23:02
RobM

Posts: 3,114
Registered: 4-Aug-2006
Re: Tool Tutorial for Eclipse
Posted: 03-Mar-2020 16:34   in response to: ctwist in response to: ctwist
  Click to reply to this thread Reply
ctwist wrote:
When you delete a project, select "Delete project contents on disk", otherwise when you recreate the project Eclipse will reuse the project settings. However, this also causes the src folder to be deleted, and in Windows the files do not go to the recycle bin. Make sure you have a copy of the src files.
I did do that, it seems that when deleting the project it does not delete a '.plist' file which contains info on the src folder. To be sure I deleted that, completely removed Eclipse and started again. The project now loads but I'm getting an error
Description	Resource	Path	Location	Type
The serializable class PluginPanel does not declare a static final 
serialVersionUID field of type long	
PluginPanel.java	/SampleTool/src	line 7	Java Problem

I think the error is because the zip file contains the SampleTool folder. Unlike skin projects, you should zip the contents of the folder, but not the folder itself.
Yep, got myself tied in knots, it compresses properly when you do it right ;)
ctwist

Posts: 559
Registered: 27-Sep-2003
Re: Tool Tutorial for Eclipse
Posted: 03-Mar-2020 17:45   in response to: RobM in response to: RobM
  Click to reply to this thread Reply
RobM wrote:
The serializable class PluginPanel does not declare a static final serialVersionUID field of type long
Hover over the highlighted error on line 7, and it shows you the available solutions. Click "Add generated serial version ID".

Here is an explanation of the error https://stackoverflow.com/questions/5632065/what-does-the-declare-a-static-final-serialversionuid-warning-mean-and-how-to.

I don't get this error because a long time ago I changed an Eclipse option. I remember this vaguely, but don't remember exactly why I chose this approach.

To prevent this from being flagged as an error, open "Window / Preferences / Potential programming problems / Serializable class without serialVersionUID". Change the setting from "Error" to "Ignore".

I suspect that the dangers of changing this do not apply in our single user, single process environment.
RobM

Posts: 3,114
Registered: 4-Aug-2006
Re: Tool Tutorial for Eclipse
Posted: 03-Mar-2020 21:25   in response to: ctwist in response to: ctwist
  Click to reply to this thread Reply
ctwist wrote:
RobM wrote:
The serializable class PluginPanel does not declare a static final serialVersionUID field of type long
Hover over the highlighted error on line 7, and it shows you the available solutions. Click "Add generated serial version ID".

Here is an explanation of the error https://stackoverflow.com/questions/5632065/what-does-the-declare-a-static-final-serialversionuid-warning-mean-and-how-to.

I don't get this error because a long time ago I changed an Eclipse option. I remember this vaguely, but don't remember exactly why I chose this approach.

To prevent this from being flagged as an error, open "Window / Preferences / Potential programming problems / Serializable class without serialVersionUID". Change the setting from "Error" to "Ignore".

I suspect that the dangers of changing this do not apply in our single user, single process environment.

Got it working now, just had to copy the 'images' folder from your SampleTool.jaext to jAlbum ext > SampleTool > plugins folder. Without the st.jpg file it crashes when trying to run it.

Thanks very much for the tutorial and source code example.
Legend
Forum admins
Helpful Answer
Correct Answer

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