Solved

Cannot find Main Class in Eclipse

Posted on 2009-05-13
13
3,472 Views
Last Modified: 2013-12-18
1.      I am using Eclipse 3.4.2, Oracle Thin Client OC4J Standalone Server 10.1.3.n
2.      I right-click my project (a Dynamic Web Application with .jsp and java classes)
3.      I select Run As/Run On Server
4.      I choose an existing server localhost/Oracle OC4J Standalone Server 10.1.3.n at local host
5.      I click Next
6.      I see that the project is in Configured projects
7.      I click Finish

I get the message from Java Virtual Machine Launcher. "Could not find the main class. Program will exit."

I have googled and looked on Experts-Exchange but to no avail.

When I go to Properties, Java Build Path I see the error Project X cannot reference itself  It seems probable that this is part of the problem&
0
Comment
Question by:gordontm
  • 7
  • 6
13 Comments
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24380880
Are you able to start the server from the Eclipse "Servers" window without any deployed web application? This sounds like you haven't a correctly configured server descriptor as far as Eclipse is concerned.

Is this an OC4J specific project, or is it standard Java web app that you can try to deploy in Tomcat?
0
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 250 total points
ID: 24381072
Try this in Eclipse

1) Download the latest standalone OC4J, unzip to C:\OC4J

http://www.oracle.com/technology/software/products/ias/htdocs/utilsoft.html

2) In Eclipse: Window -> Preferences -> Server -> Runtime Environments -> Add
Choose Oracle -> Oracle OC4J Standalone 10.1.3.n -> Next
Choose Default JRE
For the OC4J J2EE home, use browse to C:\OC4J\j2ee\home

3) In Server's tab, right clock, New -> Server, choose Oracle OC4J Standalone 10.1.3.n, add the project,

Before starting from Eclipse, start from command line:

set OC4J_HOME=C:\oc4j\j2ee\home
set ORACLE_HOME=C:\oc4j
set JAVA_HOME=... path to your JDK...

cd \oc4j\bin
oc4j -start

Enter your new admin password ("admin")
Then CTRL-C to shutdown

Then go to Eclipse and start the OC4J from the Server's tab, if that works, then move on to attempt to deploy a web app to it. This works for me except I have not deployed an app to the container.


Other references that might help:
http://wiki.eclipse.org/EclipseLink/Examples/JPA/OC4J_Web_Tutorial
0
 
LVL 2

Author Comment

by:gordontm
ID: 24384227
Hi mrjoltcola

Thank you very much for replying and for your very detailed instructions!

I am following your instructions dilligently and am in step 3.

However there are all sorts of .jars that are missing from the classpath.  I have copied and pasted about twenty so far, but now I am stuck.  

Eclipse asks for  Missing classpath entry C:\oracle\oc4j10.1.3.4\j2ee\home\..\..\lib\xmlparserv2.jar
and unfortunately it doesn't specify what the directories are between home and lib, but just writes \...\...

I have tried to google "default directory xmlparserv2.jar" but I do not seem to be able to know where to put xmlparserv2.jar

Do you have any ideas?


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24384340
Were you able to create an OC4J server in step 2, using the 10.1.3.n ? You browsed to the correct directory?

You should not need to copy any jars to setup the server with Eclipse Ganymede, I did it with no add-ins.

What JDK/JRE have you installed?

Perhaps also moving this to the Java zone would help.
0
 
LVL 2

Author Comment

by:gordontm
ID: 24384438
1. Hi. See the first picture.  When I press [Next] I get the second picture
2. Please note I still have the problem "Project 'X' cannot reference itself".  Maybe this is part of the problem
3. JDK is either j2sdk1.4.2_12 or j2sdk1.4.2_13 or j2sdk1.4.2_05.  [I am a little confused about this last point]

Thanks very much!



step1.jpg
step2.jpg
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24384535
I recommend installing a 1.5 JDK (since OC4J claims it can support 1.4.2 or 5.0)
I am using Java 5 and 6, haven't used 1.4 in yrs.

Try configuring the new JDK as your standard Eclipse JDK, then try it all over.
0
 
LVL 2

Author Comment

by:gordontm
ID: 24384944
I have downloaded jdk-1_5_0_18-windows-amd64.exe
[I will be unable to use this in the long term because the live application using 1.4] but I will try here locally on my laptop to see if I can get it working.

I right-clicked the JRE System Library [j2sdk1.4.2_12] and tried to change it to alternate JRE / JRE1.6.05 but it complains that "Application of the classpath container changes failed. Project "X' can not reference itself."



0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24385096
JRE 1.6 is Java 6, not 5, so you have 3 versions in your environment you area dealing with.

Sorry, I have no other suggestions. I only use Java 5 & 6, and really don't use OC4J much anymore either. I recommend posting to Java zone as well, you can add the zone to your question.
0
 
LVL 2

Author Comment

by:gordontm
ID: 24385164
Thank you very much for trying mrjoltcola.  Thank you for your suggestion about java zone. I will try and move it.
0
 
LVL 2

Author Closing Comment

by:gordontm
ID: 31580944
Hi mrjoltcola.  I managed to follow all your instructions.
Basically the problem was that somehow my project referenced itself in the Web App Folders. Once I got rid of this, then everything was a breeze.

I will now give you the points as you answered my question!.  However the application is still not working... When I go to Servers, the application is started  (see picture below) but when I go to http://localhost:8888/charm/  it doesn't work.  I will open another question, could you have a look at it?

http://www.experts-exchange.com/index.jsp?qid=24408753
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24385697
Make sure to post in Java, Eclipse and Web app servers if possible. Post a link back to this one in case anyone needs some background. Not being an OC4J guru, I probably cannot help much more except to just try it myself. I will look in on the question and contribute if possible.

0
 
LVL 2

Author Comment

by:gordontm
ID: 24385772
OK. Thanks for advice.
I put it in Java, Eclipse and Oracle [before reading your comment]
If no-one answers I will ask an administrator to move it to Web App. [its not possible to move once zones have been assigned]
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24385945
Use request attention for an admin's help
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question