AEM - Issue while executing java class from Bracket IDE editor

arunk85184451

29-10-2019

Can anyone please help.

i have created a training project package and imported in Brackets IDE , synchronization is sucessfull to AEM and i am able to export back to AEM.

all statement is executing except java class , i am not seeing any error also.

AEMhtmlpreview.PNGHTML AEM UI Page

JAVA Class file

javaclass.PNGJAVA CLass file

HTML File

htmlpage.PNG

Accepted Solutions (1)

Accepted Solutions (1)

aemmarc

Employee

30-10-2019

... Did you compile the code?

It doesn't look like it.

From the screenshot -- on the left side in the structure pane -- you can't just put .java files inside the content repository and expect it to run. That's not how this works.  Java source needs to be compiled into its CLASS file and those are all magically assembled into a JAR file (an executable program) that adheres to the OSGI specification so it can run inside AEM.

Your Java code needs to be in an AEM maven project and compiled into a deployable artefact.

Start here : GitHub - adobe/aem-project-archetype: Maven template to create new Adobe Experience Manager (AEM) pr...

The WKND Tutorial is also a good resource to understand how to develop in AEM.

WKND Tutorial Overview

Answers (6)

Answers (6)

Arun_Patidar

MVP

03-11-2019

There is an issue with your HTL code.

Please refer below for correct code -

<div data-sly-use.logic="${'Logic' @value1='Adobe', value2='Systems'}">${logic.message}</div>

arunk85184451

31-10-2019

thanks arpit

yes i can see the same its getting exported correctly from Bracket to AEM

1849304_pastedImage_0.png

the moment i give the java class reference in html component of the page i.e it displays the output before the java class reference and stops

1849306_pastedImage_2.png

1849305_pastedImage_1.png

any help on this to debug will be helpful

thanks

arpitv27529355

30-10-2019

Hi arunk85184451

I have checked this using aem bracket plugin. I can properly see Java classes in Sync status of bracket.PFB the screenshot

Screen Shot 2019-10-31 at 12.03.36 AM.png

Could you please check it again making sure to use the latest version of Bracket and AEM plugin?

Regards,

Arpit Varshney

aemmarc

Employee

30-10-2019

Actually I'm going to correct myself as I believe you can have Java classes that extend WCMUsePojo within the content repository.