Help compiling with .class files

I am using JGrasp and I am trying to compile a program that uses .class files instead of the .java files, but JGrasp will not recognize these at compile time. How do I get my program to compile with these .class files?

I prefer using Jenuity:
[http://www.nmmu.ac.za/jenuityIDE]
It's much simpler to use than JGrasp and isn't nearly as confusing.
For the record, you compile .java files into .class files. There is no need to "compile" existing .class files. If you have the class files you can run them from the command line. e.g. if you have a class file named Orange.class you should be able to type "java Orange" from the command line to run it. If Orange is inside a directory structure based on packages you may need to execute this command from just outside the 'highest" folder.
If you just need to link to these class files, copy them into the "/jre/lib/ext" folder of your JDK.

Similar Messages

  • Urgent help needed with class file platform transfer

    Hi,
    I am working at home on Java in the windows (2000) system. Now I have compiled a java source code which compiles fine. This is an applet and works fine.
    However, when I am uploading the files( class files generated and the html file) to the Sun Unix system, the applet does not work. My first question is: Does this class file generated in Windows system not transferable in the Unix system?
    At this point, I uploaded the java source file to the Unix system. The source file has been created in Textpad in the Windows environment. Now using telnet I used the javac command to compile the source file in Unix system. Now, I am seeing three errors which was not the case in the Windows environment? I have no idea why the same source code is working on one platform and producing error in another?
    Any help is highly appreciated. Thanks. Regards.

    What are the errors?

  • Need help with "class file contains wrong class"

    I have a dbUtil package as
    package dbUtil;
    public class dbConfig {
    public String getHost(String db) {
    This file called dbConfig.java has been compiled with -d option and rthe class files resides in dir <install_dir>/webapps/test/WEB-INF/classes/eb/dbUtil/
    I have a jsp file in <install_dir>/webapps/test/test.jsp which imports the dbUtil package
    <%@ page import="eb.dbUtil.dbConfig" %>
    and I am getting this error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: -1 in the jsp file: null
    Generated servlet error:
    [javac] Compiling 1 source file
    /opt/hpws/tomcat/work/Standalone/localhost/test/test_jsp.java:12: cannot access eb.dbUtil.dbConfig
    bad class file: /opt/hpws/tomcat/webapps/test/WEB-INF/classes/eb/dbUtil/dbConfig.class
    class file contains wrong class: dbUtil.dbConfig
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    import eb.dbUtil.dbConfig;
    ^
    1 error
    Can anyone tell me what am I doing wrong? I am using tomcat 4.1
    Thanks!
    L.

    Given your java file, the fully qualified name of the class is dbUtil.dbConfig.
    What you are importing is eb.dbUtil.dbConfig
    These things are not the same.
    The root of the classpath for the webapp is the classes directory.
    So either
    1 - specify dbConfig.java to be in package eb.dbUtil
    2 - move the class file into web-inf/classes/dbUtil/dbConfig.class, and import dbUtil.dbConfig.
    Also, by convention, classnames should start with a capital letter ie dbUtil.DbConfig.
    Cheers,
    evnafets

  • Deploying application with class files compiled using ojspc

    Hi,
    I want to deploy the application having class files compiled using ojspc in Oracle9iAS Release 2 rather than having JSP pages.
    Thanks,
    Pritam

    Hi Manoj,
    I have tried doing something like this.
    If you want to try this out running on a NW2004s.You need to first download the entire project from perforce branch (
    tc\webdynpro\clientserver)for NWDS 7.0 and then build the project locally in your java perspective.
    During the local build of the project.It will also point out the dependent projects required by this project(clientserevr).
    Once the project is build.
    Create seperate external jars of the clientserver project and its dependent projects and save them locally.
    Open your SDM manager,pick up this jar file from there and deploy it.
    Once the deployment is over, the server is ready to run the application you created.
    But this make your NWDS2004s to behave jus like NWDS7.0 .
    Just a small suggestion ,instead of going through this tedious process you can shift to NWDS7.0 itself.
    regards
    aarthi mathivanan

  • Compiling with classes in seperate directories

    Hey guys,
    I wish to compile my program like this:
    ./program/src <---- for the .java files
    ./program/classes/ <---- for the main class
    ./program/classes/mainLib/ <--- for all other class files.
    Am i right in thinking that this would be a package thing. So i would have to alter the package line in the programs to get this to work?
    So the main class would have:
    package classes;
    and the rest would have:
    package classes.mainLib;
    I'm just having a bit of trouble compiling it successfully.

    So from what i understand. I should compile itfrom
    the source directory using something like this:
    javac -cp ../classes/mainLib -d ../classes *.javaAlmost; the top level classpath is located at
    ../classes; all .class files can be
    found in there or in subdirectories (reflecting the
    package names) thereof.
    You see i want one of my classes to go here:./classes
    That should be a class without a package definition
    then, i.e. the default package.
    And the rest to end up here: ./classes/mainLibOk, they should all have a 'package mainLib;'
    definition at the top.
    I want the compiler to do this automatically.
    Am i right in thinking this is to do with package.
    So if i put this in the file i want to end up onits own:
    package classes;Nope, the ../classes directory was the toplevel
    directory remember? All sub-
    directories under that reflect the package names.
    and then:
    package classes.mainLib; in all the other files itshoudl work. But do i need to
    use any import statements on this?See above: the ../classes directory is the base where
    all your .class files can be
    found. If a class belongs to the default package, it
    can be found directly in this
    directory; any .class file in a package 'X' can be
    found in ../classes/X.
    Just to summarize:
    if you don't put a package definition in your source,
    the .class file should end up
    in the ../classes directory. If you put a 'package
    x;' definition in your source, it
    should end up in the ../classes/x directory. Your
    (-cp) classpath string should
    just point to the ../classes directory, i.e. the base
    where all your .class files can
    be found.
    Thanks a lot for your help.You're welcome and,
    kind regards,
    JosThat was a brilliant description and i fully understand now - thanks!
    I'm trying to do it now. All of my files contain: package mainLib, apart from the one i want to end up in the main class directory. So i try this:
    gary@linuxbox:~/java/cars/src$ javac -d ../classes/ *.java
    ./Storage.java:5: duplicate class: mainLib.Storage
    class Storage { // used to control the data stored externally
    ^
    Cars.java:16: cannot access Storage
    bad class file: ./Storage.java
    file does not contain class Storage
    Please remove or make sure it appears in the correct subdirectory of the classpath.
                    Storage file = new Storage();
                    ^
    2 errorsThat was run from: ./program name/src
    I want the classes to end up in ./program name/classes (where mainLib) is located
    So i then tried:
    gary@linuxbox:~/java/cars$ javac -d ./classes/ src/*.javThat produced A LOT of errors saying it couldn't find the construcutrs from the classes it needed.
    Is it obvious what i am doing wrongly?

  • Need help compiling external jar files into my one jar file from cmd line

    Here is my problem, let me see if I can explain it right:
    I am making a jar file on my development computer that will run my java project. In this java project, it references a couple Java3D jar files. On my development computer, I create the jar file and it runs correctly, but when I move that jar file over to the test computer, the parts of the application needing those Java3D jars are not found in my jar I created. I isolated the problem and it is because those Java3D jar files I needed are not on my test machine. But that is the way I need it to be. I need it so that when I compile all my code on the development machine, I need it to also compile those two Java3D files into my one jar that I move to the test machine. You get what I'm saying? I must do all the compiling from the command line and have only one jar file to put on the test machine that contains all my compiled code and the two Java3D files needed to run some of the applications in the project.
    Here a brief sample of what I'm doing:
    To compile my java files in my project, I simply to this for all my files:
    javac file.java
    javac file2.java... and so on for all my java files.
    Then I create my jar file:
    jar -cfm MyJar.jar manifest.mf file.class
    jar -fmu MyJar.jar manifest.mf file2.class... and so on for all my class files.
    Also when compiling my jar file, I do this thinking that it would include the two Java3D jars into my one jar file:
    jar -fmu MyJar.jar manifest.mf jars/j3d-org-images.jar
    jar -fmu MyJar.jar manifest.mf jars/j3d-org.jar
    My manifest file looks something like this:
    Manifest-Version: 1.0
    Main-Class: Main
    Class-Path: jars/j3d-org.jar jars/j3d-org-images.jar
    Do I have to have that Class-Path in there pointing to those jar files? Those jar files will not exist on my test machine because the directory structure will not be the same. I've tried a manifest without specifying my Class-Path to those jar files, but I get the same problem when I run my application on the part that needs the Java3D files.
    The error I am getting is that there is a RasterTextLabel class inside one of those Java3D jar files that my application cannot access because those jar files are not on my test machine.
    So basically what I really need to know is how I get those two Java3D jar files compiled into my one jar file that I move to a test machine and run with the following command:
    java -jar MyJar.jar
    Can anyone help me??
    Thanks.

    Here what you need is to have all the files present in a single jar file, and the classpath is set properly to the required jar files.
    Do the following in steps:
    1)
    Create a custom manifest file,say mymanifest.mf, with the following contenets, put it in current directory:
    Manifest-Version: 1.0
    Created-By: 1.4.0_01 (Sun Microsystems Inc.)
    main-Class: Main
    Class-Path: jars/j3d-org.jar jars/j3d-org-images.jar <press ENTER key>
    2)
    jar -cfm MyJar.jar manifest.mf file.class
    jar -fmu MyJar.jar manifest.mf file2.class... and so on for all class files.
    3)
    jar -fmu MyJar.jar manifest.mf jars/j3d-org.jar
    jar -fmu MyJar.jar manifest.mf jars/j3d-org-images.jar
    (Make sure that j3d-org-images.jar and j3d-org.jar are present in a subdirectory called 'jars')
    Now you would be able to run,
    java -jar myjar.jar

  • How do you compile multiple class files in a unix cmd prompt?

    I have been using Java for a few years now, but for some reason I have a course that requires us to compile/run and hand-in our java assignments using Unix...
    I know how to compile a simple program on unix with a single source file, but how the heck do you compile and run a program with say... 2 or more sources files linked together?
    I really doubt the answer is just type
    javac java1.java
    javac java2.java
    javac java3.java
    and then running the source file with the main in it.
    Hopefully someone here can help me.
    Thanks
    Roger

    okay, well I took some time to read up online how to do this and I guess i'll answer my own post just in case someone else wants to know the answer.
    2 ways I found were:
    1)For example, you can list all of the source file names in a file named sourcefiles. This file might look like:
    MyClass1.java
    MyClass2.java
    MyClass3.java
    You could then run the compiler with:
    % javac @sourcefiles
    2)Or if all the files are in the same directory you can do this:
    This example compiles all the source files in the package greetings.
    % ls
    greetings/
    % ls greetings
    Aloha.java GutenTag.java Hello.java Hi.java
    % javac greetings/*.java
    If that is confusing to read I found all the answers from this webpage:
    http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javac.html

  • Help needed with jar file

    hi, first of all sorry if my post is in wrong forum...but my application is done using swing so i am posting this here....and regarding my question...
    I have made an GUI using Java swings and my application is working fine. Now i want to make an executable jar file for my GUI. I have read some tutorilas on making jar files and this is what i have done...
    i have created a manifest file called mainClass.txt which has
    Main-Class: MainWindow ,where MainWindow is my main class name.
    Then i ran the jar utility with this command line:
    jar cmf mainClass.txt example.jar *.class
    With this line, I told jar to create a JAR file (option c) with modifications to the manifest file (option m) as specified within mainClass.txt, naming the JAR file (option f) as example.jar and including everything that matches the pattern *Class
    everything is file till now but my problem is ...I have some library files from JFreechart software included in my GUI to generate barcharts..How can i include these library files in my example.jar file..
    Kindly help me
    Thanks
    byee

    I had this problem too. I ran my program out of JCreator and it worked flawlessly. I jarred it up into and Executable Jar and I would get a runtime error explaning I have not included the correct libraries.
    What I did was look at the error, for example say it said something like:
    org.uhoh.PathSys ClassDefNotFound (or something similar to this)
    What I did was extract the library that contained that class file. Then in my project file where I kept my classes I made the folder org, then in org I made uhoh. Inside uhoh I copied over PathSys.class.
    I hope I addressed the problem you speak of. I am only a novice but this is how I figured it out. If anyone knows a better way let us know =D

  • Is it possible to get the Source from the Compiled Java Class File?

    Hello All,
    I wrote a java file which uses Java Swing to crea a GUI.I have also compiled the jave file.
    The problem now is that i've made many changes and compiled it many times.Now suddenly due to some problem,the contents of tha Java file have been deleted and it shows 0 bytes.
    Is there any way to recover my Java source file from the Class file?I would be thankful to anyone who can help me out on this.
    Thanks in Advance,
    Regards,
    Vijayakannan

    Yes and no, you can reverse engineer it to an extent, it wont look exactly like your original source though, it'll be full of commented out bytecode bits etc. As its your own code though you've got the best chance of deciphering it. Go to somewhere like www.tucows.com to download the software for doing it.
    ARB

  • IdcApache2Auth.so Compiled With Large File Support

    Hi, I'm installing UCM 10g on solaris 64 Bit plattform and Apache 2.0.63 , everything went fine until I update configuration in the httpd.conf file. When I query server status it seems to be ok:
    +./idcserver_query+
    Success checking Content Server  idc status. Status:  Running
    but in the apache error_log and I found the next error description:
    Content Server Apache filter detected a bad request_rec structure. This is possibly a problem with LFS (large file support). Bad request_rec: uri=NULL;
    Sizing information:
    sizeof(*r): 392
    +[int]sizeof(r->chunked): 4+
    +[apr_off_t]sizeof(r->clength): 4+
    +[unsigned]sizeof(r->expecting_100): 4+
    If the above size for r->clength is equal to 4, then this module
    was compiled without LFS, which is the default on Apache 1.3 and 2.0.
    Most likely, Apache was compiled with LFS, this has been seen with some
    stock builds of Apache. Please contact Support to obtain an alternate
    build of this module.
    When I search at My Oracle Support for suggestions about how to solve my problem I found a thread which basically says that Oracle ECM support team could give me a copy IdcApache2Auth.so compiled with LFS.
    What do you suggest me?
    Should I ask for ECM support team help? (If yes please tell me How can I do it)
    or should I update the apache web server to version 2.2 and use IdcApache22Auth.so wich is compiled with LFS?
    Thanks in advance, I hope you can help me.

    Hi ,
    Easiest approach would be to use Apache2.2 and the corresponding IdcApache22Auth.so file .
    Thanks
    Srinath

  • Help needed with .asp files

    I am not sure what I am asking or what I need to do, so please bear with me, thanks.
    I am helping out with a site that has one dynamic page utilizing a database with an .mdb extension.
    Previously hosted on a site with ASP (not sure which version).
    New host has MySQL with PHP (?)
    I would like to be able to rework the one dynamic page in DW, using .php. I am not able to upload the .mdb file to my localhost MySql area.
    It all comes down to the database.....
    Is there a way to convert the .mdb file to one with an .sql extension?
    Or am I taking the wrong approach?
    Thanks,
    Melissa

    >Previously hosted on a site with ASP (not sure which version).
    >New host has MySQL with PHP (?)
    Are you sure the host doesn't also support .asp?
    >I  would like to be able to rework the one dynamic
    >page in DW, using .php.  I am not able to upload the
    >.mdb file to my localhost MySql area.
    An mdb file is MS Access. There are conversion utilities that will convert between the two dbms's, but if the schema is not complex you can simply build the new database in MySQL, export the data from access and then import it.

  • Help me with jar file...

    I have created a jar file with the following cammand
    jar cvf XXX.jar com images
    where com is the folder which holding my all .class files and images is the folder which hold all my image files.
    but the prob is that when i run my jar file with the following command
    javaw XXX.jar com.Main
    Main is the main class
    i can't see nay images on my buttons in short i can't accress images files...

    satinderjit,
    Here is some code that you can use to grab an image (whether in a jar or not). Note though that your .class files will live in the com directory. So, in order for your images to load (with image path = "images/myImage.gif", you either have to move your image folder to your com folder or use the following string for your image path "../images/myImage.gif".
    /*=*******************************************************************
    * getImage(): grabs an image from the same location this file is at. *
    *     Works for when the images are in a jar or not.                 *
    public static Image getImage(String img) {
       /* Replace the 'YourClassName' with the name of your
          class.  Note that the .class file of the class
          that this method resides in must be placed
          relative to where the images are stored.  So
          if the images are in a folder called images,
          this .class file must be placed in its parent
          directory. */
       URL url = YourClassName.class.getResource(img);
       Image image = null;
       if (url == null) {
          System.err.println("Unable to load image: " + img);
       } else {
          image = Toolkit.getDefaultToolkit().getImage(url);
       return image;
    }//end getImage
    /* use the above method in the following manner
       (notice the forward slash).   The image path I
       provided should work with your current setup. */
    ImageIcon icon = new ImageIcon(getImage("../images/myImage.gif"));tajenkins

  • Run app with Class Files from JBuilder

    Hi,
    I have Java class files (at this point no java source code/files).
    How can I run the application from JBuilder with these class files.

    Thank you Annie.
    I want to run JBuilder in debug mode.
    Basically my application connects to the Sybase db. It will get some data from tables. But when I am running my app in debug mode ... I am hoping that it will show me the data. I dont see any data from the db tables.
    Do I need to setup anything else to see what data it is selecting through JBuilder

  • How do i compile a class file to become an exe (application file)

    I know jbuilder and other 3 rd party software are able to to that. I just want to know whether jdk1.3 compiler able to do it...

    Hm ...
    if you think of a compiler producing an executable file, this means, the application is compiled, linked and bound at file-level - what about the features of loading and linking classes during runtime or the ability to replace class files during runtime and load/link it dynamically?- Guess, a compiler for java can compile static applications, which need no dynamic linking of classes, but is it also able to keep this functionality of java this way?- I don't think so (but I never tested one of these compilers).
    greetings Marsian

  • Help: Working with .MOV files in FCP and forced to RENDER FOR EVERY EDIT

    I'm working with .MOV files from my digital camera in Final Cut Pro and every time I make a new edit, I have to render it in order to see it in the canvas.
    How do I make it so that I don't have to render every edit in order to see it?
    (I've worked with files straight from a DV camera, and editing went fine. I'm assuming it has to do with the .MOV files)

    DV Cameras are not the same thing as a Digital camera. Digital cameras offer video on a limited basis and it's usually highly compressed in a non-editing format such as MPEG-2 or similar. NLEs are made to work with video cameras, not still cameras which is why you're having trouble.
    That's not to say you can't edit video captured with a digital camera, but you need to know how to prep it for editing. Some digital cameras shoot at odd frame rates and they all use some form of compression that is not typically used in editing. This means that you'll likely need to convert your clips to an editable format first using Compressor.
    Andy

Maybe you are looking for

  • I want to find a particular word in a file

    Hi, I have got the contents of a file in a ArrayList using : String name = null;      ArrayList<String> myArrayStrings = new ArrayList<String>();Then got a word using : myArrayStrings.get(r) This word was generated randomly and in a loop so I dont kn

  • HP LaserJet Pro 400 color MFP M475dn (CE863A), Localisation?

    Hi! Is there RUSSIAN menu in HP LaserJet Pro 400 color MFP M475dn (CE863A)? Thank you

  • Why are my fonts changing while I type in cs5?

    I just got a new PC and installed AI CS5.  Been using it for a long time with no issues on previous PC.  Now when I attempt to edit text, while I type the font mysteriously changes to Chinese characters or some odd, widely spaced serif font.  Type me

  • No OCR

    I personally think HP has reached a new low. The web site is pittyful and has little info for us. I simply wanted help with OCR and not one place on this stupid web site helps. OCR is a simple process and needed often yet nothing works on the D110 pr

  • T61p Nvidia drivers - new drivers give jerky DXVA playback

    I gave another shot at installing the latest drivers for my Nvidia FX 570M, but it seems that CUDA does work well when there are other applications running in the background. When I play 1080p (or 720p)mkv files, there is a jerkyness, audio and video