Servlet can't run,Could not find the Main class,but how ?
well i have made a simple servlet,but when i run it i get the following error.
C:\jdev903_pre\jdk\bin\javaw.exe -ojvm -classpath C:\jdev903_pre\j2ee\home\oc4j.jar -Doracle.j2ee.dont.use.memory.archive=true com.evermind.server.OC4JServer -config C:\jdev903_pre\jdev\system9.0.3.988\oc4j-config\server.xml
[Starting OC4J using the following ports: HTTP=8988, RMI=23891, JMS=9227.]
[waiting for the server to complete its initialization...]
java.lang.NoClassDefFoundError: com.evermind.server.OC4JServer
Exception in thread main
Process exited with exit code 1.
kind regards
Thanks for the very fast response,but how ?
Can you run your servlet on OC4J standalone directly, to narrow down the problem..
thanks,
-Prasad
A quick way to test would be
- Assuming you have OC4J standalone installed
- copy your servlet (HelloWorld.java) file into \default-web-app\WEB-INF\classes
- compile it
- run it using the url http://localhost:8888/servlet/HelloWorld
-Prasad
Similar Messages
-
Servlet can't run,Could not find the Main class
well i have made a simple servlet,but when i run it i get the following error.
C:\jdev903_pre\jdk\bin\javaw.exe -ojvm -classpath C:\jdev903_pre\j2ee\home\oc4j.jar -Doracle.j2ee.dont.use.memory.archive=true com.evermind.server.OC4JServer -config C:\jdev903_pre\jdev\system9.0.3.988\oc4j-config\server.xml
[Starting OC4J using the following ports: HTTP=8988, RMI=23891, JMS=9227.]
[waiting for the server to complete its initialization...]
java.lang.NoClassDefFoundError: com.evermind.server.OC4JServer
Exception in thread main
Process exited with exit code 1.
kind regardsJean,
Can you run your servlet on OC4J standalone directly, to narrow down the problem..
thanks,
-Prasad -
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/ -
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. -
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 : 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 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);
} -
Could not find the main class?
I am getting a
Could not find the main class. Program will exit!
Error with 1.3, but its because there is a jar file missing from the class path. The main class is actually there. Took me 1/2 to figure that out. This must be an error in the java command. Anyone else notice this?Hi all
I'm stuck in the same thing as well...not only am I having problem with the JAR file I created, I'm also having problem executing other's JAR files..
For example, I created this JAR file with 'Main-Class: PrototypeTest' as it's header but when the JAR file is done and I tried to run it, it simply gives me the No Main Class Found error.
Same thing happens when I downloaded this JAR file game from Virum's website and tries to run it...no can do either...
So wondering...has anyone found the solution to this yet? I'm still looking but it is sure driving me crazy... -
JAR "could not find the main class"
I'm running applications under XP.
In my profile:
I have a lot of problems double clicking on a jar file.... it always gives me this error: "could not find the main class"...
In other XP profiles:
All jar files run properly!
Help me!Is your manifest correct? Does it contain the line
Main-Class: Application
or
Main-Class: package/Application
in the main section of the manifest (case sensitive)? Can the interpreter find all the required class files?
Stephen -
Error:-could not find the main class programe will exit(Java virtual mach)
Hi,
i changed the mainfest file for an executive jar file(judge.jar) using the command on dos :-"jar cvfm judge.jar c:\judge\MAINFEST.MF -C judge/ ." , but when i run this jar file again after making changes in mainfest file it is not working. an error encounter like "could not find the main class programe will exit how to solve"(Java virtual machine launcher).please suggest me how to solve this error.
Thanks
Ashwani GuptaHi,
mainfest file has a entry like "main -class: judge.repository.corpus"
please tell me the solution of this error i am doing internship in national university of singapore......and my project is related to data mining.I am using judge.jar when i extract this jar files i saw there was no main-class in manifest file so i change it and make it again jar file using dos command.please suggest me how i can reomove this error.
Thanks in advance.
Ashwani -
Could not find the Main Class. Program will exit. Eclipse w/ JDK 6 RC
Hi all,
I needed to upgrade to JDK 6 RC w/ Eclipse while encountering a java.lang.NullPointer exception.
Now I would like to compile my code with the new VM. I set all preferences to VM Version 6.
Now I have the following Error:
Java Virtual Machine Launcher
Could not find the Main Class. Program will exit.
What do I do now? Attached you find the Error Message.
Bye
Gerrit
================================The System.error looks like:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Exception in thread "main"i wouldn't report a nullpointer to sun unless you're fairly confident there's some sort of bug. if main() can't be found it sounds to me like a config issue. if nullpointer, sounds like a code issue. post the code if you want, but i don't think sun will help you debug this.
-
Could not find the main class JRE 1.6 only with console program into Contro
Hi,
I want replace JRE1.5-11 with JRE 1.6.
Applet is running correctly with JRE 1.6.
But when i want launching Java program located into "Parameters/Control Panel"
I have following error message "Could not find the main class JRE 1.6 "
Regards
Philippei wouldn't report a nullpointer to sun unless you're fairly confident there's some sort of bug. if main() can't be found it sounds to me like a config issue. if nullpointer, sounds like a code issue. post the code if you want, but i don't think sun will help you debug this.
-
Error: "Could not find the main class: Files\NetBeans"
I am working on a WorldWind mapping application but I think this issue is more of a straight Java question. I was attempting to add a web service reference by means of the NetBeans IDE. The reference compiled as it should have but then the application would not run. I deleted the reference, commented out all the code that used the web reference, basically restored all the code to how it was before trying to add the web service. The applicaiton still will not run with the message that it can't find the main class. I do, however, get a clean build. What should I do to fix this?
Here is the error: "Could not find the main class: Files\NetBeans"
thanks!nigel25840 wrote:
I am working on a WorldWind mapping application but I think this issue is more of a straight Java question. I was attempting to add a web service reference by means of the NetBeans IDE. The reference compiled as it should have but then the application would not run. I deleted the reference, commented out all the code that used the web reference, basically restored all the code to how it was before trying to add the web service. The applicaiton still will not run with the message that it can't find the main class. I do, however, get a clean build. What should I do to fix this?
Here is the error: "Could not find the main class: Files\NetBeans"
thanks!Sounds like something (a .cmd file or .bat file, perhaps) is set up to launch NetBeans with a command line like this:
java -classpath ... c:\Program Files\NetBeans ...
So since the path has embedded space(s) in it, it thinks you are wanting to run a class named "Files\NetBeans", which does not exist.
You need someone there who knows what they are doing to look into it for you. -
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
Maybe you are looking for
-
How do I get the SD Card Reader to work?
I have a HP HDX16 -1040US Notebook that has worked perfectly except for my SD Card Reader has stopped working and is no longer being recognized by my computer, is there anything I can do to get this working again? Kindest Regards, Safety 56 Steve
-
Hi All , I am trying to achieve the scenario File - soap - JMS using the below page in wiki https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/file-rfc-file%2528without+bpm%2529& I was able to run the file - soap - file scenario as described in th
-
Documents to be linked from DMS to Production Resource Tools
hi, All I want to Link some documents to PRT through DMS. From DMS i choosed object link Production resourec/tools. I searhed PR/T no result found. So Now i want to Know that How i could Creat PRT and Link some document to PRT. Any one help me Rgds,
-
Skype won't quit...Help!!!
Help!!! I am using a 13 Inch, Late 2011 MacBook Pro, running OS X Yosemite version 10.10. I had Skype open yesterday and when I try to quit it, it says "Application Not Responding." It doesn't close, reopen, anything. Please Help! Solved! Go to Sol
-
I cannot use Mail,Thunderbird or Entourage to view my virgin e-mail
I cannot use Mail,Thunderbird or Entourage to view my virgin e-mail i can only view it from the virgin site.