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

I have the same issue with our dev environment. I get error Error: Could not find or load main class. Take note, that it works in our pre-prod environment and setup is identical.
Things to note:
1. Talend is installed in linux machine with no spaces in directory path at all.
2. Talend is root user so it has access to all files.
3. if we contact support most likely it will send us through this forum.
Thanks,
David

44 REPLIES
Seventeen Stars

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

Where do you get this error? On your studio or on the Jobserver?
If you have a support subscription you should use it!
Moderator

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

Hi,
Make sure your jdk environment is totally correct.(java -version classpath=.;%JAVA_HOME%\jre\lib\rt.jar;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jarSmiley Wink.
Does this issue appear when run a specific job or all jobs? or server not studio? Please give us more information about your current job situation.
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 have the same issue with our dev environment. I get error "Error: Could not find or load main class."
I would like to schedule my job but this issue appears when running the exported job.
T need your help please.
Community Manager

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

Same as asked previously by xdshi and jlolling, we need more information about your setup and environment.
Confirm you made the checks suggested by xdshi above.
what version of talend do you have? do you get it when running the job within the studio? have you exported all dependencies you needed?
Provide as much information as you can.
One Star

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

Firt I confirm that i made the checks suggested by xdshi.
The version of talend is:
Version: 5.4.1
Build id: r111943-20131212-1133
I don't get this issue when running the job on the studio, it works very well. But after exporting the job and all the dependencies i tried to run the batch file but it doesn't work.


Microsoft Windows
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\hh>java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
C:\Users\hh>F:\Tranfert\transfert_0.1\transfert_0.1\transfert\transfert_run.bat
C:\Users\hh>F:
F:\>cd F:\Tranfert\transfert_0.1\transfert_0.1\transfert\
F:\Tranfert\transfert_0.1\transfert_0.1\transfert>java -Xms256M -Xmx1024M -cp cl
asspath.jar; optimbo.transfert_0_1.transfert --context=Default
Error: Could not find or load main class optimbo.transfert_0_1.transfert
Moderator

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

Hi,
So far, there is no support for Java 8 in talend
Please have a look at KB article about TalendHelpCenter:https://help.talend.com/display/KB/Java+8+Support.
Could you please downgrade your jdk 1.8 into jdk 1.7 or 1.6 to see if this issue repro?
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,
I downgraded java 1.8 into 1.6 anad i got this error:



Microsoft Windows
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\niba>F:\Tranfert\Direct_debit_transfert_Copy_0.1\Direct_debit_transfert
_Copy_0.1\Direct_debit_transfert_Copy\Direct_debit_transfert_Copy_run.bat
C:\Users\niba>F:
F:\>cd F:\Tranfert\Direct_debit_transfert_Copy_0.1\Direct_debit_transfert_Copy_0
.1\Direct_debit_transfert_Copy\
F:\Tranfert\Direct_debit_transfert_Copy_0.1\Direct_debit_transfert_Copy_0.1\Dire
ct_debit_transfert_Copy>java -Xms256M -Xmx1024M -cp classpath.jar; optimbo.direc
t_debit_transfert_copy_0_1.Direct_debit_transfert_Copy --context=Default
Exception in thread "main" java.lang.NoClassDefFoundError: optimbo/direct_debit_
transfert_copy_0_1/Direct_debit_transfert_Copy
Caused by: java.lang.ClassNotFoundException: optimbo.direct_debit_transfert_copy
_0_1.Direct_debit_transfert_Copy
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: optimbo.direct_debit_transfert_copy_0_1.Direct_de
bit_transfert_Copy. Program will exit.
F:\Tranfert\Direct_debit_transfert_Copy_0.1\Direct_debit_transfert_Copy_0.1\Direct_debit_transfert_Copy>
Moderator

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

Hi,
Make sure your jdk version is jdk 1.6
C:\Users\hh>java -version
java version "1.6"
Is there any extra space or illegal character in your installation path? Have you already checked online document TalendHelpCenter:Installation+requirements to set your Environment variable?
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 i have the same problem , and i run the command that you suggested 
# java -version  classpath=.;%JAVA_HOME%\jre\lib\rt.jar;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) Client VM (build 23.1-b03, mixed mode, sharing)
bash: fg: %JAVA_HOME%jrelibrt.jar: no such job
bash: fg: %JAVA_HOME%libdt.jar: no such job
bash: fg: %JAVA_HOME%libtools.jar: no such job
You have new mail in /var/spool/mail/root

what i need to do in my case?
thanks a lot,
Shani.
Moderator

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

Hi shanshan,
Here is a response in your another topic:http://www.talendforge.org/forum/viewtopic.php?id=38274
Could you please have a look at it?
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,
It also give me this error when running job. How can I get jdk 1.6? I cannot find it in google. 
Please help.
Lex
Moderator

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

Hi Lex,
You can get oracle JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html.
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,
I am getting this error for all jobs in talend studio whenever I tries to run any job.
I am using java 7 version.
"Error: Could not find or load main class "
Moderator

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

Hi Smita B,

The error "Could not find or load main class" is usually caused the blank space in the installation path. Could you please take a look at it?

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 
Would just like to find out if this has been resolved, before logging a bug.
Getting the same "Could not find or load main class" when running a job on TAC, as a schedule on a job server. It does not happen all the time only at random times. All jobs runs fine on studio java is setup right and no spaces in installation directory.
Regards,
Stephan
One Star

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

Hi,
Running into the same problem as above: 'Error: Could not find or load main class'
I have Java 1.8 and to run Talend Studio I'm using this hack:
I runs the studio, I'm able to connect to Salesforce source and import objects. The problem starts when I try to run the job (inside Talend Studio).
Any suggestions? Unfortunatelly I can't downgrade java.
Regards,
Daniel
One Star

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

slaugHi,
Running into the same problem as above: 'Error: Could not find or load main class'
I have Java 1.8 and to run Talend Studio I'm using this hack:
I runs the studio, I'm able to connect to Salesforce source and import objects. The problem starts when I try to run the job (inside Talend Studio).
Any suggestions? Unfortunatelly I can't downgrade java.
Regards,
Daniel

Just to add more details, this is how I run Talend Studio:
C:\TOS\TOS_DI-Win32-20141207_1530-V5.6.1\TOS_DI-win32-x86.exe -vm "C:\Program Files (x86)\Java\jre1.7.0_51\bin"
So you can see the installation path and java vm which I am using.
Seventeen Stars

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

Too many time gone, but still interesting
I have this error, when generate Job in folder outside Open Studio folders, like:
The same Job (manual copy) in:
- /Volumes/VM/TOS/OpenStudioDI_xxx/Jobs - work fine
- /Volumes/VM/Data/Jobs - file, with error - Error: Could not find or load main class.
no change in PATH or anything also, 
Java in PATH, JRE also
Moderator

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

Hi,
- /Volumes/VM/TOS/OpenStudioDI_xxx/Jobs - work fine
- /Volumes/VM/Data/Jobs - file, with error - Error: Could not find or load main class.
The blank space in the installation path probably cause  the error "Could not find or load main class".
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,
         I have installed JDK 1.8.45 and TOS 6.0.
When i try to run the jobs created by me or the demo jobs I get the below error..
Error: Could not find or load main class demo.t05_filelookup_0_1.t05_FileLookup
Thanks..
One Star

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

Hi,
         I have installed JDK 1.8.45 and TOS 6.0.
When i try to run the jobs created by me or the demo jobs I get the below error..
Error: Could not find or load main class demo.t05_filelookup_0_1.t05_FileLookup
Thanks..

Hi, I have the same configuration, and also gives me the error, TOS-DI-5.5.1 works perfect, but the version 6 gives me error in the main class
One Star

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

Hi , 
I have the same error , I am using Talend 6 and java 8 . This worked for me on before I formatted my comp so I am not sure it is java version issue .I would like to have help on that . 
Thanks 
Community Manager

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

Hi
Can you first confirm that your installation path of v6 does not contain any space character as previously noted in this thread?
Elisa
One Star

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

It does not . 
Liana
Moderator

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

Hi guys,
Could not find or load main class

Did you get this issue when running a job?
Are you using proxy setting? Could you please take a look at a related forum:https://www.talendforge.org/forum/viewtopic.php?id=45327(Could not find or load main class) to see if this solution works for you?

Java JDK 1.8 installed.
JAVA_HOME is set to the \jre directory. Run "echo %JAVA_HOME%" in a cmd prompt (assuming you're on Windows) to confirm this. Just run "echo JAVA_HOME" if you're on Linux.
This is an example of my maven_user_settings.xml file (with the proxy address and port changed).  However as you are getting Talend to start this may not be your problem.


xmlns:xsi=""
xsi:schemaLocation=" ">


true
http
proxy.mynetwork.local
3000




Your feedback will be appreciated.
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

Have you checked if the Java version on your client PC is the same as the version on the remote server?
One Star

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

Hi ,I am using Talend open studio for esb and facing similar issues.My workspace path does not have any spaces and java class path is also properly set.Some simple dummy jobs like tmsgbox are running without any error but for jobs such as lookups etc the error comes
error:could not find or load main class
please help me resolve the issue.
One Star

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

Hi,
It happens to me too since I have upgraded to Talend 6.2.0
In my case, it is not a problem that occur every time. If it happens, I close the job, open it again and most of the time it will work without doing anything more...
I don't recall this weird behavior with Talend 6.1 ...
One Star

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

Hi,
This behavior is really annoying as most of the time I have to try and run my jobs several times before succeeding. 
Any solution ?
Thanks,
Philippe.