Importing class files

Hi,
I'm new to Eclipse and need help.
I have been given a folder with 5 classes and 1 class with a main method.
My first question is: Is there a way to import these classes into eclipse and run the main class with main method? I don't have any java files.
What I have to do is basically write a java source file for the main class, but without decompiling it.
My second question: Is there a way to import the 5 classes to my workspace so that I can use them when I recreate the java file for the main class?
I have tried searching everywhere, but could not find a solution that worked.
Thanks

bizso wrote:
Hi,
I'm new to Eclipse and need help.
I have been given a folder with 5 classes and 1 class with a main method.
My first question is: Is there a way to import these classes into eclipse and run the main class with main method? I don't have any java files.
What I have to do is basically write a java source file for the main class, but without decompiling it.
My second question: Is there a way to import the 5 classes to my workspace so that I can use them when I recreate the java file for the main class?
I have tried searching everywhere, but could not find a solution that worked.
ThanksI don't believe you... look at the eclipse help... it's really rather good... you need to add the directory containing those five classes to the classpath... I don't know how to do that.
AND... This is a Java forum, not the Eclipse Help Desk... Go ask in an Eclipse forum... You're likely to get better answers, and if this forum ever started to act as an "all IDE's helpdesk" then we'd buried in irrelvant gumby posts within days... so we actively try to resist the temptation to help with IDE questions... comprende?
There's a place for this, and a place for that... programmers tend to be anal about stuff like this and that.
Cheers. Keith.

