Weblogic not finding javax.naming classes when instantiating bean
Hello,
I am developing a JSP which contains a JavaBean.
This bean is a wrapper for a session EJB, the getProperty() methods in
the bean call methods on the EJB's remote interface.
I have tested this bean as a stand alone application by adding a
main(String[] args) method to it and it works.
However, when adding the bean to the JSP, the JSP does not show in the
browser, I get a n internal server error 500 instead.
It seems that Weblogic is not finding the javax.naming.NamingException
class when instantiating the bean.
When looking at the weblogic log, I see the following stack trace:
Fri Aug 18 15:12:06 EDT 2000:<E> <ServletContext-General> Servlet failed
with Exception
java.lang.NoClassDefFoundError: javax/naming/NamingException
at java.lang.ClassLoader.resolveClass0(Native Method)
at java.lang.ClassLoader.resolveClass(ClassLoader.java:579)
at
weblogic.utils.classloaders.GenericClassLoader.reallyLoadClass(GenericClassLoader.java,
Compiled Code)
at
weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java,
Compiled Code)
at
weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java,
Compiled Code)
at java.beans.Beans.instantiate(Beans.java:194)
at java.beans.Beans.instantiate(Beans.java:55)
at weblogic.servlet.jsp.JspLexer.processBeanTag(JspLexer.java:1138)
at weblogic.servlet.jsp.JspLexer.mXML_OPEN_USEBEAN(JspLexer.java,
Compiled Code)
at weblogic.servlet.jsp.JspLexer.mXML_THING(JspLexer.java:1554)
at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java, Compiled Code)
at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java, Compiled
Code)
at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java, Compiled Code)
at weblogic.servlet.jsp.JspParser.doit(JspParser.java, Compiled Code)
at weblogic.servlet.jsp.JspParser.parse(JspParser.java:116)
at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:97)
at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java,
Compiled Code)
at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java, Compiled
Code)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:173)
at weblogic.servlet.jsp.JspStub.checkForReload(JspStub.java:92)
at
weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:191)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:118)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:744)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:692)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:251)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:363)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
Any idea on how to fix this?
Thanks for any help,
David
yes, weblogicaux.jar is definitely in the weblogic.class.path. i've even tried starting the server from the command line, declaring the classes there. my "trade.xml" document has the URI set as "http://localhost:7001/BizTalkServer". when i enter this on the "BizClient.jsp" form, i get the error discussed below. however, if i enter "http://localhost:7001", even though this is not the explicit location of the BizTalk server, the server returns:
Thank you! Your trade has been recieved. A BizTalk document has been sent to http://localhost:7001/ with the following information: etc...............
So there appears to be something wrong with the "/BizTalkServer" setup on my machine. Any ideas?
Kumar Allamraju <[email protected]> wrote:
>Make sure weblogicaux.jar is in your weblogic.class.path
>
>i.e -Dweblogic.class.path=$WL_HOME/lib/weblogicaux.jar:$WL_HOME/classes etc etc...
>
>--
>Kumar
>
>Mike Bachers wrote:
>
>> I'm currently struggling with a similar problem, although as a newcomer to WL I'm having some trouble figuring it out. I'm trying to run the BizTalk server example (http://www.weblogic.com/docs51/examples/xml/biztalk/index.html) under Windows 2000 and JDK1.2.2. I'm able to proceed without problems until I submit the form on the "BizClient.jsp" page. At this point, I receive this error:
>> ------------------------------------------------
>> There was a problem connecting to the BizTalk server. Exception caught: java.io.FileNotFoundException: Response: '500' for url: 'http://localhost:7001/BizTalkServer'
>> ------------------------------------------------
>>
>> At the same time, the WL console spits this out:
>> ------------------------------------------------
>> java.lang.NoClassDefFoundError: javax/naming/NamingException
>> ....
>> ------------------------------------------------
>>
>> I know this class is in the weblogicaux.jar, and it's included in my classpath. I think David's fix (see below) is getting at my problem, too, but I'm not sure. Anyone relate?
>>
>> "David R. Heffelfinger" <[email protected]> wrote:
>> >Figured it out. The problem was that the beans were in a directory
>> >in the JAVA_CLASSPATH in weblogic.properties. Moved the directory to
>> >WEBLOGIC_CLASSPATH and the problem went away.
>> >
>> >David
>> >
>> >"David R. Heffelfinger" wrote:
>> >
>> >> Hello,
>> >>
>> >> I am developing a JSP which contains a JavaBean.
>> >> This bean is a wrapper for a session EJB, the getProperty() methods in
>> >> the bean call methods on the EJB's remote interface.
>> >>
>> >> I have tested this bean as a stand alone application by adding a
>> >> main(String[] args) method to it and it works.
>> >>
>> >> However, when adding the bean to the JSP, the JSP does not show in the
>> >> browser, I get a n internal server error 500 instead.
>> >> It seems that Weblogic is not finding the javax.naming.NamingException
>> >> class when instantiating the bean.
>> >>
>> >> When looking at the weblogic log, I see the following stack trace:
>> >>
>> >> Fri Aug 18 15:12:06 EDT 2000:<E> <ServletContext-General> Servlet failed
>> >> with Exception
>> >>
>> >> java.lang.NoClassDefFoundError: javax/naming/NamingException
>> >>
>> >> at java.lang.ClassLoader.resolveClass0(Native Method)
>> >>
>> >> at java.lang.ClassLoader.resolveClass(ClassLoader.java:579)
>> >>
>> >> at
>> >> weblogic.utils.classloaders.GenericClassLoader.reallyLoadClass(GenericClassLoader.java,
>> >> Compiled Code)
>> >>
>> >> at
>> >> weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java,
>> >> Compiled Code)
>> >>
>> >> at
>> >> weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java,
>> >> Compiled Code)
>> >>
>> >> at java.beans.Beans.instantiate(Beans.java:194)
>> >>
>> >> at java.beans.Beans.instantiate(Beans.java:55)
>> >>
>> >> at weblogic.servlet.jsp.JspLexer.processBeanTag(JspLexer.java:1138)
>> >>
>> >> at weblogic.servlet.jsp.JspLexer.mXML_OPEN_USEBEAN(JspLexer.java,
>> >> Compiled Code)
>> >>
>> >> at weblogic.servlet.jsp.JspLexer.mXML_THING(JspLexer.java:1554)
>> >>
>> >> at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java, Compiled Code)
>> >>
>> >> at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java, Compiled
>> >> Code)
>> >>
>> >> at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java, Compiled Code)
>> >>
>> >> at weblogic.servlet.jsp.JspParser.doit(JspParser.java, Compiled Code)
>> >>
>> >> at weblogic.servlet.jsp.JspParser.parse(JspParser.java:116)
>> >>
>> >> at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:97)
>> >>
>> >> at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java,
>> >> Compiled Code)
>> >>
>> >> at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java, Compiled
>> >> Code)
>> >>
>> >> at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:173)
>> >>
>> >> at weblogic.servlet.jsp.JspStub.checkForReload(JspStub.java:92)
>> >>
>> >> at
>> >> weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:191)
>> >>
>> >> at
>> >> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:118)
>> >>
>> >> at
>> >> weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:744)
>> >>
>> >> at
>> >> weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:692)
>> >>
>> >> at
>> >> weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:251)
>> >>
>> >> at
>> >> weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:363)
>> >>
>> >> at
>> >> weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
>> >>
>> >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
>> >>
>> >> Any idea on how to fix this?
>> >>
>> >> Thanks for any help,
>> >> David
>> >
>
Similar Messages
-
"Could not find the main class" when running a jar
Hi, I'm trying to create and run a jar from my application, but I can't figure out how to properly set an entry-point. Looking at the Java Tutorials http://java.sun.com/docs/books/tutorial/deployment/jar/index.html I still can't get it to work.
I have a directory myApp, which contains a directory images and some class files, including mainClass.class. I also have a manifest Manifest.txt in the directory myApp with the following line:
Main-Class: mainClass.class
+ one empty line
I create a jar successfully, while inside the myApp directory, with the following command:
jar cfm myApp.jar Manifest.txt *.class images\*.*
I then proceed to run the jar with the following command:
java -jar myApp.jar
and receive the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: myApp/class
My completely uneducated guess is that there is something wrong with my manifest. The tutorial says that the line should be:
Main-Class: MyPackage.MyClass
I'm assuming that I get the error because I didn't specify a package, which I didn't do because I didn't know what to put there. Do I even have a package?
Can anyone tell me what I've done wrong? thanks.
Message was edited by:
SmurfZGOne problem is you are specifying a file name instead of a class name. It probably should beMain-Class: mainClassA good test is to run your app before jaring it - if you run it with "java mainClass" then the Main-Class attribute must be mainClass.
Also class naming conventions say that class names should start with a capital letter - MainClass for example. It is just a convention, but it is easier to get help when you follow conventions. -
Can not find javax.ejb.CreateException when lookup and create EJB instance.
Hi,
I installed SAP CE 7.2 and NWDS 7.2. When i call create() of EJB's home interface from JAVA stand alone app to create EJB instance, the complier state that it need 'javax.ejb.CreateException'. How can i find the jar that contain 'javax.ejb.CreateException' to solve this problem?
Thank a lot,
Thongie
Edited by: Thongie on Jul 8, 2011 7:30 PMThank a lot, I can found EJB20.jar at 'usr\sap\<sid>\<instance_id>\j2ee\j2eeclient\'
-
Can not start WebLogic in Eclipse. Error: "Could not find the main class."
I have installed Eclipse 2.0 and WebLogic Server 6.1. and the WebLogc plug in from GENUITEC (and jdk1.3.1_04, on Win2K Server). After I have done the configuration, the WebLogic start/stop buttons are integried into the Eclipse Toolbar, but when I click on the start button to start Weblogic, it pops up a dialog box "Java Virtual Machine Launcher" with message: "Could not find the main class. Program will exit!"
Starting WebLogc Server from the Start panel works fine.
Does any one have seen this before or have a suggestion what I should do?
Many many thanks in advance.
HuanWeblogic must be started with a full JDK; otherwise
JSPs and dynamic EJB stubs could not be deployed. The
error message
indicates you are attempting to use a JRE. Configure
Eclipse JRE to point to a JDK. The product
documentation will help you with this process. It does not work for me. :-(
I have tried JDK 1.3.1 and 1.4.1: same result: I get a "Could not find the main class: Program will exit"
For free expert support please consider contacting
Genuitec at [email protected] If just want any
answer ask a newsgroup.
WayneI'll try the support at '[email protected]' :)
Michel
Michel Szybist
[email protected]
Fax: +33 (0)173729897
SMS: http://www.szybist.net/ -
Execute jar file: "could not find the main class" program will terminate
Hey,
I am new to Java. I have started to make a small java program which supposed to help me at my studies to lean the Dominic Memory System. I have used the latest version of Netbeans 5.5.1 to build my program in. I have two problems which I cannot figure out how to solve, please help me.
The first problem is that the java script I have made works when I compile it in Netbeans, but when I create a Jar file it does not work. I receive a pop up message in windows ?could not find the main class program will terminate? when I execute the jar file.
The second problem I have is that I need to compare the strings generated by the "numbers" and "TIP" and if the numbers is not identical the numbers in the ?Center? JPanel should be highlighted as red.
If anyone would like to clean up the code I would be pleased. I have copied quite a lot from anyone because of my one lack of knowledge.
* GoListener.java
* Created on 12. september 2007, 21:48
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package grandmaster;
import java.awt.event.*;
import javax.swing.*;
import java.util.Vector;
import java.util.StringTokenizer;
import java.awt.Color;
* @author Computer
public class GoListener implements ActionListener {
private JTextField viewer;
private JTextField TIP;
private JTextField freq;
private JTextField max_num;
private Vector numbers;
public GoListener(JTextField j,JTextField k, JTextField m, JTextField f, Vector n) {
freq = f;
max_num = m;
viewer = j;
numbers = n;
TIP = k;
public void actionPerformed(ActionEvent e){
int time = Integer.valueOf(max_num.getText());
int f = Integer.valueOf(freq.getText());
if (e.getActionCommand() == "GO") {
for (int i = 0; i< time;++i) {
int number=0;
number = (int)Math.floor(100*Math.random());
while(number>51){
number = (int)Math.floor(100*Math.random());
if(number<=9){
viewer.setText(" "+"0" + String.valueOf(number) + " ");
} else{
viewer.setText(" " + String.valueOf(number) + " ");
viewer.paintImmediately(viewer.getBounds());
numbers.add(number);
try {
Thread.sleep(f*1000);
} catch (Exception exp) {
viewer.setText(" XX ");
viewer.paintImmediately(viewer.getBounds());
if (e.getActionCommand() == "VIEW") {
try {
//int numb = Integer.valueOf( TIP.getText() ).intValue();
StringTokenizer tokenizer = new StringTokenizer(TIP.getText(), " ");
String[] split = null;
int tokenCount = tokenizer.countTokens();
if (tokenCount > 0) {
split = new String[tokenCount];
for (int current = 0; current < tokenCount; current++) {
split[current] = tokenizer.nextToken();
viewer.setText(" " + String.valueOf(numbers) + " ");
// k=numbers(1);
/*while(c<i){
String.valueOf(k).equals(split[1]);
c++;
TIP.setText(" " + split[2] + " ");
} catch (Exception exp) {
try {
//string testit = numb.toString();
//String str = "" + numb;
//viewer.setText(str);
//viewer.setText(numbers.toString());
numbers.clear();
} catch (Exception exp) {
* Main.java
* Created on 12. september 2007, 21:07
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package grandmaster;
import java.util.Vector;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.JButton;
import java.awt.*;
import grandmaster.GoListener;
* @author Computer
public class Main extends JFrame {
private JTextField viewer;
public JTextField TIP;
// private TextInputPanel TIP;
private Vector numbers;
/** Creates a new instance of Main */
public Main() {
numbers = new Vector();
JPanel p = new JPanel(new GridLayout(0,4));
JButton go = new JButton();
JButton view_num = new JButton();
go.setText("Go!");
go.setVisible(true);
go.setActionCommand("GO");
view_num.setText("VIEW");
view_num.setVisible(true);
view_num.setActionCommand("VIEW");
JTextField max_num = new JTextField();
max_num.setText("5");
JTextField freq = new JTextField();
freq.setText("1");
viewer = new JTextField();
viewer.setText("XX");
TIP = new JTextField("");
p.add(go);
p.add(max_num);
p.add(freq);
p.add(view_num);
getContentPane().add(p,BorderLayout.NORTH);
getContentPane().add(viewer,BorderLayout.CENTER);
getContentPane().add(TIP,BorderLayout.SOUTH);
setSize(200,200);
GoListener g = new GoListener(viewer,TIP,max_num, freq, numbers);
go.addActionListener(g);
view_num.addActionListener(g);
* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
Main window = new Main();
window.setVisible(true);
}NetBeans questions should be posted to the NB site. It has mailing lists and associated forums.
This tutorial from the NB site addresses running programs outside of NB
http://www.netbeans.org/kb/articles/javase-deploy.html
When you compare objects, use ".equals()" and reserve == for comparing values. -
Could not find the main class (with every jar)
This isn't a developer question. I get the error Could not find the main class with every jar I try to open (for example the jar downloaded from https://gjar.dev.java.net/ gives the same problems - and I don't think there is something wrong with that JAR). It isn't a problem with the jar or MANIFEST because the same jar works fine on my laptop. So there is something wrong with my JRE installation, but what?
I tried to remove and reinstall the JRE 6 Update 18 but that didn't work. When I run the JAR with command line java -jar "file.jar" it works fine, but if I dubbelclick on it I get the error message (and it's irritating me).
I'm a bit desperate so I hope that someone here can help me ;)
Thanks in advancedhai T.B.M ... Sorry to post here... I know that i posted my question in wrong thread..but i dont have another solution to contact with you.. I had seen your answers which are really excellent and helped to do my project..
Now i am having very less time to complete my project and i am very new to JMF.. I am not getting output in JMF video capture ..please check the code and guide me where i gone wrong.......please pardon me once again to post here.. Heres my code
import javax.media.*;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.awt.event.*;
import javax.media.protocol.*;
import java.io.*;
import javax.media.control.StreamWriterControl;
public class webcam implements ActionListener,ControllerListener
boolean eomReached = false;
boolean realized = false;
JFrame f;
BorderLayout bd1;
CaptureDeviceInfo device;
MediaLocator m1;
Player player;
Component videoScreen;
JButton b1,b2;
Processor processor;
DataSource ds=null;
DataSink fileWriter=null;
JLabel status=new JLabel("");
public webcam()
try
JFrame f=new JFrame();
JPanel p =new JPanel();
JPanel p1=new JPanel();
device=CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0");
m1=device.getLocator();
System.out.println("1");
processor.configure();
processor = Manager.createProcessor(m1);
processor.setContentDescriptor(new
FileTypeDescriptor(FileTypeDescriptor.MSVIDEO));
ds=processor.getDataOutput();
player.addControllerListener(this);
MediaLocator dest = new MediaLocator("file://foo.avi");
fileWriter = Manager.createDataSink(ds, dest);
fileWriter.open();
ds.connect();
ds.start();
player=Manager.createPlayer(m1);
player.addControllerListener(this);
blockingRealize();
videoScreen=player.getVisualComponent();
b1=new JButton("START");
b2=new JButton("STOP");
bd1=new BorderLayout();
p.setLayout(bd1);
p1.add(b1);
p1.add(b2);
p.add("South",p1);
p.add("East",videoScreen);
f.getContentPane().add(p);
f.setVisible(true);
f.setSize(500,500);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
b1.addActionListener(this);
b2.addActionListener(this);
catch(Exception e){}
public void actionPerformed(ActionEvent e)
if(e.getSource()==b1)
try{
processor.start();
player.start();
fileWriter.start();
catch(Exception e1){}
if(e.getSource()==b2)
try{
player.stop();
processor.stop();
processor.close();
fileWriter.close();
catch(Exception e2){}
public static void main(String args[])
webcam obj=new webcam();
public synchronized void blockingRealize() {
player.realize();
while (!realized) {
try {
wait();
} catch (java.lang.InterruptedException e) {
status.setText("Interrupted while waiting on realize...exiting.");
System.exit(1);
public synchronized void controllerUpdate (ControllerEvent event) {
System.out.println("myPlayer generated "+event.toString());
if (event instanceof RealizeCompleteEvent) {
realized = true;
notify();
} else if (event instanceof EndOfMediaEvent) {
eomReached = true;
} -
Could not find the main class. Program will exit!
I have created many Executable Jar files before, and this one I did the same. When I run the jar file, (Clicking on it) I get the "Could not find the main class. Program will exit!" error message. When I run the jar file through DOS I get this Stack trace:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/ControllerListener
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
Any Ideas? I did a search on google, and looks like others have had this problem but found no answer.
US101There could be several reasons for getting this "Could not find main class" error message. From your stack trace it looks like the class javax/media/ControllerListener is not in your class path. Make sure your manifest file has a line like this:
Class-Path: pathToTheJarFileWithControllerListenerClass.jar otherJars.jar
This error message is also generated whenever any static initialization errors out giving the misleading error message implying that there is something wrong with the main class. Prior to starting your main class, static initialization of any static variables takes place. In my case, I was initializing a resource bundle, and forgot to include the property file in my building of the jar file. Well this failed of course and the generic error message appeared. It took many long hours to figure out it didn't have anything to do with the manifest file or the main class itself.
HTH,
John Bender -
[Jar Executable] Could not find the main class. Progam will exit.
Hello,
I am a French person. Excuse me for my English who is not perfect.
I seek to create an achievable "jar". I followed the instructions given in the url http://java.developpez.com/faq/java/?page=execution#creationJar, and on the site of Sun.
I have today only one class which I posed in a specific repertory "Class".
Appli
|__Class
|__Src
|__META-INFThe contents of my "Manifest" is stored in repertory META-INF with the name "Commission2007.MF" and its contents are as follows:
Manifest-Version: 1.0
Created-By: 1.5.0 (Sun Microsystems Inc.)
Main-Class: Commission2007
.I've left the space line at the end of the file.
Here the result of execution of my order "jar":
C:\#Java Dev\2007_Commissionnements>jar cvfm Commission2007.jar META-INF/Commission2007.MF -C Class/ .
manifest ajout�
ajout : Class/./(entr�e = 0) (sortie = 0)(0% stock�)
ajout : Class/./Commission2007.class(entr�e = 9060) (sortie = 4547)(49% compress�s)I controlled the assignment of the extension "jar" in "Working station = > Tools = > Files Option = > Files Type = > .jar Selection = > Advance =
Open = > Change = >" C:\Program Files\Java\jre1.6.0\bin\javaw.exe "- gravel bank" %1 "% *". Thus not of problem on this side there!When I double click on the file "jar" lately created, I have the error message according to: "Could not find the main class. Progam will exit. " I do not understand the reason of this error. I consulted all the subjects on the treating Net of this subject but without result. I thus call upon you.
Perhaps that the cause is in my code which however functions perfectly when I carry out it with the order: "Commission2007 java". The class "hand" is quite present to see the code below. You can find the totality of my code on the bond http://www.developpez.net/forums/showpost.php?p=1870361&postcount=74
import �
public class Commission2007 extends Frame implements ActionListener, WindowListener
�
// Construction de la class EdText
// D�finition et affichage de la bo�te de dialogue
Commission2007()
�
// D�finition d'une frame pour l'application et affichage de la
// bo�te de dialogue
public static void main(String args[])
Commission2007 editer = new Commission2007();
editer.show();
editer.addWindowListener(editer);
}I thank you in advance for your assistance.
Cordially, Gilles.Salut,
It has been my experience that it is never a good idea to name your .MF file anything else other than MANIFEST.MF.
Try naming your .MF file MANIFEST.MF and rebuild your JAR.
Bon chance. -
Hi,
I have installed Oracle11g_win64_11gR1, Database and Client.
The issue is unable to invoke "sqldeveloper", getting the following error message. Could you please help ?
FYI. I have already downloaded and installed installed JRE and JDK.
ie. C:\Program Files (x86)\Java\jre6\ and C:\Program Files\Java\jdk1.6.0_24, still did not work.
C:\Users\oracle>java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
Let me know, if you need more information. Here is the error message.
Error Message
=========
(1) if I invoke sqldeveloper, directly from the location " C:\app\oracle\product\11.1.0\db_1\sqldeveloper\sqldeveloper\bin " using explorer, I do get error message
"Unable to find a java Virtual Machine.
To point to a location of java Virtual machine please refer to the Oracle9i JDeveloper Install Guide ( jdev/install.html)"
(2) if I invoke sqldeveloper, directly from the locationC:\app\oracle\product\11.1.0\client_1\sqldeveloper, it prompts me to enter "full path for java.exe".
When I enter full path and continue, still it continue to prompt and ask the same input.
(3) if I invoke sqldeveloper from from command prompt using the batch file "sqldeveloper.bat"
C:\Users\oracle>C:\app\oracle\product\11.1.0\client_1\sqldeveloper\sqldeveloper\
bin\sqldeveloper.bat
C:\Users\oracle>java -Xmx512M -Xverify:none -XX:JavaPriority10_To_OSPriority=10
-XX:JavaPriority9_To_OSPriority=9 -Doracle.ide.util.AddinPolicyUtils.OVERRIDE_F
LAG=true -Dsun.java2d.ddoffscreen=false -Dwindows.shell.font.languages= -Dide.co
nf="sqldeveloper.conf" -Dide.home.dir.name=.sqldeveloper -classpath ..\..\ide\l
ib\ide-boot.jar;..\..\jdev\lib\xmleditor.jar;..\..\ide\lib\oicons.jar;..\..\..\j
dbc\lib\ojdbc5.jar;..\..\jlib\jewt4.jar;..\..\jlib\share.jar;..\..\sqldeveloper\
lib\jle2.jar oracle.ide.boot.Launcher
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/ide/boot/Launc
her
Caused by: java.lang.ClassNotFoundException: oracle.ide.boot.Launcher
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: oracle.ide.boot.Launcher. Program will exit.
OS
==============
MS Windows 7 Home Premium
sqldeveloper.conf
===================
SetSkipJ2SDKCheck true
IncludeConfFile ../../jdev/bin/ide.conf
AddVMOption -Dapple.laf.useScreenMenuBar=true
AddVMOption -Dcom.apple.mrj.application.apple.menu.about.name="SQL_Developer"
AddVMOption -Dcom.apple.mrj.application.growbox.intrudes=false
AddVMOption -Dcom.apple.macos.smallTabs=true
AddVMOption -Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true
AddJavaLibFile ../../jdev/lib/xmleditor.jar
AddJavaLibFile ../../ide/lib/oicons.jar
AddJavaLibFile ../../jlib/jewt4.jar
AddJavaLibFile ../../jlib/share.jar
AddJavaLibFile ../ide/jlib/xmlef.jar
AddJavaLibFile ../../sqldeveloper/lib/jle2.jar
AddJavaLibFile ../../sqldeveloper/lib/oracle.dbtools.logging.jar
AddVMOption -Dsun.java2d.ddoffscreen=false
AddVMOption -Dwindows.shell.font.languages=
IncludeConfFile sqldeveloper-nondebug.conf
SetJavaHome C:\Program Files\Java\jdk1.6.0_24
Edited by: sivapara on Feb 16, 2011 1:08 PMI was able to resolve this issue by performing following.
1. Go to the location where sqldeveloperW.exe is being executed from.
2. You will find a file sqldeveloper.conf in that location. Edit this file and change the value of IncludeConfFile to point to actual place. For me following were old and new values.
OLD (Wrong) : IncludeConfFile ../../jdev/bin/ide.conf
NEW (Correct) : IncludeConfFile ../../ide/bin/ide.conf
After making above change in the sqldeveloper.conf file. Save and close it. Restart SQLDeveloper. You will not get the error anymore.
Thanks
Ravi -
Executable JAR file: Could not find the main class.
Hello,
I have a problem with making an executable JAR file.
I have written a JAVA program that consists of five different classes of which User.java is the main class and I have saved a text document with Main-Class: User and a blank line after that.
If I try:
jar cmf MainClass.txt User.jar User.class Beheerder.class Operator.class Manager.class MaakVisueelSchema.class
it makes a executable jar file which actually works! :)
But when the Operator class trys to open the MaakVisueelSchema class the screen stays blank.
I can run MaakVisueelSchema with java MaakVisueelSchema.
So I tried to make an executable JAR that consists only of MaakVisueelSchema, the same way as I did for User:
Main-Class: MaakVisueelSchema
jar cmf MainClass.txt MaakVisueelSchema.jar MaakVisueelSchema.class
Then I get the error message:
Could not find the main class. Program will exit.
from the Java Virtual Machine Launcher.
The big difference between MaakVisueelSchema and the other classes is that MaakVisueelSchema contains a PaintComponent method and an ComponentListener. Is it possible that one of those creates the error?
Can anyone help me with this problem?
Thanks in advance!
Bye!Yes,
I tried:
jar xvf MaakVisueelSchema.jar
and it returns:
META-INF/
META-INF/MANIFEST.MF
MaakVisueelSchema.classN/G. You need to manually create a manifest file in a text editor, have it point to your main class, and enter it in your jar command as an argument. -
sekic0429{uabudd_milou}[w10/rbssw/2.0] pwd
/tmp/MyJava/jexcelapi
sekic0429{uabudd_milou}[w10/rbssw/2.0] printenv CLASSPATH
/tmp/MyJava/excelapi:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib
sekic0429{uabudd_milou}[w10/rbssw/2.0] ls
build ExcelSearch.java index.html resources SearchExcel.java~ tutorial.html
docs ExelSearch.java~ jxl.jar SearchExcel.class src workbook.dtd
ExcelSearch.class formatworkbook.dtd jxlrwtest.xls SearchExcel.java TestSpecification.xls
sekic0429{uabudd_milou}[w10/rbssw/2.0] javac -extdirs . ExcelSearch.java
sekic0429{uabudd_milou}[w10/rbssw/2.0]
sekic0429{uabudd_milou}[w10/rbssw/2.0] java ExcelSearch
Exception in thread "main" java.lang.NoClassDefFoundError: ExcelSearch
Caused by: java.lang.ClassNotFoundException: ExcelSearch
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: ExcelSearch. Program will exit.
sekic0429{uabudd_milou}[w10/rbssw/2.0] cat ExcelSearch.java
import java.io.File;
import java.io.IOException;
import java.util.Date;
import jxl.*;
import jxl.read.biff.BiffException;
public class ExcelSearch
public static void main(String[] args)
try
Workbook workbook = Workbook.getWorkbook(new File("TestSpecification.xls"));
catch (IOException e)
e.printStackTrace();
catch (BiffException e)
e.printStackTrace();
Regards Peter, hope for answerr035198x wrote:
Where is SearchExcel.class?Excellent question, though I think I spotted a problem with the cp supplied.
Note the documentation for -cp state (in part)
For example, if directory foo contains a.jar and b.JAR, then the class path element foo/* is expanded to a A.jar:b.JAR, except that the order of jar files is unspecified.So instead of this..
java -cp /tmp/MyJava/excelapi:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib SearchExcel..try this..
java -cp /tmp/MyJava/excelapi/*:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib SearchExcelNotes:
1) Adding the JRE classes to the classpath should not be necessary, but I left the rest of the cp unaltered to highlight the one specific difference I am suggesting.
2) When posting code, code snippets, HTML/XML or input/output, please use the code tags. The code tags help retain the indentation and formatting of the sample. To use them, select the sample text and click the CODE button.
If that still fails, tell us more specifically where the SearchExcel class is by copy/pasting the output (within code tags) of the command..
prompt>jar -tvf mysearchexcel.jarWhere, of course, you replace 'mysearchexcel.jar' with the actual Jar name it is supposed to be located in.
Edit 1:
Changed JavaDocs -> documentation.
Edited by: AndrewThompson64 on Jan 11, 2010 7:12 PM -
Could not find the main class : HelloWorldApp program will exit
please help me
i downloaded and installed jdk-6u13-windows-i586-p(1) from sun.java.com
in my computer --> Advanced --> environment variables --> i had set
user variable :
variable value
java_home C:\Program Files\Java\jdk1.6.0_13\bin
System variable:
path : C:\Program Files\Java\jdk1.6.0_13\bin
after that i wrote a program
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
i saved in c:\ mywork
i compiled it with
javac HelloWorldApp.java and then
java HelloWorldApp
output / result also came
but iam unable to create jar file . when it is created it is showing
could not find the main class : HelloWorldApp program will exit
i created jar file by following way
i created
manifest.txt
Min-Class : HelloWorldApp and then
start -->run--> cmd-->
c:\mywork> jar cfm test.jar manifest.txt HelloWorldApp.class
c:\ java -jar test.jar
but it displays a message
" could not find the main class : HelloWorldApp program will exit "
please please please help me please 1000's of please help mePeter__Lawrey wrote:
You have to specify the manifest with a special option (I think its was -M)
Otherwise the jar will create one (even if you provide it)No, the text file passed as a parameter will be incorporated in the manifest file generated by the JAR tool.
@OP: This will work:
JarTest.java
public class JarTest {
public static void main(String[] args) {
System.out.println("JarTest works!");
}manifest.txt
Main-Class: JarTest+(note there is an extra new line in the manifest.txt!)+
Now execute these commands:
javac JarTest.java
jar cfm MyJar.jar manifest.txt JarTest.class
java -jar MyJar.jar And on my machine, the string "JarTest works!" is displayed on the screen.
And if you look in the MANIFEST.MF file inside your jar file (you can use almost any zip-utility for this), you will see the following:
Manifest-Version: 1.0
Created-By: 1.6.0_0 (Sun Microsystems Inc.)
Main-Class: JarTestOr something similar. -
Could not find the main class: projectRFID.ProjectGUI. Program will exit.
Hello,
I'm quite new in Java. I have an application with GUI. When I'm using Eclipse version 3.4.0 to run the application, all it is working perfect.
But after I generate the jar from Eclipse, using the manifest file option from there and added the ProjectGUI to it, where is the main class, and try to run from the command line I receive the next error:
root@slax:~/workspace# java -jar rfid.jar
Exception in thread "main" java.lang.NoClassDefFoundError: projectRFID/ProjectGUI
Caused by: java.lang.ClassNotFoundException: projectRFID.ProjectGUI
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: projectRFID.ProjectGUI. Program will exit.
root@slax:~/workspace#
I run this application on a SLAX system with jdk6 update 7.
I tried to generate the jar file even from the command line using the manifest file option but I still receive the same error.
I hope somebody can help me!
Thank you!cojogrizli wrote:
The structure of my project in Eclipse is src/project/files.java and in jar file is src/files.java bin/class.java Dati/ and META-INF/.That's wrong. You don't need the .java files in the jar (but you can have them, if you want, they are just not used by Java).
And each .class file must be in a directory that reflects its package. So in your example ProjectGUI.class must be in the directory projectRFID/ inside the .jar file. -
Could not find the main class ! exception.
hi,
I create one java project. for this I am using netbeans 5.
I try to run the project jar file stff.jar. When run using "java -jar stff.jar " , it throws error "could not find the main class. program will exit".
I am extracting this jar file, in manifest, main class is set.
i.e, in manifest, Main-Class: ems.emsFrame.
ems is my folder ,inside it main class kept.
here, emsFrame is my main class where " public static void main (String args[])" is located.
I am also, set the class path for that class folder(ems) and run.
The same error ("could not find the main class. program will exit") occured.
Why this error occured.
also,I am uninstall the jdk and reinstall .
whats my problem.
byeyes sir.
In projects, inside it, in Libraries ,the SNMPInquisitor.jar is located.
inside that jar, snmp package is located.
but, when build and run, there is no problem sir.
Only when i try to run the stff.jar file (java -jar stff.jar), that time only the exception thrown.
when I double click that jar, it show, "could not find the main class. program will exit". But, I am adding the main class in manifest. when i open manifest.mf, it show, Main-Class: ems.emsFrame.
but, when i run jar thro' cmd window, it shows,
Exception in thread "main" java.lang.NoClassDefFoundError: snmp/SNMPGetException
at ems.emsFrame.<init>(emsFrame.java:1163)
at ems.emsFrame.<clinit>(emsFrame.java:1155).
i am still trying it. -
Could not find the main class in Eclipse
Hey,
I've been working with Java for a few years now, but I recently set-up a new Eclipse-environment and now my Application won't run...
"Could not find the main class. Program will exit."
If I compile and run the source myself it works fine, so it must be a setting in Eclipse somewhere...
It doesn't work, even when I put the class in the default package...
It must be something very stupid, but I can't seem to find out what the problem is :(It was only the basic Hello-World-concept;
public class Game extends JFrame {
/** A default SerialVersionUID */
private static final long serialVersionUID = 1L;
public Game() {
addKeyListener(new GameController());
MainView view = new MainView(...);
add(view);
* @param args The game-options
public static void main(String[] args) {
Game spel = new Game();
spel.setSize(1024, 768);
spel.setTitle("Java Rally");
spel.setResizable(false);
spel.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
spel.setVisible(true);
}
Maybe you are looking for
-
MacBook Pro performance issues w/2nd monitor and FCP7
I have this MacBook Pro bought brand-new in January 2010: Model Name: MacBook Pro Model Identifier: MacBookPro5,2 Processor Name: Intel Core 2 Duo Processor Speed: 3.06 GHz Number Of Processors: 1 Total Number Of Cores: 2 L2 Cache: 6 MB
-
How to get the last value edited by users from JTable?
Hi. I have a JDialog that includes an editable JTable. This table is used to set up field caption and font for a report program. I found only when cursor is moved to another cell, the value in current cell being edited will be transferred to Table Mo
-
How to use BAPI in webdynpro for java application
Hi all, Please help in getting started with calling a BAPI in a webdynpro for java application. I have got only the content needed to call a BAPI in a webdynpro for abap application but not in java. Kindly provide me some documents if possible. Thank
-
How to replac the BIOS battery on notebook MSI GE70
I need to replace the BIOS battery to time but I cannot see any guide how to find it ? Do you have any pointers ? Thanks!
-
After spending quite a bit of design, and getting my graphics set up, I am proceeding with the final programming on a pretty simple site. There are 4 sections: home, about, services, and listings. What happens, is that the home page is white, and whe