There was a problem loading the comments.

Setup IDE Eclipse

Support Portal  »  Knowledgebase  »  Viewing Article


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:


Run JDownloader

1. In Eclipse's Package Explorer tab, expand the "JDownloader" project and navigate to:
JDownloader/src.org.jdownloader.startup
2. Find the file Main.java , right-click on it -> Run as -> Run Configurations... -> Switch to tab "Arguments" and enter the following lines into field "VM arguments":

--add-exports=java.desktop/sun.swing=ALL-UNNAMED
--add-exports=java.desktop/sun.swing.table=ALL-UNNAMED
--add-exports=java.desktop/sun.swing.plaf.synth=ALL-UNNAMED
--add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED
--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED
--add-opens=java.desktop/javax.swing=ALL-UNNAMED
--add-opens=java.desktop/javax.swing.tree=ALL-UNNAMED
--add-opens=java.desktop/java.awt.event=ALL-UNNAMED
--add-exports=java.desktop/sun.awt.shell=ALL-UNNAMED
--add-exports=java.base/sun.security.action=ALL-UNNAMED
--add-exports=java.desktop/com.sun.awt=ALL-UNNAMED

Technical background if you're interested:

https://www.jyloo.com/synthetica/faq/

-> See "I'm getting an IllegalAccessError or illegal reflective access warning - what's going wrong?"

3. Right-click on it again -> 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.


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, Spalter Straße 58, 91183 Abenberg, 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 / Troubleshooting

Synthetica License Warning each time after JDownloader is started

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

Solution 1

  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. Find your working dir .jd_home. If you don't know where it is, simply find it as described here.
  3. Close JDownloader.
    Navigate to your JDownloader and navigate to you .jd_home working directory, start JDownloader one time outside your IDE by doubleclicking JDownloader.jar.
  4. Let it update itself and close it again.
    Once done, you should not get the warning anymore when starting JDownloader in your IDE.

Solution 2

If you have a stable JDownloader installed, you can copy the "licenses" folder from that existing installation into your .jd_home folder containing the files compiled by Eclipse.


Related Articles


On-Premise Help Desk Software by SupportPal