Knowledgebase:
Setup IDE Eclipse
Posted by pspzockerscene psp, Last modified by pspzockerscene psp on 31 March 2022 01:44 PM

Setup IDE Eclipse


Most of the team uses the free Java IDE Eclipse to work on JDownloader.
JDownloader's Sourcecode is stored on a code „Subversion“ server. To Check out the latest code, and to commit changes, you need a Subversion client.
We prefer an integrated solution, and thus use the Eclipse addon Subclipse as Subversion client.


Install all required tools

  1. Any supported Java JDK: OpenJDK, Adoptium, AdoptOpenJDK, Oracle, IBM, Zulu, Zing, Corretto, Microsoft
  2. Eclipse IDE for Java Developers

Set up Eclipse

Start Eclipse. Eclipse will ask you to choose your workspace.
This is the folder where Eclipse will save all your code and project settings.

Add the installed Java JDK:
Click on Window -> Preferences
Navigate to Java -> Installed JREs
If your preferred JDK is not listed or the list is empty, click [Add],  Select "Continue with Standard VM" -> [Next] and select [Directory] to choose your JDK install directory.
Usually this is something like C:\Program Files\Java\jdk1.8.0_202 (for Windows)

Select your preferred JDK and click on [Apply and close]


Install Subclipse

  1. Click on [Help] -> [Eclipse Marketplace...]
  2. Search for Subclipse and click the [Install] button on the right side.
  3. Do not modify preselected features and click on [Confirm]
  4. Read- and agree to TOS -> [Finish]
  5. In case you get a prompt "Do you trust unsigned content of unknown origin", hit the checkbox in the "Type" column and click on "Trust selected".
    If you want you can manually check the sources in beforehand for trustworthiness.
  6. Restart Eclipse once it prompts you to do so.

Setup projects

  1. Choose Menu →[File]→[New]→[Project] (Not 'Java-Project')
  2. Choose [Checkout Project from SVN] and click [Next]. Choose „Create new respository location“ in the next screen.
  3. Enter the first project svn url: svn://svn.appwork.org/utils
  4. Confirm checking out the root of that reepository if Eclipse asks you:
  5. Click [Finish] and Approve all question dialogs with [Yes] or [OK]. Eclipse will download and set up the project now.
    Close the Welcome Screen to see the first project.

Note:
When adding the SVN repository, you should see a progress indicator in the bottom right corner of Eclipse. If you get an error at this point, do not see a directory structure under the SVN container, or if you are stuck at 0% this is most likely due to not having proper permissions on your firewall.
Add all outgoing ports (0:65535) on your firewall to IP addresses of svn.jdownloader.org and svn.appwork.org (or whitelist domains) and try the previous steps again.

After checking out the first project, your Eclipse window should look similar to the following screenshot:

Now repeat these steps with:

  • svn://svn.jdownloader.org/jdownloader/browser
  • svn://svn.jdownloader.org/jdownloader/trunk
  • svn://svn.jdownloader.org/jdownloader/MyJDownloaderClient

Run JDownloader

In Eclipse's Package Explorer tab, expand the "JDownloader" project and navigate to:
Downloader/src.org.jdownloader.startup
Find the file Main.java , right-click on it -> Run as -> Java Application
The first start may take some time.
You may now test out the latest developer build of JDownloader and familiarize yourself with the code.

Optional:

If you want you can modify Program arguments and VM arguments as follows:
Find the file Main.java , right-click on it, select Run As -> Run Configuration -> Doubleclick on "Java Application"
A Run Configurations menu will open.


Configuring AppWork Code Formatter

In order to keep code layouts the same between the different contributors IDE setups, we prefer all commits be made using our code formatter.

  1. Go to Window -> Preferences -> Java -> Code Style -> Formatter and click on "Import"
  2. Select the file located under: [YourEclipseWorkspace]/AppWorkUtils/ide/eclipse/eclipse_format_file.xml
    Click on [Open], then hit [Apply and Close]


How to debug a jar file in eclipse

  1. Start JDownloader with the following additional parameters:
    java -Xmx512m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=y -jar JDownloader.jar
  2. Open Eclipse:
    Debug Configurations→Remote Java Application.
    Select JDownloader project and port 8000 and start debugging.

How can I upload/commit/write my changes?

To upload to your code server, you need write access. Basically, everybody can get write access.

To get write access, please write an E-Mail with the following content to support@jdownloader.org:
Username (Your code will be published under this name)
Allowance to relicense your commits. Example:
Herby I allow AppWork GmbH, Schwabacher Straße 117, 90763 Fürth, to re-license my (as user '<YOUR USERNAME>') commits to the JDownloader Code Server (svn.jdownloader.org).
Re-licensing, in this case, means modifying and distributing my changes under a new license.


Known Problems

Synthetica License Warning each time after JDownloader is started

Indeed if this happens, the Synthetica License is missing.
Here are two possible solutions:

  1. In JDownloader go to Settings -> Advanced Settings -> Search for GraphicalUserInterfaceSettings.lookandfeeltheme -> Change the value in column "Value" to FLATLAF_LIGHT and restart JDownloader.
  2. Close JDownloader. Navigate to your JDownloader working dir .jd_home, start JDownloader one time outside your IDE by doubleclicking JDownloader.jar.
    Let it update itself and close it again.
    Once done, you should not get the warning again when starting JDownloader in your IDE.



Attachments 
 
 IDE_Select_Workspace.png (14.50 KB)
 Choose_JDK.png (33.32 KB)
 Subclipse_install_1.png (74.90 KB)
 Subclipse_install_2.png (24.31 KB)
 Subclipse_install_3.png (30.14 KB)
 SVN_Checkout_1.png (29.81 KB)
 SVN_Checkout_2.png (35.02 KB)
 SVN_Checkout_3.png (24.34 KB)
 SVN_Checkout_4.png (23.64 KB)
 SVN_Checkout_5.png (37.06 KB)
 SVN_Checkout_6.png (42.36 KB)
 Troubleshooting_Synthetica_License_Waning.png (8.50 KB)
 preference_formatter_01.png (27.05 KB)
 preference_formatter_02.png (29.02 KB)
 preference_formatter_03.png (25.28 KB)
 IDE_Select_JDK_1.png (47.21 KB)
 IDE_Select_JDK_2.png (38.21 KB)
(2 vote(s))
Helpful
Not helpful