Error: Could not find or load main class. when running a Talend Job

Moderator

Re: Error: Could not find or load main class. when running a Talend Job

Hi Philippe,
Are you using JDK 1.8? For version 6.2, have you already checked documents about:TalendHelpCenter:Compatible+Java+environments and TalendHelpCenter:Compatible+Operating+Systems?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
One Star

Re: Error: Could not find or load main class. when running a Talend Job

Hi,
I have Jave 1.8 Rev 77, and have just update to Rev 91. I'll tell you if this solves my problems.
I am with Windows 7 64bits, so I should be covered from this side.
Best regards,
Philippe.
Moderator

Re: Error: Could not find or load main class. when running a Talend Job

Hi Philippe,
Let us know if it solve your problem.
In addition, is there any more error message? Which is located in /workspace/.metadata/.log
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: Error: Could not find or load main class. when running a Talend Job

Hi,
I have run into the similar problem with the Error of "Could not find or load main class" to run a test job in the run job tab. The job contains a tJava component to call System.out.println("Test").
My environment is as follows:
- Talend Studio 6.1.1
- Java 1.8.0_77
- CentOS 6.7

The following warning message was shown in /opt/Talend-6.1.1/studio/workspace/.metadata/.log:
WARN  org.talend.commons.exception.CommonExceptionHandler  - org.eclipse.core.runtime.CoreException:
Parent of resource: /opt/Talend-6.1.1/studio/workspace/.Java/src/main/java/routines/DataOperation.java is marked as read-only.
...

I have installed the Talend Studio as root on CentOS but attempted to run jobs as a non-root user.
In this case, changing the file permission to run "chown -R talend:talend workspace/.Java" has resolved the problem.
Thank you,
Moderator

Re: Error: Could not find or load main class. when running a Talend Job

Hi,
I have installed the Talend Studio as root on CentOS but attempted to run jobs as a non-root user.
In this case, changing the file permission to run "chown -R talend:talend workspace/.Java" has resolved the problem.

Thanks for sharing your solution with us.
let us know if there is any further help we can give.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Error: Could not find or load main class. when running a Talend Job

I ran into the same problem because of the space in my installation path "C:\Program Files\...".
Will this bug ever be fixed someday?
Moderator

Re: Error: Could not find or load main class. when running a Talend Job

Hi,
because of the space in my installation path "C:\Program Files\...".

Actually, it's not a bug.
It is recommended to avoid spaces and long names in the target installation directory path when you install talend studio in your machine.
Here is a online document about:TalendHelpCenter?Downloading+and+installing+Talend+Studio
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Error: Could not find or load main class. when running a Talend Job

Hello,
I am getting this error message too. Could someone please help me?
I downloaded Talend-Studio-20160704_1411-V6.2.1.zip, unzipped it to /Users/ericbelfortmattos/Desktop/Talend/Talend-Studio-20160704_1411-V6.2.1 and tried running running the Talend Studio by double-clicking Talend-Studio-macosx-cocoa.app on Finder. That did not work. I got an error message that says "The Talend-Studio-macosx-cocoa executable launcher was unable to locate its companion shared library.", so I right clicked Talend-Studio-macosx-cocoa.app and chose "Show Package Contents", found the executable file "Talend-Studio-macosx-cocoa" under Contents\MacOS and double-clicked it. This brought up the Talend Studio; however, when I try and run the OnBoardingDemoJob I get the error message "Could not find or load main class". I also tried creating a job of my own, but I got the same error message when tried to run it.
Java seams to be installed correctly as running "java -version" in terminal returns this:
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

echo $JAVA_HOME returns:
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
echo $JRE_HOME returns:
/usr/local/jdk
Under Preferences-->JAVA-->Installed JREs in Talend Studio, there is only one installed JRE: Home (default). The location is /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
Please let me know if there is any other information that I need to provide so you can help me.
Thank you.
Moderator

Re: Error: Could not find or load main class. when running a Talend Job

Hi ericbelfort,
What's the mac version you are using?
Have you already checked document about:TalendHelpCenter:Compatible+Operating+Systems to see if  you are on a compatible platform?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Error: Could not find or load main class. when running a Talend Job

Hi Sabrina,
Thank you for the quick reply. I have the latest version of Apple's OS: macOS Sierra (Version 10.12). This is the same version that my colleague is using and it is working on his machine.
Best regards,
Eric
One Star

Re: Error: Could not find or load main class. when running a Talend Job