Similar Messages

  • New syntax to import .class Files???

    Using JDK 1.2.2 i coul import my own class files by typing
    import ClassName;
    Using the j2sdk1.4.0 compile I get the Error Message
    `.` expected
    Is there a new synatx for importing .class files???

    Normally I don't help anyone under this username, but since the idiot Kayaman is here being his usual jerk-ness providing no meaningful help whatsoever (as usual), I'll let you in on the fact that 1.4 doesn't let you import un-packaged classes anymore. So just remove the import statement, or change your imported class into some kind of package.

  • Error wile importing class file

    hi,
    i am trying to import a class file(exp) in jsp, but it gives error mesg like unable to find the class file. the code is
    class file is plcaced in "C:\Program Files\Apache Group\Tomcat 4.1\webapps\ROOT\WEB-INF\classes"
    <%@ page language="java" import="exp" %>
    <html>
    <body>
    <%! test t = new test(); %>
    Length of Sabarish is <%= t.strLength("Sabarish") %>
    </body>
    </html>kindly help

    hai,
    try placing ur class in a package and provide fully qualified class name in jsp import
    hope this will help
    regards,
    varma.

  • Importing .class file into jsp file

    i am unable to import a .class file into my .jsp file
    please give me the correct method to import and also tell me where to deploy the .class file

    i am unable to import a .class file into my .jsp
    file
    please give me the correct method to import and also
    tell me where to deploy the .class filehttp://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-JSP.html#Section5

  • How to import class files in Rhino shell

    Hi,
    i want to test some methods of ScriptEngineContext class in
    Microsoft_Active-Directory-and-Windows_2011.1r3 collector, so i import
    some class files in Rhino shell, but some errors apeared, detail steps
    are following:
    1. steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors> cd
    Microsoft_Active-Directory-and-Windows_2011.1r3, it will apear some
    important jar packages(red fonts)
    accountImpl.js commons-codec-1.3.jar dataobject.js
    event.js joda-time-2.1.jar protoEvt.map sha1.lic
    trust.js
    account.js commons-io-2.4.jar date.js
    eventsource.js js.jar Rec2Evt.map sqlquery.js
    trusttype.js
    agent.nfo commons-logging-1.1.jar docs
    eventsourceserver.js LegacyEvtNames.map record.js sysEvents.map
    utils.js
    asset.js commons-logging-adapters-1.1.jar error_codes.map
    Evt2EvtData.map logon_types.map release.js
    syslog_facility.map vuln.js
    bsf-240.jar commons-logging-api-1.1.jar EULAs
    file.js main.js session.js taxonomy.map
    window-field.map
    collector.js connector.js
    eventcode_parsing.js identityImpl.js master.jar
    severity.map tenant.js xdas_out.map
    collectorutil.jar data event_codes.map
    identity.js package.xml sha1.js trustImpl.js
    xdas_tax.map
    2.
    steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors/Microsoft_Active-Directory-and-Windows_2011.1r3>
    java -classpath ./js.jar org.mozilla.javascript.tools.shell.Main
    Rhino 1.7 release 3 2011 05 09
    js>
    3. js> JavaPackage
    esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
    js: "<stdin>", line 3: missing ; before statement
    js: JavaPackage
    esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
    js: .....................^
    4. js> loadClass(JavaPackage
    esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
    js: "<stdin>", line 4: missing ) after argument list
    js: loadClass(JavaPackage
    esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
    js: ...............................^
    js>
    when i run JavaPackage or loadClass shell, js: "<stdin>" error apears,
    why? does anyone can help me? thanks!
    BR
    Steve zeng
    steve_zeng
    steve_zeng's Profile: https://forums.netiq.com/member.php?userid=3875
    View this thread: https://forums.netiq.com/showthread.php?t=49805

    steve_zeng;239719 Wrote:
    > Hi,
    > i want to test some methods of ScriptEngineContext class in
    > Microsoft_Active-Directory-and-Windows_2011.1r3 collector, so i import
    > some class files in Rhino shell, but some errors apeared, detail steps
    > are following:
    >
    > 1. steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors> cd
    > Microsoft_Active-Directory-and-Windows_2011.1r3, it will apear some
    > important jar packages(red fonts)
    >
    > accountImpl.js commons-codec-1.3.jar dataobject.js
    > event.js joda-time-2.1.jar protoEvt.map sha1.lic
    > trust.js
    > account.js commons-io-2.4.jar date.js
    > eventsource.js js.jar Rec2Evt.map sqlquery.js
    > trusttype.js
    > agent.nfo commons-logging-1.1.jar docs
    > eventsourceserver.js LegacyEvtNames.map record.js sysEvents.map
    > utils.js
    > asset.js commons-logging-adapters-1.1.jar error_codes.map
    > Evt2EvtData.map logon_types.map release.js
    > syslog_facility.map vuln.js
    > bsf-240.jar commons-logging-api-1.1.jar EULAs
    > file.js main.js session.js taxonomy.map
    > window-field.map
    > collector.js connector.js
    > eventcode_parsing.js identityImpl.js master.jar
    > severity.map tenant.js xdas_out.map
    > collectorutil.jar data event_codes.map
    > identity.js package.xml sha1.js trustImpl.js
    > xdas_tax.map
    >
    >
    > 2.
    > steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors/Microsoft_Active-Directory-and-Windows_2011.1r3>
    > java -classpath ./js.jar org.mozilla.javascript.tools.shell.Main
    > Rhino 1.7 release 3 2011 05 09
    > js>
    >
    > 3. js> JavaPackage
    > esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
    > js: "<stdin>", line 3: missing ; before statement
    > js: JavaPackage
    > esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
    > js: .....................^
    >
    > 4. js> loadClass(JavaPackage
    > esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
    > js: "<stdin>", line 4: missing ) after argument list
    > js: loadClass(JavaPackage
    > esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
    > js: ...............................^
    > js>
    >
    >
    > when i run JavaPackage or loadClass shell, js: "<stdin>" error apears,
    > why? does anyone can help me? thanks!
    >
    >
    > BR
    > Steve zeng
    Can you explain a little more about what you're trying to accomplish by
    this? The script engine is not really designed around facilitating
    shell-based access right now,I'd be interested to know what you can't do
    in the Debugger that you are trying to accomplish in the shell.
    brandon.langley
    brandon.langley's Profile: https://forums.netiq.com/member.php?userid=350
    View this thread: https://forums.netiq.com/showthread.php?t=49805

  • 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.

  • Flash player caches external class files

    Hi I work for a technology company in San Antonio and we use
    flash for developing interactive course ware. We use a flash shell
    which loads the separate pages of our lessons and have noticed a
    very big problem with the way the flash player caches class files.
    Basically it seems that when you use the 'import' call in
    actionscript the flash movie doesn't import the external class if
    it has already been loaded. the problem is that we have a huge
    amount of developed classes, many of which have been updated
    throughout our development. Is there any way for force clear the
    ASO cache in actionscript or force import external actionscript
    classes?

    Yes we know and use the delete aso files feature all the
    time. this however is a runtime problem. meaning that the flash
    player itself is caching class files and there is no way to get it
    to refresh these links without doing a forced refresh of the shell
    itself. this is something that is not an option as it doesn't allow
    for fluid page loading. Is there any way to force reload/import
    class files that have already been loaded, that is clear the
    class/aso cache in the flash player itself using actionscript
    code?

  • Importing my class files from another folder

    hello everybody ,im creating a software package for a new company and want to organise my class files into different folders so that it would be easier for someone to navigate through them and update if necessary ,how do i import an instance of a class in a file that is in a subfolder of the folder that contains the class that is calling it.(sorry for being a bit long winded) iv tried diff things and they didn't work.
    At the moment i have all the files in the one folder,but as i said above want to put them into appropriate folders.
    I would be very gratefull if someone could give me some examples and if not some appropriate links,thanks iv tried looking for this on the net but could not find anything.

    What you should probably do is to organise your classes into a heirarchy of packages not merely folders. Java expects the package structure to be reflected in the directory structure holding both the source and class files. If it's looking for a class called, say, com.mycompany.widgets.MainWidget it expects to find it in a directory com//mycompany/widgets relative the the directory on the class path.
    Use the package directive in each source file to indicate the package path.

  • How to import .jar files in order to use the classes within this file

    hello guys,
    I'm just wondering how can i import .jar files in order to uses the classes within this file.
    let's take an example:
    i have a folder in which I have many .jar files which contain classes to be called. the full path of this folder is set in the Classpath inside the enviroment variables.
    so does anyone have any idea how can i import these .jar files so i can use the classes?
    thank you.

    Hi,
    My problem is that: I created a Serializable class in a project. And I added this project (first project) to another project (second project). First project is appearing in the second project' s Libraries folder. No problem. I want to create a jar file from second project. i.e. I want to Build second project (I use NetBeans IDE). I am using Build Main Project tab under Run. It is falling out. I am finding it second project' s jar file under its folder. I am clicking on it. But it is NOT WORKING. Do you know WHY. Could you help me please?
    Thanks,

  • Importing a .class file into my package?

    Hi. I'm making a java program but I need to use an external .class file to get variables and use methods from. Is it possible to "import" a class file into my package to be able to do so?
    Thanks

    Basically, for our last project we created a class
    that held the information about a year: how many days
    were in a month, how many months were in a year, etc.
    etc. For this project, we'll be having to use that
    same class to make a GUI calendar. Our teacher
    provided a class which he compiled for us to use in
    our projects incase our previous class had some flaws
    in it, which mine did. Unfortunately, it's in .class
    format and I don't know how to use it in my package!That's going to be a problem then. I would assume that it is going to have an API like your old one did. Same name and same methods etc. So do you know what the name and method signatures of your class were supposed to be?

  • Whether to import the class file put in JAVA_TOP

    I have put the java class file in JAVA_TOP. Now i want to access the method in that class from jsp, is it necessary to import the class file path in jsp. Without importing the class file path how can i access the method.
    JSP Coding
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="java.*" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>
    Hello World
    </title>
    </head>
    <body>
    <%
    sample objsample = new sample();
    %>
    <b>
    NAME : </b><input type="text" value="<%=objsample.getName()%>">
    </body>
    </html>
    Class file
    public class sample
    public sample()
    String name = "JOHN";
    public String getName()
    return name;
    Pls help me

    Hi,
    For sys outs check the following log files:
    <ORACLE_SOA_HOME>/opmn/logs/default_group~home~default_group~1.log
    or
    <ORACLE_SOA_HOME>/j2ee/home/log/home_default_group_1/system_*.log
    Here server instance name is home, change it with your server instance name.
    Dharmendra
    http://soa-howto.blogspot.com

  • Importing classes from Jar files..?

    I've run into a problem that I am having some difficulty solving. I currently trying to port a two part Java UI project from Solaris to Windows. The first is a package of core classes out of which I (successfully) create a jar file. The second is a product-specific package that imports the core classes from the package created in the first. The problem is that the second package fails to build because javac says the package from part one does not exist. Here's what I know:
    - This UI (built via a Makefile) builds successfully under Solaris
    - The jar file that I created in the first part exists in the appropriate directory.
    - When I view the contents of that jar it appears as though everything is there.
    - The jar file is appropriately included in the classpath of the second build.
    Any suggestions you could provide, or resources you could point me to would be greatly appreciated

    jh.jar is a static, 3rd party component. Doesn't seem to be giving me any grief, at least not yet.
    Correct on your second point.
    This is interesting. When I open my "CoreConsole.jar"
    file, I DO NOT see any reference to the
    com.emc.avalon.core.server package, only a list of
    class files that make up that package. You should see the .class files on the left and the relative path on the right.
    Also, all of the class file listings have absolute paths according
    to the location on my machine they were built, for example:
    m:/xpe/CoreConsole/classes/com/emc/avalon/core/server/MessageLogUtility.class
    Is this a problem..?Yes, that should be a relative path, with the first entry being the first name in the package statement. So you should see an entry MessageLogUtility.class, and the path should be com.emc.avalong.core.server.
    If you can't see the class that's missing, that would explain why the class loader can't find it, either.

  • Importing classes/jar files

    Hi
    im writing a simple mail program but i need to import classes or jar files
    import com.oreilly.servlet.MailMessage;
    is the line i have but i cant find the jar file/class
    when i search for it i only get the description
    where can i find tha actual jar file or package ???

    you must to have the jar file from you want import classes if you don't have this jar you can't do this.
    if you've the jar, you must indicate to your IDE environment where can find this jar file I don't know meybe in the common menu options > Project settings...
    or if you're working with webserver (or stand alone)as Tomcat you need copy jar into /lib folder.

  • Issue in .class file in imported archive ESR - after upload using eclipse

    Dear Friends,
    My requirement here is too change existing java mapping. Here I am exporting zip file from imported archive and after making changes in eclipse upload the .JAR file again. Here .class file is not opening after upload in Imported Archive.
    Error is
    Setup I am having on my system.
    -> JDK version on my system JDK 1.6_34
    -> JRE on my system – JRE 6
    -> Using eclipse SDK 4.2.2
    SAP PI servers settings.
    I searched online blogs but no help. Can anybody guide me what wrong am I doing here?
    Thanks.
    Sumeet.

    Thanks for reply..Hareesh.
    -> In Eclipse only 1 warning is coming and no error. I guess Eclipse automatically compile .class file. Is there any way in eclipse to see if compilation is done properly?
    -> I imported few external JAR files and already few JAR files are there in Eclipse(JRE1.6), as shown in fig below. Which JAR file is being user? How can I make sure?
    -> When using Run as option I am not getting any option. Is it normal or did I have to activate some option?
    Please give your views on this.
    Thanks.
    Sumeet.

  • Custom Class file errors out on import javax.servlet.http.HttpSession

    I am trying to write a class file to handle events. This is a test class file copied from the UIX Docs. When I put this in JDeveloper 903 ,and build it the compiler gives the error:
    Error(2,27): cannot access class javax.servlet.http.HttpSession; file javax\servlet\http\HttpSession.class not found
    I am not sure what is the problem? Can anyone please help?
    Here is the code:--
    package mypackage1;
    import javax.servlet.http.HttpSession;
    import oracle.cabo.servlet.Page;
    import oracle.cabo.servlet.BajaContext;
    import oracle.cabo.servlet.event.PageEvent;
    import oracle.cabo.servlet.event.EventResult;
    public class MyClass
    /** This is handleStoreNameEvent version 1 */
    public static EventResult handleStoreNameEvent(BajaContext context,
    Page page,
    PageEvent event)
    String userName = event.getParameter("txt1");
    HttpSession session = context.getServletRequest().getSession(true);
    session.putValue("User Name", userName);
    Page nextPage = new Page("NextPage");
    return new EventResult(nextPage);
    }

    Hi, you are missing the servlet.jar file from your classpath.
    In JDeveloper, you can add this by opening up your project -> libraries and adding the servlet runtime library.

Maybe you are looking for