Exception in thread "main" java.lang.NoClassDefFoundError: server Caused by

I get this error when running a batch file
Exception in thread "main" java.lang.NoClassDefFoundError: serverCaused by: java.lang.ClassNotFoundException: server
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Press any key to continue . . .
I need to get this fixed because i can't run or compile

Hi,
It quite simple.
It is missing with weblogic.jar with in classpath.
Try to set weblogic.jar with in pre-classpath in setdomainEnv.sh file and restart the server
You will find the weblogic.jar with in %WLS_Home% / server / lib
Hope this should help you.
Regards,
Kal

Similar Messages

  • Exception in thread "main"java.lang.NoclassDefFoundError: server (wrong....

    Ok, i made my own java compiler (well my friend made it for me), and I got this error when i ran the program.....
    Here is the code in my compiler if you want to take a look at it.
    @echo off
    if exist "C:\Program Files (x86)\Java\" set programfiles=C:\Program Files (x86)
    set pr=%programfiles%\Java\
    :co1
    set b=0
    set t=7
    goto co2
    :co2
    color %b%%t%
    :menu
    cls
    title The Perfect Compiler version 1.9
    echo Please choose an option below to do that function.
    echo Keep posted on the Moparscape Tutorials section for
    echo any updates that I post.
    echo.
    echo c - Compile your server.
    echo r - To Run your server.
    echo e - To exit out of the program.
    echo jar - It will create your server into an executable Jar archive.
    echo color - Change the Text and Backround colors of this compiler.
    echo reset - Resets your Compiler Logs.
    echo.
    echo.
    set /p c=Option:
    if %c%==c goto c
    if %c%==C goto c
    if %c%==r goto r
    if %c%==R goto r
    if %c%==jar goto jar
    if %c%==Jar goto jar
    if %c%==JAR goto jar
    if %c%==color goto color
    if %c%==Color goto color
    if %c%==COLOR goto color
    if %c%==reset goto reset
    if %c%==Reset goto reset
    if %c%==RESET goto reset
    if %c%==e goto e
    if %c%==E goto e
    if %c%==* goto er
    goto er
    :jar
    title Jar Creator
    cls
    echo What will be the name of the Jar file?
    echo.
    set /p name=Name:
    if exist *.class (del *.class)
    set pro=%pr%jdk1.5.0
    set pro2=%pr%jdk1.6.0
    set jav=bin\javac.exe
    set go=jar2
    goto cj
    :jar2
    %java% -cp . *java
    echo Manifest-Version: 1.0 >> manifest
    echo Created-By: 1.5.0_04 (Sun Microsystems Inc.) >> manifest
    echo Main-Class: server >> manifest
    set pro=%pr%jdk1.5.0
    set pro2=%pr%jdk1.6.0
    set jav=bin\jar.exe
    set go=jar3
    goto cj
    :jar3
    if not exist *.class (goto jre)
    %java% -cvfm %name%.jar manifest *.class
    del runserver.bat
    del manifest
    del *.class
    goto jl
    :jar4
    set pro=%pr%jre1.5.0
    set pro2=%pr%jre1.6.0
    set jav=bin\java.exe
    set go=jar5
    goto cj
    :jar5
    echo @echo off  >> runserver.bat
    echo title %name% >> runserver.bat
    echo %java% -cp .;%name%.jar server >> runserver.bat
    echo pause >> runserver.bat
    cls
    echo %name% Jar file successfully made. The runserver.bat will
    echo now load the Jar file. If you have any errors while runnning
    echo the Jar file, please post about it in Mod Taharok's 'Perfect
    echo Compiler' topic on MoparScape.
    pause
    goto menu
    set
    :color
    cls
    echo Would you like to change the backround color, change
    echo the text color, or reset it to default?
    echo.
    echo back - Change the backround color.
    echo text - Change the text color.
    echo def - Change all colors back to default.
    echo.
    echo.
    set /p color=Option:
    if %color%==back goto back
    if %color%==BACK goto back
    if %color%==text goto text
    if %color%==TEXT goto text
    if %color%==def goto co1
    if %color%==DEF goto co1
    if %color%==* goto er
    goto er
    :back
    cls
    echo Please select a color to change the backround to:
    echo.
    echo black
    echo white
    echo red
    echo yellow
    echo green
    echo blue
    echo purple
    echo.
    echo.
    set /p back=Color:
    if %back%== black (set b=0)
    if %back%== white (set b=7)
    if %back%== red (set b=4)
    if %back%== yellow (set b=6)
    if %back%== green (set b=2)
    if %back%== blue (set b=1)
    if %back%== purple (set b=5)
    goto co2
    :text
    cls
    echo Please select a color to change the text to:
    echo.
    echo black
    echo white
    echo red
    echo yellow
    echo green
    echo blue
    echo purple
    echo.
    echo.
    set /p back=Color:
    if %back%== black (set t=0)
    if %back%== white (set t=7)
    if %back%== red (set t=4)
    if %back%== yellow (set t=6)
    if %back%== green (set t=2)
    if %back%== blue (set t=1)
    if %back%== purple (set t=5)
    goto co2
    :c
    cls
    title Compiler
    set pro=%pr%jdk1.5.0
    set pro2=%pr%jdk1.6.0
    set jav=bin\javac.exe
    set go=c2
    goto cj
    :c2
    if exist src (goto cl) else (goto c3)
    :c3
    if exist *.java (goto cl2) else (goto ce)
    :c4
    %java% -cp . *.java
    echo Files Compiled Successfully!
    pause
    cls
    goto menu
    :c5
    %java% -cp . .\src\*.java
    echo Files Compiled Successfully!
    pause
    move .\src\*.class .\classes\
    cls
    goto menu
    :ce
    cls
    echo You must have Java files for this Compiler to Compile.
    pause
    cls
    goto menu
    :r
    cls
    title Runserver
    set pro=%pr%jre1.5.0
    set pro2=%pr%jre1.6.0
    set jav=bin\java.exe
    set go=r2
    goto cj
    :r2
    set rjava=%java% -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    cls
    goto r3
    :r3
    if exist .\classes\HelloJava.class (goto sl2) else (goto r4)
    :r4
    if exist .\server.class (goto sl) else (goto se)
    :r5
    %rjava%
    pause
    cls
    goto menu
    :r6
    set rjava=
    set rjava=%java% -cp .;./classes; Server
    %rjava%
    pause
    cls
    goto menu
    :se
    cls
    title Error
    echo You do not have a Server.class. Make sure that you have used the
    echo compiler with your server BEFORE you try runing it.
    pause
    cls
    goto menu
    :er
    cls
    title Error
    echo Invalid command. Please make sure the commands you type
    echo in are correct.
    pause
    cls
    goto menu
    :e
    cls
    exit
    :cj
    if exist "%pro2%_01\%jav%" (goto sj)
    if exist "%pro2%\%jav%" (goto sj2)
    if exist "%pro%_10\%jav%" (goto sj3)
    if exist "%pro%_09\%jav%" (goto sj4)
    if exist "%pro%_08\%jav%" (goto sj5)
    if exist "%pro%_07\%jav%" (goto sj6)
    if exist "%pro%_06\%jav%" (goto sj7)
    if exist "%pro%_05\%jav%" (goto sj8)
    if exist "%pro%_04\%jav%" (goto sj9)
    if exist "%pro%_03\%jav%" (goto sj10)
    if exist "%pro%_02\%jav%" (goto sj11)
    if exist "%pro%_01\%jav%" (goto sj12)
    if exist "%pro%\%jav%" (goto sj13) else (goto je)
    :sj
    set java="%pro2%_01\%jav%"
    goto %go%
    :sj2
    set java="%pro2%\%jav%"
    goto %go%
    :sj3
    set java="%pro%_10\%jav%"
    goto %go%
    :sj4
    set java="%pro%_09\%jav%"
    goto %go%
    :sj5
    set java="%pro%_08\%jav%"
    goto %go%
    :sj6
    set java="%pro%_07\%jav%"
    goto %go%
    :sj7
    set java="%pro%_06\%jav%"
    goto %go%
    :sj8
    set java="%pro%_05\%jav%"
    goto %go%
    :sj9
    set java="%pro%_04\%jav%"
    goto %go%
    :sj10
    set java="%pro%_03\%jav%"
    goto %go%
    :sj11
    set java="%pro%_02\%jav%"
    goto %go%
    :sj12
    set java="%pro%_01\%jav%"
    goto %go%
    :sj13
    set java="%pro%\%jav%"
    goto %go%
    :je
    cls
    title Error
    echo You do not have JDK 5.0 or JDK 6.0 or any JDK 5.0 and 6.0 updates.
    echo Go to Mod Taharok's tutorial on the Moparscape Tuturoials section
    echo for step-by-step instructions to download the newest JDK Update.
    pause
    cls
    goto menu
    :sl
    cls
    echo Ran Server at %time% and on %date%. >> "Compile Logs.txt"
    echo Server was run using %java%. >> "Compile Logs.txt"
    echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto r5
    :sl2
    cls
    echo Ran Server at %time% and on %date%. >> "Compile Logs.txt"
    echo Server was run using %java%. >> "Compile Logs.txt"
    echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto r6
    :cl
    cls
    echo Compiled Java files at %time% and on %date%. >> "Compile Logs.txt"
    echo Java files were compiled using %java%. >> "Compile Logs.txt"
    echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto c5
    :cl2
    cls
    echo Compiled Java files at %time% and on %date%. >> "Compile Logs.txt"
    echo Java files were compiled using %java%. >> "Compile Logs.txt"
    echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto c4
    :jl
    cls
    echo %name% Jar file created at %time% and on %date%. >> "Compile Logs.txt"
    echo Jar file was created using %java%. >> "Compile Logs.txt"
    echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto jar4
    :reset
    cls
    echo Resetting the Compiler's Logs...
    pause
    del "Compile Logs.txt"
    goto menuAs the pic says "5 duke stars for whoever can fix this"

    I got that exact problem I think, how did you fix it?? I been trying to make a server for a whole year, spent hours and hours trying to make it, and I can't do it... Need help... Whoever helps gets... Co on my server. :)

  • On starting WebLogic getting Error : Listening for transport dt_socket at address: 8453 Exception in thread "main" java.lang.NoClassDefFoundError: vXmx512m

    Hi,
    system i am using for Oracle SOA is :
    Windows 64 Bit
    i5 Processor
    6 GB RAM
    29 GB on C Drive is already free after installation of all SOA related products.
    I have installed wlserver_10.3 for SOA 11g Development purpose and followed exact installation sequence and procedure as mention in oracle documentation
    i created domain also and every thing look correct but after installation procedure there are "Additional actions required just after every thing installed" :
    setting memory limit
    starting weblogic server (Admin Server)
    starting weblogic managed server
    and so on
    now Problem is when i execute C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin startWebLogic.cmd
    as mention in oracle documentation i am getting following error message : (i have only included last error lines instead of complete console log)
    oConsole= -Dweblogic.ext.dirs=C:\Oracle\MIDDLE~1\patch_wls1036\profiles\default\
    sysext_manifest_classpath;C:\Oracle\MIDDLE~1\patch_oepe180\profiles\default\syse
    xt_manifest_classpath;C:\Oracle\MIDDLE~1\patch_ocp371\profiles\default\sysext_ma
    nifest_classpath;C:\Oracle\MIDDLE~1\patch_adfr1111\profiles\default\sysext_manif
    est_classpath  weblogic.Server
    Listening for transport dt_socket at address: 8453
    Exception in thread "main" java.lang.NoClassDefFoundError: vXmx512m
    Caused by: java.lang.ClassNotFoundException: vXmx512m
            at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Could not find the main class: ++Xmx512m.  Program will exit.
    Now to resolve this what i already tried are :
    I change JAVA_HOME and PATH to jdk6 which came with web logic installer
    Location is at :
    JAVA_HOME : C:\Oracle\Middleware\jdk160_29
    PATH : C:\Oracle\Middleware\jdk160_29\bin
    The above dose not include any space between path
    I ran the startWebLogic.cmd and got same error
    After that I also added
    CLASSPATH : C:\Oracle\Middleware\jdk160_29\lib\tool.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\jdk160_29\bin
    WL_HOME:  C:\Oracle\Middleware\wlserver_10.3
    I ran the startWebLogic.cmd and got same error
    I also used earlier path which I used with eclipse when I was working on other java development.
    JAVA_HOME : C:\Program Files\Java\jdk1.7.0_21
    PATH : C:\Program Files\Java\jdk1.7.0_21\bin
    I ran the startWebLogic.cmd and got same error
    Then I also gave PATH: C:\Oracle\Middleware\wlserver_10.3\server\lib      (including the existing one using ; )
    I ran the startWebLogic.cmd and got same error
    Now may be there is a file called setSOADomainEnv.cmd in
    < C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin\ setSOADomainEnv.cmd>
    That include some values for memory set :
    set JAVA_OPTIONS=%JAVA_OPTIONS%
    set DEFAULT_MEM_ARGS=-Xms512m –Xmx512m
    set PORT_MEM_ARGS=-Xms512m –Xmx768m
    if "%JAVA_VENDOR%" == "Oracle" goto OracleJVM
    set DEFAULT_MEM_ARGS=%DEFAULT_MEM_ARGS% -XX:PermSize=128m -XX:MaxPermSize=768m
    set PORT_MEM_ARGS=%PORT_MEM_ARGS% -XX:PermSize=256m -XX:MaxPermSize=768m
    now as I change the red highlighted value to 512 value because I have less memory resource and I checked in installation documentation to change the above red highlighted value to 512 original is 1024 which is too high and it was crating problem and showing memory space problem so I change it to 512 and now I am not getting that memory space problem error but may be the above error is related with change value in setSOADomainEnv.cmd file or not
    Following are my domain, weblogic and soa home directory path and all these path are exactly what it suppose to be according to Oracle Installation Documentation:
    WebLogic :
    C:\Oracle\Middleware\wlserver_10.3
    C:\Oracle\Middleware\coherence_3.7
    C:\Oracle\Middleware\oepe_11.1.1.8.0
    SOA Oracle Home Directory :
    C:\Oracle\Middleware\Oracle_SOA1
    OSB Home Location :
    C:\Oracle\Middleware\Oracle_OSB1
    Domain name : soa_div_domain
    Domain Location :       C:\Oracle\Middleware\user_projects\domains
    Application Location :  C:\Oracle\Middleware\user_projects\applications
    Domain Location:        C:\Oracle\Middleware\user_projects\domains\soa_div_domain
    form here i am trying to start weblogic : C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin\startWebLogic.cmd
    Please tell me any body want more details.
    Thanks.

    I think you are missing a character '-'
    USER_MEM_ARGS="Xms512m -Xmx512m -XX:MaxPermSize=128m"Add this character like follows
    "-Xms512m -Xmx512m -XX:MaxPermSize=128m"

  • Exception in thread "main" java.lang.NoClassDefFoundError: HW

    I am very new to java. Tried to take the time to learn but got wrapped up in other things. Now I am back to learn and here is what I am getting. I don't know if it has anything to do with java required files being in a different directory or what. I have my java sdk files in C:\Program Files\Java\jre1.6.0_05\ and the source file is in C:\Java
    Here is more information.
    My Error at runtime:_
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
    My actions in the shell:_
    C:\Java>javac HW.java
    C:\Java>java HW
    Exception in thread "main" java.lang.NoClassDefFoundError: HW
    Caused by: java.lang.ClassNotFoundException: HW
    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:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    My Source:_
    * The HelloWorldApp class implements an application that
    * simply prints "Hello World!" to standard output.
    class HW {
        public static void main(String[] args) {
            System.out.println("Hello World!"); // Display the string.
    }

    My Error at runtime:_
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
    Exception in thread "main" java.lang.NoClassDefFoundError: HW
    Caused by: java.lang.ClassNotFoundException: HWO_o
    That's two different errors.
    Try to execute with:
    java -cp . HW

  • Exception in thread "main" java.lang.NoClassDefFoundError: JDBCVersion

    I using the example in the online jdbc docs shown below:
    +++++++
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.OracleDataSource;
    class JDBCVersion
    public static void main (String args[]) throws SQLException
    OracleDataSource ods = new OracleDataSource();
    //ods.setURL("jdbc:oracle:thin:scott/tiger@host:port:service");
    ods.setURL("jdbc:oracle:thin:scott/tiger@testdb:1521:xe");
    Connection conn = ods.getConnection();
    // Create Oracle DatabaseMetaData object
    DatabaseMetaData meta = conn.getMetaData();
    // gets driver info:
    System.out.println("JDBC driver version is " + meta.getDriverVersion());
    I compiles without a problem:
    C:\temp>javac JDBCVersion.java -classpath c:\instantclient\ojdbc6.jar
    +++
    I keep getting the following error when attempting to run the
    C:\temp>java JDBCVersion -classpath c:\instantclient\ojdbc6.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: JDBCVersion
    Caused by: java.lang.ClassNotFoundException: JDBCVersion
    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)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: JDBCVersion. Program will exit.
    I attempted to set my classpath using the parameter -classpath
    and setting the environment variable in the ontrol panel, system, adv, env. vars.
    I still get the error.
    Can someone provide some specific idea why this is occuring?
    Thanks in advance,
    Larry

    Thanks for the response. I also found a solution by setting the classpath using the environment variable in xp. I tried to set the environmental variable before, but I did it incorrectly(unknown to me); I set it up in the system variable portion. I was surfing around for solutions and found the proper way to set the value with this link. I hope it saves some else several days of work that it cost me :)
    http://faculty.ed.umuc.edu/~arnoldyl/NetBeansTutorials/Setting-Classpath.html

  • Exception in thread "main" java.lang.NoClassDefFoundError: BlueCheese

    I'm writing a simple swing application. It compiles, but I can't get it to run... I always get this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: BlueCheese
    Caused by: java.lang.ClassNotFoundException: BlueCheese
    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)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    I tried running another app, and it works just fine. Here is the source code:
    package zing.blueCheese;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class BlueCheese
         private JFrame frame;
         private static void createGUI()
              JFrame frame = new JFrame("FileSmasher");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              ImageIcon icon = new ImageIcon("Mac.gif");
              JTabbedPane tabbedPane = new JTabbedPane();
              JLabel label = new JLabel("<html><font size=6>1:</font></html>");
              JPanel panel = new JPanel();
              tabbedPane.addTab("Parse", icon, panel, "Smash a file");
              panel = new JPanel();
              tabbedPane.addTab("Concatenate", icon, panel, "Assemble the smashed pieces of a file");
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args)
              SwingUtilities.invokeLater(new Runnable()
                   public void run()
                        createGUI();
    Any suggestions?

    yawmark wrote:
    java -cp . zing.blueCheese.BlueCheeseExecuted in the directory containing the "zing" subdirectory (which itself should contain "blueCheese/BlueCheese.class"). Note the "dot" and spaces, which mean "add the current directory to the classpath". Alternately, you could add the full path to the directory containing "zing" to the classpath. Example:java -cp . path/to/dir zing.blueCheese.BlueCheese~Shouldn't that be (with appropriate path separator)
    java -cp.:path/to/dir zing.blueCheese.BlueCheese?

  • Exception in thread "main" java.lang.noclassdeffounderror: client

    Hey, I just download a game and it's java based but when I try to run it run it just opens a cmd and tells me this:
    exception in thread "main" java.lang.noclassdeffounderror: client
    Caused by: java.lang.noclassdeffounderror: client ...
    And some other things ... at the end of every caused problem ther is a (Unknown Source).
    At the end it says: Could not find the main class: client. Program will exit.
    I know, maybe this isnt the right topic, but please help me !!
    And I'm not the best PC programmer but I know the basics :S

    This is a support forum for programming Java, not for any and all Java-based software.
    Your best bet is to contact the author of the software.
    How did you try to run the program?

  • Another .....Exception in thread "main" java.lang.NoClassDefFoundError: Hw

    Here is my Java:
    package classes.com.mattclark.hw;
    import java.lang.*;
    public class Hw {
      private static Object mainClass = null;
      private Short var1 = null;
      public Hw(){
        var1 = new Short("0");
        System.out.println("| Class Name           |           Minimum Value |           Maximum Value |");
        System.out.println("----------------------------------------------------------------------------");
        System.out.println("| " + rPad(var1.getClass().getName(), 20) +
                           " |" + lPad(String.valueOf(var1.MIN_VALUE), 24) +
                           " |" + lPad(String.valueOf(var1.MAX_VALUE), 24) +
                           " |" );
      private String rPad(String initialString, int width) {
        String returnString = null;
        if(initialString.length() >= width) {
          // truncate the string and return it
          returnString = initialString.substring(0, width-1);
        } else {
          returnString = initialString;
          for(int i=initialString.length(); i<width; i++) {
            // pad the return string to the right
            returnString = returnString.concat(" ");
        return returnString;
      private String lPad(String initialString, int width) {
      String returnString = null;
      if(initialString.length() >= width) {
        // truncate the string and return it
        returnString = initialString.substring(0, width-1);
      } else {
        returnString = new String("");
        for(int i=initialString.length(); i<width; i++) {
          // pad the return string to the right
          returnString = returnString.concat(" ");
        returnString = returnString.concat(initialString);
      return returnString;
    public static void main(String[] args) {
        mainClass=new Hw();
    } I have tried other solution from other "Exception in thread "main"" posts
    I have tried all kinds of CLASSPATH's
    My teacher said to use: Set CLASSPATH=D:\java3\hw\classes

    My Error at runtime:_
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
    Exception in thread "main" java.lang.NoClassDefFoundError: HW
    Caused by: java.lang.ClassNotFoundException: HWO_o
    That's two different errors.
    Try to execute with:
    java -cp . HW

  • Exception in thread "main" java.lang.NoClassDefFoundError: org/hsqldb/Serve

    hi,
    I'm new in hibernate.I am studying hibernate tutorial from http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html
    After few steps When I've to start data base.It doesn't.
    I post whatever at command prompt. Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    C:\Documents and Settings\shobhitsingh>cd\
    C:\>cd hibernate*
    C:\hibernateTutorial>java -classpath ../lib/hsqldb.jar org.hsqldb.Server
    Exception in thread "main" java.lang.NoClassDefFoundError: org/hsqldb/Server
    C:\hibernateTutorial>I thing I should copy paste third party libraries in lib folder.
    but still i am confused.
    pl guide for this.
    Regards
    S.Singh

    Put the hsqldb JAR file into your classpath. I suspect Mr Singh was using ".." when he should have been using "." in the classpath string, but even if he wasn't his classpath issue's not that likely to be identical to yours.
    [http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html|http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html]

  • Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/Server

    Dear Sir/Madam
    I downloaded the Weblogic610 server five times, and when I install it on my Linux
    box (RedHat 7.1), I always met the exception like:
    Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/Server
    When I check with lib directory, there is weblogic.jar here, but the file looks
    was damaged, the file size is ok, but I can't open it by use jar tool or other
    tools.
    Some packeage is very strange, after my downloaded, and install, there are only
    a few files in lib directory and some subdirectory and weblogic.jar is missing,
    but the download is normal.
    So, I hope who guy have similar experience, please let me know.
    Thank you
    Cidy

    Hi Raj,
    Could you provide more information from the log; is there a full
    traceback. A first step may be to use the latest service pack [1].
    Also you might try your question in the management newsgroup [2] or
    contact our outsanding support group [3].
    Hope this is of some value,
    Bruce
    [1]
    http://commerce.bea.com/showproduct.jsp?family=WLS&major=8.1&minor=2
    [2]
    http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=xover&group=weblogic.developer.interest.management
    [3]
    http://[email protected]
    Raj wrote:
    >
    Hello All,
    I have installed wls 8.1 and created domain. I have manged server running at other location.I am getting the following Log,When i tried to start managed server from admin server
    java.lang.NoClassDefFoundError: weblogic/Server Exception in thread "main"
    and on admin side
    The request to start the server ecgNode01 of domain CQ6UIDomain failed because the node manager did not hear from the managed server in the configured timeout period. Despite this, if the managed server has not failed, it will come up and the node manager will start monitoring it. To adjust this timeout so that the task does not fail prematurely, please refer to the node manager property ScavangerDelaySeconds (Default value : 180 seconds. Current value : 180 seconds
    can anyone tell me where i went wrong

  • Exception in thread main java.lang.NoClassDefFoundError: com/object/msg/Sms

    Exception in thread main java.lang.NoClassDefFoundError: com/object/msg/SmsService
    caused by: java.lang.NotFoundException: com.object.msg.SmsService
    at java.net........................
    at java.security.......
    I'm trying to send SMS using this code and it gives above Exception during Runtime.
    import java.io.File;
    import com.objectxp.msg.*;
    public class SendSMS
    public static void main(String[] args)
    SmsService service = null;
    try {
    // Configuration
    File config = new File("jsms.conf");
    // create service object.
    service = new GsmSmsService();
    service.init(config);
    // create a new Message.
    Message msg = new Message();
    msg.setRecipient("7894561");
    msg.setMessage("jSMS is cool!");
    // Connect to the device
    service.connect();
    // send the Message
    service.sendMessage(msg);
    System.out.println("Message sent successfully, ID is ");
    } catch (Exception ex) {
    System.err.println("Message could not be sent: "+ex.getMessage());
    ex.printStackTrace();
    } finally {
    if (service != null) {
    try {
    service.disconnect();
    } catch( Exception unknown ) {}
    service.destroy();
    }

    run this one in command prompt and then convert the applet using converter tool
    JC_HOME = C:\java_card_kit-2_2_2\bin\
    set CLASSES=%JCHOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;
    D:\NareshPalle\jcardRE\Smart\src>java -classpath %_CLASSES% com.sun.javacard.con
    verter.Converter -out EXP JCA CAP -exportpath .\exp -applet 0x0a:0x00:0x00:0x00:0x0e:0x01:0x02:
    0x03:0x04:0x05:0x06 PackageName appletName 0x01:0x02:0x03:0x04:0x05:0x0
    6:0x07:0x08 1.0
    or
    go to following directory and run the converter tool in command prompt
    step 1: cd C:\java_card_kit-2_2_2\bin\
    then run this command under the above directory
    step 2:converter -classdir E:\Pathof Your applet class file -out EXP JCA CAP -exportpath E:\path of exp files folder -applet AID PackageName AppletName PackAID major.minor no
    For more doubts mail me....
    *[removed by moderator]*
    Thanks and Regards
    NareshPalle
    Edited by: EJP on 31/03/2012 20:09: removed your email address. Unless you like spam and unless you think these forums are provided for your personal benefit only, posting an email address here serves no useful purpose whatsoever.

  • Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldSwing

    Hello;
    I got a error to run my application, i have not problem with compile it. But it give me the following error massage when i run it.
    Could anyone help me please.
    E:\Java>javac HelloWorldSwing.java
    E:\Java>java HelloWorldSwing
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldSwing
    E:\Java>path
    PATH=C:\Program Files\Java\jdk1.6.0\bin;C:\Program Files\QuickTime\QTSystem\;C:\
    Program Files\Common Files\Adobe\AGL;C:\Program Files\Microsoft SQL Server\80\To
    ols\BINN;C:\Program Files\Java\jre1.6.0\bin;C:\Program Files\Java\jre1.6.0\bin;C
    :\Program Files\Java\j2re1.4.2_13\bin
    The following are where my jdk and jre store.
    C:\Program Files\Java>dir
    Volume in drive C has no label.
    Volume Serial Number is 3023-229B
    Directory of C:\Program Files\Java
    04/02/2007 12:22 AM <DIR> .
    04/02/2007 12:22 AM <DIR> ..
    01/02/2007 10:54 PM <DIR> j2re1.4.2_13
    03/02/2007 04:54 PM <DIR> jdk1.6.0
    01/02/2007 10:02 PM <DIR> jre1.5.0_06
    04/02/2007 12:22 AM <DIR> jre1.6.0
    0 File(s) 0 bytes
    6 Dir(s) 5,761,228,800 bytes free

    It even tries to tell you what's wrong. Run class "start.HelloWorldSwing", not "HelloWorldSwing".
    I bet that copying that error message without the class name into Google would have given you the answer right away.

  • Exception in thread "main" java.lang.NoClassDefFoundError: connect (wrong n

    Please Help, I am giving up...
    My PATH: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Java\jdk1.6.0_11\bin;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\JAVA DOCUMENTATION\BasicJava1\Code;C:\Program Files\Mysql Connector J\mysql-connector-java-5.1.7\mysql-connector-java-5.1.7-bin.jar
    MY CLASSPATH: C:\Program Files\Mysql Connector J\mysql-connector-java-5.1.7\;C:\Program Files\Mysql Connector J\mysql-connector-java-5.1.7-bin
    Before I set the ABOVE Path's I received the "com.mysql.jdbc.Driver" error. After adding the CLASS PATH as above I got the following Error
    "com.mysql.jdbc.Driver"
    After the ABOVE mentione PATH's Iam getting the following error:
    C:\JAVA DOCUMENTATION>java connect
    Exception in thread "main" java.lang.NoClassDefFoundError: connect (wrong name:
    Connect)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    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)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: connect. Program will exit.
    THIS IS MY CODE.....
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class Connect
    public static void main (String[] args)
    Connection conn = null;
    try
    String userName = "sampadm";
    String password = "secret";
    String url = "jdbc:mysql://localhost/sampdb";
    Class.forName ("com.mysql.jdbc.Driver").newInstance ();
    conn = DriverManager.getConnection (url, userName, password);
    System.out.println ("Database connection established");
    catch (Exception e)
    System.err.println ("Cannot connect to database server");
    System.err.println("Exception: " + e.getMessage());
    finally
    if (conn != null)
    try
    conn.close ();
    System.out.println ("Database connection terminated");
    catch (Exception e) { /* ignore close errors */ }
    PLEASE PLEASE HELP, AS I NEED TO GET PASSED THIS ERROR NOW. I NEED TO PROGRESS !!
    THANKS TO ANYBODY THAT CAN ASSIST
    FYI
    JUDY

    Java is case sensitive. Connect != connect

  • Reg:- Exception in thread "main" java.lang.NoClassDefFoundError

    Hi Friends,
    I am trying to connect to Central Management Server using Java.I have created a sample program.I set class path as
    D:\j2sdk1.4.2_14\lib;D:\Program Files\Business Objects\common\3.5\java\lib\rebean.wi.jar;D:\Program Files\Business Objects\common\3.5\java\lib\rebean.jar;D:\Program Files\Business Objects\common\3.5\java\lib\ceplugins.jar;D:\Program Files\Business Objects\common\3.5\java\lib\cesession.jar;D:\Program Files\Business Objects\common\3.5\java\lib\cecore.jar;D:\Program Files\Business Objects\common\3.5\java\lib\celib.jar;D:\Program Files\Business Objects\common\3.5\java\lib\.;.
    Source Code Sample.java
    import com.crystaldecisions.enterprise.ocaframework.ServiceNames;
    import com.crystaldecisions.sdk.exception.SDKException;
    import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
    import com.crystaldecisions.sdk.occa.pluginmgr.*;
    import com.crystaldecisions.sdk.plugin.*;
    import com.crystaldecisions.sdk.plugin.desktop.report.*;
    import com.crystaldecisions.sdk.plugin.desktop.user.*;
    import com.crystaldecisions.sdk.framework.*;
    import com.businessobjects.rebean.wi.LogicalOperator;
    import com.crystaldecisions.sdk.occa.infostore.*;
    import com.businessobjects.rebean.wi.*;
    import java.util.*;
    import java.lang.StringBuffer;
    import java.io.*;
    public class Sample1
    public static void main(String[] args)
    System.out.println("After Method Call");
    String Juname = "Administrator";
    String Jpwd = "";
    String Jcms = "hst-pcs4892:6400";
    String Jauth = "secEnterprise";
    SDKException Jfailure = null;
    boolean JloggedIn = true;
    IEnterpriseSession JenterpriseSession=null;
    // If no session already exists, logon using the specified parameters.
    if (JenterpriseSession == null)
    try
    /* Attempt logon. Create an Enterprise session
    * manager object.
    ISessionMgr JsessionMgr = CrystalEnterprise.getSessionMgr();
    // Log on to BusinessObjects Enterprise.
    JenterpriseSession = JsessionMgr.logon(Juname, Jpwd, Jcms, Jauth);
    String JlogonToken = JenterpriseSession.getLogonTokenMgr().getDefaultToken();
    catch (SDKException error)
    System.out.println("Exception Occured");
    JloggedIn = false;
    Jfailure = error;
    //System.out.println(JloggedIn);
    I am getting the following error
    Exception in thread "main" java.lang.NoClassDefFoundError: com/crystaldecisions/thirdparty/org/omg/CORBA/TRANSIENT
    at com.crystaldecisions.enterprise.ocaframework.ServiceMgrFactory.getServiceMgr(Unknown Source)
    at com.crystaldecisions.sdk.occa.security.internal.m.<init>(Unknown Source)
    at com.crystaldecisions.sdk.occa.security.internal.SecurityFactory.makeSecurityMgr(Unknown Source)
    at com.crystaldecisions.sdk.framework.internal.d.<init>(Unknown Source)
    at com.crystaldecisions.sdk.framework.internal.CEFactory.makeSessionMgr(Unknown Source)
    at com.crystaldecisions.sdk.framework.CrystalEnterprise.getSessionMgr(Unknown Source)
    at Sample1.main(Sample1.java:46)
    Please help me resolve this.
    Regards,
    Sriram.
    [email protected]

    Hi Cotton,
    First let me thank you for responding to this
    thread.I gave the class path where all these are
    availableJava disagrees with you.
    Do you know which jar com.crystaldecisions.thirdparty.org.omg.CORBA/TRANSIENT is supposed to be in?

  • Exception in thread "main" java.lang.NoClassDefFoundError: Files\Apache

    Hi,
    I am new to smart card.I have installed and configured the JCDK.When i try to run the build_sample.bat,I got the following error.
    Exception in thread "main" java.lang.NoClassDefFoundError: Files\Apache
    can you guys give me the solution please.Thank you.
    Sankar

    hi
    Thank you..yes really when i check the class path in my environment,i saw the spaces between the Program Files.this i was set for my tomcat server.so its taken Apache as a file.
    regards
    sankar

Maybe you are looking for