Hi Sabrina,
I found out what was causing the problem. I had a symbolic link to a jar under /Library/Java/Extensions. I am guessing that symbolic link was broken (as in pointing to a file that was not there anymore). Once I deleted the symbolic link, I stopped getting that "Could not find or load main class" error message.
If you allow me some constructive criticism, this error message is too generic to help anyone figure out how to solve the issue. It was only after trying many things without success, a lost day of work and much frustration that, while poking around aimlessly, I stumbled upon further error messages under the "Problems" tab. It was following that lead that I decided to delete the symbolic link to test wether this could be what was preventing Talend from "loading the main class".
At the very least, I would recommend complementing that error message to indicate that the user should review the "Problems" tab to check for underlying problems that may be preventing Talend from "loading the main class".
I hope this helps other people.
Best regards,
Eric
Moderator

Re: Error: Could not find or load main class. when running a Talend Job

Hi ericbelfort,
Thanks for your suggestion and prompt reply. So far,  macOS Sierra (Version 10.12) is not list on the supported compatible platform.
In the documentation we provide a list of platforms that are supported, in the sense that we do provide an SLA and technical support for them. This doesn't mean other (non-listed) platforms will not work but simply we won't necessarily be equipped to help you with any issue you may face with them.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: Error: Could not find or load main class. when running a Talend Job

I have not made a lot of research but find out that after modifying the *run.sh file error has gone. Changes applied:
- comment out line
# cd `dirname $0`

- add line
cd `dirname -- "$0"`

os: centos 7.2
Talend open studio 6.3.1
Same thing can be achieved by modifying the build process:

Error was spotted by running  cd `dirname $0` which resulted in an error.
Five Stars

Re: Error: Could not find or load main class. when running a Talend Job

Hello Sabrina,

 

I am getting the same error : "Error: Could not find or load main class" while running job with MSSQL server as input.

 

Talend version is 6.3.1 and i have Java 8 installed on my PC using Talend open studio for DI.

The job is very simple to pull records from source table to a excel file.

 

I have the environment variable JAVA_HOME is set the right java 8 path.

 

 

Can you please help/guide on this to resolve the issue. Let me know if you have any more queries

 

Thanks,

Shobhit

Moderator

Re: Error: Could not find or load main class. when running a Talend Job

Hello,

What does your installation path look like? Please make sure that you install product in a short path without any special characters, such as blank space.
You cannot change the installation path but you can re-install talend production.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Three Stars

Re: Error: Could not find or load main class. when running a Talend Job

Yep - we have same message in our test env ...    dev and prod running fine ..

Job runs fine in Studio but not when deployed via TAC.   Existing jobs in test env TAC work .. (until I do a generate on them)

I can even run in studio on the remote job server where it fails in TAC.

 

A previous staff member said it was revolved 2 years ago when it occured .. " there was an orphan ID " ...

 

I am not sure what he meant by "Orphan ID" however ..

 

Moderator

Re: Error: Could not find or load main class. when running a Talend Job

Hello Philippe,

Are you using JDK 1.8?

With your subscription solution, have you already created a case  on talend support portal? In this way, we can give you a remote assistance through support cycle with priority.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Error: Could not find or load main class. when running a Talend Job

Hi Folks,

 

I had similar problem yesterday. I got the error Could not find or load main class ***

But realized that this was happening to all jobs which were working fine before.

 

After some research I realized I had re-organized my jar files and some of those were being referenced in the project.

 

So a quick check is to see if this affects only the new job or is affecting existing jobs.

 

Please check it once and make sure if your jars for jdbc or other job specific addon jars havent changed location.

 

Regards

AD 

Four Stars

Re: Error: Could not find or load main class. when running a Talend Job

Hi,

 

I have exactly the same issue.

My Job is working fine in TOS but when building the JOB and extracting the Zip on the same computer, I run the batch file and get the following: Error: Could not find or load main class

 

I am on Windows 10, when doing java-version I get the following:

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

 

This is how I defined my Env. Variables:

JAVA_HOME = C:\Program Files\Java\jre1.8.0_181

Path = C:\Program Files\Java\jdk1.8.0_181\bin

CLASSPATH = %JAVA_HOME%\jre\lib\rt.jar;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar

 

I have tried playing with variables, re-exporting but without success.

 

Please help... Smiley Sad

 

 

 

Moderator

Re: Error: Could not find or load main class. when running a Talend Job

Hello @elieprz

Does this issue repro on all your jobs or a specific one?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: Error: Could not find or load main class. when running a Talend Job

I have finally solved the issue.
This was ha penning for all exported jobs.

The issue was because of the path of the bat file containing a space. Just moved the whole folder to C:/ folder.

Honestly I don't understand why it is an issue, if it is a valid path for windows it should be the same for the talend job.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog