Problems interpriting my .class file

Hi, im new to java and I have a very simple .java file that I compiled into a .class file. The problem is, then I try and interprit it (Im using JDK 5) I get an error... "Exception in thread "main" java.lang.NoClassDefFoundError: Saluton"
Saluton is my program. I've tried setting the "Path" and "classpath" variables, but it still doesnt work.
Heres my path and classpath variable values.
Classpath:
,;C:\Program Files\Java\jdk1.5.0_05\bin\javaPath:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\GTK\2.0\bin;C:\Program Files\Common Files\Adobe\AGL;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.5.0_05\binThank you very much for your help!
Onlinealways

You need to add the path to where your compiled .class file is to your system CLASSPATH. For example, if I create class X in package "pak1" then I will run it with:
java pak1.XHowever, in order for the JVM to find X it must be in it's classpath. Thus if X.class was at
C:\MyJava\bin\pak1\X.classI would need to add
C:\MyJava\bin\to the classpath.

Similar Messages

  • Problem running my class file

    i'm using os x and when i compile my HelloWorld.java i have no errors and it creates the HelloWorld.class file in the same directory. now if i try to run the program from the terminal by typing in
    java HelloWorld it works file, but if i try to send the HelloWorld.class file to any other machine or even open it not using the terminal(finding the file and double clicking it) it won't run.
    Any idea how to make this program stand alone like i would want??
    Thanks

    alright i'll look it up, the little i've done with
    java on windows with textpad i thought i was creating
    a .class that executed from the ms-dos window but
    perhaps something else the compiler did behind the
    scenes to make it executable?Nope.
    java HelloWorldYou're running java.exe. It's taking HelloWorld as its argument, finding the class called HelloWorld.class, taking it as input, and executing its main method through the JVM.
    It's exactly the same thing as if you type Notepad somefile.txt or javac SomeFile.javaThe first word is the .exe or .bat that's running, and the next word is an argument that the program interprets as a file to use as its input.

  • Problem in accessing class file for applet code

    I am developing a package in struts frame work.
    I place all the java files in action folder and jsp files in jsp folder.In one of the jsp I write code to invoke applet .But I am getting error as "class not found exception".Can any one help me? Below I am giving the code?
    <embed
    type="application/x-java-applet;version=1.4"
    pluginspage="http://java.sun.com/products/plugin/index.html#download"
    code="DigitalSignerApplet"
    archive="DigitalSignerApplet.jar"
    width="130"
    height="25"
    mayscript="true"
    scriptable="true"
    fileNameField="uploadFile"
    certificationChainField="certChain"
    signatureField="signature"
    signButtonCaption="Sign selected file">
    <embed>

    Excuse me with out files in webserver how can I get
    error, I am asking how to point to that specific classHuh? You can't. It's an HTML page with an applet. All normal rules apply.

  • Problem reading a jar file ?!

    Hello,
    I am having a problem finding a class file which is inside a jar(xercesImpl.jar) which is in the classpath. I cant figure out what the problem.
    I suspect it could be because my JVM is not reading the jar correctly.
    When i click on a jar, a dialog box titled "java virtual machine launcher" saying "failed to load main-class manifest attribute .." is displayed.
    Is it that there are executable and non-executable jars, and JVM will execute only the former ones ?
    Or Does this mean somethign is wrong with my JRE/JVM??
    i also tried typing "jar t xercesImpl.jar" (to see if it can print the table of files) and it doesnt do anything, doesnt even return to the prompt.
    I am on win xp and few days back downloaded jdk1.5.0 and uninstalled previous jdk.
    it seems windows has its own jre. i am bit confused which is being used.
    i m a Java newbie, so please forgive my ignorance. Any help appreciated.
    Thank you.

    Hello,
    Well seems you are going through the horror of creating application jar file from command prompt. I went through the same and finally decided to make it through jBuilder. But the trouble persisted and I was getting same error as you were getting till I explicitly specified all the third party jar files I was using in the classpath and the problem was solved.
    I recommend you to explicitly set all the jars in classpath that are being used by your application. Also set the path of any resources if you have any.
    All the best.
    Hemanshu

  • Class File Error 1046

    Hi all, I am trying to write my first class file, been away
    from flash for so long now and im just starting with as3, I have a
    problem with this class file
    I keep get an error
    here is my class // it is in the same directory as my fla,swf

    Hi ActionScripter1,
    If I am not wrong you are not using feature of a document
    class in Flash file.
    I have modified the class given by you to set it as a
    document class
    to run this code you have to do following things:
    1. Update the class with the class pasted below.
    2. Remove all the code about preloadManager from the first
    frame.
    3. set your 'Document Class' property to preloadManager
    As per my opinion this should be the way to implement a
    preloader.
    In this class you will have access to each and every object
    placed on stage. and here 'this' refers to 'stage' only.
    //Updated Class
    package {
    import flash.text.TextField;
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    public class preloadManager extends MovieClip {
    public static var l:Loader = new Loader();
    //CONSTRUCTOR for preloadManager Class
    public function preloadManager()
    trace("This is the start point of your programme")
    startPreload('123.swf');
    public function startPreload(swfFile) {
    l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    preloadLoop);
    l.contentLoaderInfo.addEventListener(Event.COMPLETE,
    preloadComplete);
    l.load(new URLRequest(swfFile));
    }//end startPreload
    public function preloadLoop(e:ProgressEvent):void {
    var perc:Number=e.bytesLoaded/e.bytesTotal;
    //percent is on my stage as a dynamic textField
    //Error 1120: Access to undefined property percent
    //how would I access this or pass it as a display reference
    to my class?
    percent.text=Math.ceil(perc*100).toString();
    }//end preloadLoop
    public function preloadComplete(e:Event):void {
    removeChildAt(0);
    percent=null;
    addChild(l);
    }//end preloadComplete
    }//end class
    }//end package

  • Can you update .class files in a running portal instance?

    We are developing with wlportal4.0 sp2/wlserver6.1 sp2 and we're having a problem
    with the .class files which define our custom servlets, tag-libraries, etc. We store
    all of the class files required by the portal under (obviously) the web-apps "WEB-INF/classes"
    directory, following the standard J2EE servlet contract. Everything works fine,
    but if we change one of the .class files while the server is running, no matter which
    .class file it is, we receive a "Webflow Configuration Error":
    Webflow Configuration Error:
    XML File: portal.wf
    Current Namespace: portal
    Configuration Error Message:
    ClassCastException was throw while trying to cast class [com.bea.p13n.appflow.webflow.internal.IPProcessor]
    to [{1}].
    .. Followed by a dump of the pipeline session and the session attributes. The only
    way to get around this we've found is to stop and re-start the portal which, obviously,
    is a pain.
    Has anybody run into this situation and found a workaround?
    Thanks!

    Seeing how your getting an webflow type error. If these classes are inputprocessors
    issue a support ticket about "hot deployments of input processors"
    -Travis
    "Joshua Davies" <[email protected]> wrote:
    >
    We are developing with wlportal4.0 sp2/wlserver6.1 sp2 and we're having
    a problem
    with the .class files which define our custom servlets, tag-libraries, etc.
    We store
    all of the class files required by the portal under (obviously) the web-apps
    "WEB-INF/classes"
    directory, following the standard J2EE servlet contract. Everything works
    fine,
    but if we change one of the .class files while the server is running, no
    matter which
    .class file it is, we receive a "Webflow Configuration Error":
    Webflow Configuration Error:
    XML File: portal.wf
    Current Namespace: portal
    Configuration Error Message:
    ClassCastException was throw while trying to cast class [com.bea.p13n.appflow.webflow.internal.IPProcessor]
    to [{1}].
    ... Followed by a dump of the pipeline session and the session attributes.
    The only
    way to get around this we've found is to stop and re-start the portal which,
    obviously,
    is a pain.
    Has anybody run into this situation and found a workaround?
    Thanks!

  • Import class file in default package (netbeans) into my jsp

    Hello all I have created a class file in the default package under Source Files in the netbeans 5 ide.
    I am having a problem importing that class file into my jsp(which resides in the Web Pages directory .
    I tried the following:
    <jsp:useBean id="dial" class="Test" scope="session" />
    my class file is Test.java
    Any help or explanation would be greatly appreciated.
    TIA!

    Will not work. Classes have to be defined in a package, the default package just wont do.
    ram.

  • Problem with applet , Not able to detect class file

    Hello friends,
    I have a swing/applet class file, and i am trying to integrate it with Tomcat webapps
    My HTMl code goes like this...........
    <APPLET ALIGN="CENTER"
                   CODEBASE="/../../classes/org/jgraph/"
                   CODE="SimpleGraph.class"
                   WIDTH="800" HEIGHT="500">
                   </APPLET>
    My classes are found inside the code base URL............
    CODEBASE="/../../classes/org/jgraph/"
    My folder structure is like below.....in which "SimpleGraph.class" is found
    D:\June5WF\Archicentro\web\WEB-INF\classes\org\jgraph\SimpleGraph.class
    My HTML resides in the following directory structure...
    D:\June5WF\Archicentro\web\WEB-INF\jsp\secure\admin\ramesh.jsp
    But When I run the JSP page .... I am Getting Class not found exception..........
    Please can anyone tell me how to solve this problem....
    I have spent 4 hrs in this......PLZ help me out.....

    Hi,
    I did not mean file object. I meant workbook object. The problem is that I can not see from your code how do you get that OLE object reference. It should be something like this
    GET PROPERTY OF h_excel 'ActiveWorkbook' = h_workbook.
    CALL METHOD OF h_workbook 'SAVEAS' EXPORTING #1 = l_file
    Regards

  • Problem in finding java class file

    I am writting an application using servlets , JSP and a simple java classfile. The simple java class file is for connection pool and the name of connection pool class is DBConnectionManager . I am using JavaWebserver2.0 and I have placed this class file in .\JavaWebserver2.0\classes
    I am placing my servlets in .\JavaWebserver2.0\servlets folder. Since I am using wfm package so my servlets are placed in .\JavaWebserver2.0\servlets\wfm .
    The problem is with compiling the servlet placed in wfm folder . I get the following error:-
    TestServlet.java:11:cannot resolve symbol
    symbol: class DBConnectionManager
    location: class wfm.TestServlet
    However when I try to compile this class in servlets folder and remove the package statement from the source file, it compiles and works very fine. I am having lot of confusion as the class DBConnectionManager is in classpath but even then compiler gives error. The same class when placed in servlets folder and package statement is removed works very fine.
    Kindly help.

    Hi,
    Is the DBConnectionManager class declared public?
    Does the TestServlet import the package that contains the DBConnectionManager?
    This is all I can come up with, with the current information.
    Cheers,
    --Arnout                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Javac probleme: bad class file error

    I'm new to java
    I have two classes myPoint.jav and TestPoint.java, when I compile them, I error:
    in the command line I type:
    C:\otman\java>javac -g geometry\src\myPoint.java TestPoint.java
    TestPoint.java:8: cannot access myPoint
    bad class file: c:\otman\java\geometry\src\myPoint.class
    class file contains wrong class: geometry.src.myPoint
    Please remove or make sure it appears in the correct subdirectory of the classpa
    th.
    myPoint p = new myPoint();
    ^
    1 error
    Can some one help me Thanks
    //Here is the class c:\otman\java\TestPoint.java
    import geometry.src.*;
         Testing my class Point
    public class TestPoint {
    public static void main(String[] args) {
              myPoint p = new myPoint();
              System.out.println("thank you very much");
              System.exit(0);
    // And here is the class c:\otman\java\geometry\src\myPoint.java
    package geometry.src;
         class myPoint members and methods of a 3D point
    public class myPoint {
         private double m_x,m_y,m_z;          // the coordinates
         public double getx() {return m_x;}
         public double gety() {return m_y;}
         public double getz() {return m_z;}
         public void setx(double x) {m_x=x;}
         public void sety(double y) {m_y=y;}
         public void setz(double z) {m_z=z;}
         public void translate(double dx,double dy, double dz) {
              m_x += dx;m_y += dy;m_z += dz;
         // Constructor ------------------------------------------------------------
         myPoint(double x,double y,double z) {
              m_x=x;m_y=y;m_z=z;
         myPoint() {
              m_x=0;m_y=0;m_z=0;
         myPoint(myPoint p) {
              m_x=p.getx();m_y=p.gety();m_z=p.getz();
    // ---------------------------------------------------------------------------------

    Thank you for the reply but still have problem.
    I created a directory classes and the directories look like:
    C:\otman\java\
    TestPoint.java
    classes\
    geometry\
    src\
    myPoint.java
    When I compile using the line command:
    C:\otman\java>javac -g -d classes geometry\src\myPoint.java TestPoint.java
    I get the error:
    TestPoint.java:8: cannot find symbol
    symbol : constructor myPoint()
    location: class geometry.src.myPoint
    myPoint p = new myPoint();
    ^
    1 error
    Now the directories look like:
    C:\otman\java\
    TestPoint.java
    classes\
    geometry\
    src\
    myPoint.class
    geometry\
    src\
    myPoint.java
    I think that myPoint was compiled without problem but TestPoint was not compiled and it gives 1 error.
    Can you help me? Thanks.<!--Session data-->

  • Multiple palette files in a library/class file causes problems

    While developing a labview class, I wanted to set the default palette, so I added the relevant dir.mnu file to the class. Unfortunately, the class already had a dir.mnu file in it. On adding the file, I got some error message about a dependency change*(which makes no sesne, how can a palette file have any dependencies !). On saving the class and then attempting to reopen it, LabVIEW claims it is corrupt. Inspecting the xml .lvclass files reveals that when I added the new paletee file, LabVIEW actually just added a second reference to the palette file already in the project, which it then considers to be a problem when it tries loading the class. This is clearly a bug on a number of levels:
    It should not be possible for the user to induce LabVIEW to create corrupt xml files through such simple attempts to use documented features.
    The underlying problem is that LabVIEW appears to be using the conventional search/linking rules to load library items irrespective of whether they are a vi (which should ahve a unique name) or other file (which might well be legitimately non-unique).
    Given the near impossibility of renaming a palette file without breaking palette links this particular bug is extra annoying.
    Gavin Burnell
    Condensed Matter Physics Group, University of Leeds, UK
    http://www.stoner.leeds.ac.uk/
    Solved!
    Go to Solution.

    Sorry for the delay, it took me a little longer to reproduce the problem systematically. Attached are three zip files of the same trivial class. The only difference between them is the contents of the class file itself.
    The key point is that I have two folders in my class - Public and Protected (although I haven't actually set the access scope I realise). Each folder has a dir.mnu file in it and there is also a dir.mnu file in the main class folder. The class virtual folder structure maps directly to the on disc version.
    In the first zip file the dir.mnu files are not added to the class.
    In the second zip dile I added the dir.mnu by right clicking and doing Add file...  This is allowed because each dir.mnu has a distinct path. I then save the class file and close it.
    To get the third zip file, I reopen the class file. I  get a single dependency warning about dir.mnu in one of the sub folders. So I think "fine ok, somethign funny about that dir.mnu file" - note if I'm loading a whole heirarchy of classes I may be told LabVIEW is laoding the dir.mnu file from somewhere completely different in my class structure. I then save the class file to give the thrid zip file.
    The lvclass file in the third zip file is corrupt because it has multiple entries for the same file, because it didn't handle having more than 2 items conflicting.
    The correct behaviour would be not to invoke the conflicting item names for non vi/ctl document types. I could imagine that there would be similar problems if I had a say a whole range of say README.html files strewn over the place.
    Gavin Burnell
    Condensed Matter Physics Group, University of Leeds, UK
    http://www.stoner.leeds.ac.uk/
    Attachments:
    Break Class File-1.zip ‏21 KB
    Break Class File-2.zip ‏21 KB
    Break Class File-3.zip ‏21 KB

  • Problems uploading class files to web server

    Regular class files upload fine(to yahoo geocities) but when I try to upload multiple class files of the same instance(ex: MyProg.class, MyProg1$.class, MyProg1$2.class) the ones with the $ symbols wont upload therefore rendering my applet on my website useless. I can change the name and then upload it, but when I go to rename it within the site, I get an "invalid file name" error. I just want my applets to run on my web page so that people can play with them.
    Any help would be greatly appreciated!
    Scott Miller

    AOL is the same. Note that the xxx$.class files relate to inner classes and you can solve your problem by removing them and creating seperate classes for these.

  • Problems trying to "hot-deploy" class files in iPlanet. Want to deploy a compiled class (i.e. servlet, jsp) without having to bounce the server. Known issue in iPlanet? How can I get around?

    Currently iPlanet is not allowing us to hot deploy a modified class file(i.e., servlet) as it advertises. It doesn't seem to have a problem with jsp's however. But everytime we modify a servlet(say in an emergency), and wish to deploy, we still have to bounce the KJS. We would like to avoid this if possible. How? I heard this might be a known issue in iPlanet.

    I apologize but this is a clarification of this problem. We are having a problem dynamically reloading java classes that are referenced by jsp's and servlets. The problem DOES NOT exist when trying to reload jsps or servlets themselves. We would like to reload these classes without having to restart the processes. Any thoughts would be helpful. Thanks.

  • RMI class file problem

    I have already write a RMI example for self-study successfully, but there are a little class file problem that I'm not able fix it.
    In my RMI example there are 3 .java files (RMIServer.java, RMIClient.java and a MethodImpl.java)
    After I have javac and rmic them, I got RMIServer_Skel.class, RMIServer_Stub.class, RMIClient.class and the MethodImpl.class
    In order to run the RMI in a local envirnment, I divide them into 2 folders as listed below:
    Server - RMIServer_Skel.class, RMIServer_Stub.class and the MethodImpl.class
    Client - RMIServer_Stub.class, RMIClient.class and the MethodImpl.class
    Then when I start to run them in a DOC envirnment...
    start rmiregistry........(run successful and another rmiregistry DOC window created)
    java RMIServer.........Exception in thread "main" java.lang.NoClassDefFoundError: RMIServer
    Oops? Class not found? How can that be? And after that, I tried something.......to add the RMIServer.class into the Server folder.
    Again, I start to run them in a DOC envirnment...
    start rmiregistry........(run successful and another rmiregistry DOC window created)
    java RMIServer.........The server is instantiated(run successful and print out a String)
    Um...is the RMI have to run with a RMIServer.class file? But the RMI notes I refered from is not seems to be telling me to do this, are there any one can give me a helping hand?

    please, go here, read thoroughly
    http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html

  • Problems on zipping and unzipping class files

    I am trying to add a class file to a new jar file using FileInputStream and JarOutputStream.
    I am getting a very unique problems.
    when I read a class file using FileInputStream from my local hard disk I am getting 30 bytes less than then actual file size (the difference in bytes is exactly 30 bytes for any file, either class or xml or java, I dont understand this concept). after reading the contents I am writing the bytes read to a jar file using JarOutputStream. This all gets done fine. But when I extract the class file written into the jar file and try to run the class it is giving me the exception as follows:
    java.lang.ClassNotFoundException: com.wipro.flowbrix.plugins.factory.NewClass
    Exception in thread "main" java.lang.ClassFormatError: com/wipro/flowbrix/plugins/factory/NewClass (Bad magic number)
    at java.lang.ClassLoader.defineClass0(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$100(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.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    The classpath to the folder from where I am running the file is set. I have double checked the classpath.
    any information or solutions regarding this would be of great help.

    A "magic number" is a short sequence of data at the beginning of a file used to identify the file. ".class" files, for instance, always start with OxCA, 0xFE, 0xBA and 0xBE.
    If the 30 bytes missing are at the beginning of your file, there's nothing suprising in getting a "ClassFormatError" exception.
    I think we should concentrate on your first problem. Can you post the code used to add the class file, please?
    /Stephane

Maybe you are looking for