How can i call java class file in jsp page

Hai,
i wants to call .class file in jsp page.
my class file is in C:\jsdk\bin.
Thanks

I'm not entirely sure what you mean by "calling a class file", but I'm going to assume that you want to do something like the following in your page:
<%
MyClass myClass = new MyClass();
myClass.someMethod();
%>etc
If that's the case, then all you have to do is make sure that the class is in the servlet engine's classpath. You'll probably also need to include an appropriate import statement at the top of the page.
Hope that helps.

Similar Messages

  • How can we call a class file of one package for class file of another

    How can we call a class file of one package from class file of another package and both packages exist in a same folder

    How can we call a class file of one package from
    class file of another package and both packages exist
    in a same folder
    Luckily they don't so it's really not a problem after all.

  • How to call java class file from jsp

    hi
    we need to call java classes (which are written separately in .java file )from jsp file. we need it for our project if anyone knows about please reply us.
    bye
    siva sankari

    you can call the methods in a lot of ways. you could use scriptlets with the
    <%@ page import="package.class"%> and then inside instantiate an object
    <%
         MyClass mc = new MyClass(parameters if any);
         mc.theMethodYouWantToCall();
    %>or as Madathil has stated,
    or use the JSP tags
    <jsp:useBean id="anyname" class="classname"/>and then use the getProperty tag
    or even Custom Tags

  • Loading Java Class File in JSP page

    I'm trying to load a java class file from a jsp page.
    (e.g. MyFile.java <-- Source "MyFile.class<--Class file of MyFile.java")
    jsp page
    <%@ include file = "MyFile.class" %>
    <HTML> // HTML Tags are here
    MyFile.java
    A normal java source file that has "public static void main" in it.
    My jsp page can display it's contents, 'except' for showing e.g. "1235%%215648%%public%%$$@##" through out the page...
    My guess is that it can't display my java class file..
    Can anyone please help me solve this problem of mine ?
    Thanks in advance : )
    Yours Sincerely,
    RainbowEnergies

    This is my JSP file.
    <HTML>
    <HEAD>
    <TITLE>Activity Games</TITLE>
    </HEAD>
    <%
    String name = "";
    String id = "";
    name = session.getAttribute("name").toString();
    session.setAttribute("name",name);
    id = session.getAttribute("id").toString();
    session.setAttribute("id",id);
    %>
    <BODY bgcolor="#cc99ff" text="#000000" link="#E3E3E3" vlink="#CCCCCC" alink="#FF0000">
    <H3><%=name%>, you have enter Activity Games</H3>
    <%@ page import="Games.Lufia.*" %>
    <%Lufia lufia = new Lufia();%>
    </BODY>
    </HTML>
    After I execute...
    An error occurred at line: 18 in the jsp file: /jsp/ActivityGames.jsp
    error: File C:\Program Files\Apache Tomcat 4.0\webapps\website\WEB-INF\classes\Games\Lufia\Lufia.class does not contain type Games.Lufia.Lufia as expected, but type Lufia. Please remove the file, or make sure it appears in the correct subdirectory of the class path.
    Generated servlet error:
    C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\website\jsp\ActivityGames$jsp.java:85: Class Games.Lufia.Lufia not found.
    Lufia lufia = new Lufia();
    But if I comment this out....
    This is my JSP file.
    <HTML>
    <HEAD>
    <TITLE>Activity Games</TITLE>
    </HEAD>
    <%
    String name = "";
    String id = "";
    name = session.getAttribute("name").toString();
    session.setAttribute("name",name);
    id = session.getAttribute("id").toString();
    session.setAttribute("id",id);
    %>
    <BODY bgcolor="#cc99ff" text="#000000" link="#E3E3E3" vlink="#CCCCCC" alink="#FF0000">
    <H3><%=name%>, you have enter Activity Games</H3>
    <%@ page import="Games.Lufia.*" %>
    <%//Lufia lufia = new Lufia();%> <--- comment this out.... (HERE)
    </BODY>
    </HTML>
    The page shows but did not run my java class file..
    Thanks again for trying to help me solve this problem of mine. : - )
    Regards,
    RainbowEnergies

  • How can i call java class implemented as service from ExtJS after successfull activation of a page ?

    Hi ,
    I want to call a java class implemented as a service in felix . This should be called after succesfull activation of the page .
    I want to use ExtJs implemented in /libs/cq/ui/widgets/source/widgets/wcm/SiteAdmin.Actions.js file CQ.wcm.SiteAdmin.activatePage method.
    Please suggest something on this .

    Hi Sham ,
    i tried this ,
    var response = CQ.HTTP.post(
            CQ.shared.HTTP.externalize("/bin/replicate.json"),
            callback,
            { "_charset_":"utf-8", "path":paths, "cmd":"Activate" }
    if (CQ.HTTP.isOk(response)) {
         CQ.HTTP.post("/bin/sample.json",
                  null,
                  {"_charset_":"utf-8","path":paths});
    It is giving an alert messege on siteadmin screen as "Unspecified Error" .
    What can be the problem , am i missing something here?

  • Call java class file into jsp file

    Hello experts,
    I wrote a class file which have validation functions it successfully created a class file of that java file.
    and I puted that class file into tomcat's ../WEB-INF/classes folder.
    And whenever I am going to execute the jsp page it give error like
    "regexFunctions cannot be resolved to a type"
    My class file is like follows,
    import java.util.regex.*;
        public class regexFunctions
        private static int SUCCESS = 0;
        private static int FAILURE = 1;
        private static int MISSING_INFO = -1;
        public static String ALL_STRING_REGEX = "^[a-zA-Z]+$";
        public static String ALL_NUMBER_REGEX = "[0-9]+";
    public static int checkForString(String inputtedValue)
             int retCode = FAILURE;
             if ((inputtedValue != null) && (inputtedValue.length() > 0))
                 Pattern pattern = Pattern.compile(ALL_STRING_REGEX);
                 Matcher matcher = pattern.matcher(inputtedValue);
                 if (matcher.find())
                     retCode = SUCCESS;
             return retCode;
    }My jsp page is like follows,
                <%
                     regexFunctions reg = new regexFunctions();
         String id = request.getParameter("txtId");
         int i = regexFunctions.checkForString(id);
               %>So Please Let Me Help Out...

    Put it into a package. Classes in packages can't access classes with no package, since about 2003.

  • Than how can i get java class by using it's class file?

    Hi
    After compilation of a java program, it creates a class file.
    After getting class file suppose class file has been deleted.
    Than how can i get java class by using it's class file?
    Thanks in advance.

    get a decompiler and run your class file through it--I'll assume you want the source code back and that you are not trying to recover a missing class file by attempting to use the class file that is missing--if it's missing, then I've not a clue on how to get it back by using what is already missing.
    BTW: many of your compilers have source control--if it does, just restore your missing file.

  • How can i call forpro prg file from java

    Hai friends,
    I have a doubt,clear it.
    how can i call forpro prg file from java file
    by,
    N.Vijay

    Thanks to your reply,
    I have some print statements in my foxpro program file.
    Then i like to invoke that foxpro file from my java file
    This want i want..,
    by,
    N.Vijay

  • How can I hide the class file ??

    Hi !
    I has a question, when i write a program of Java, then use the command "javac" to compiler to class file for other people using, but the class file can be disassembled and convert to source code. How can I hide the class file and let people can not disassemble, or can not see the source code. Thinks

    See these....
    http://www.saffeine.com/
    http://www.jarsafe.com/
    I recently read this. This will help you.
    http://developer.java.sun.com/developer/qow/archive/160/index.jsp
    Enojy....
    Rajesh

  • How can I convert a class file to Exe file

    hai
    How can I convert a class file to Exe file

    Please search the forums before asking questions - this has been answered hundreds (really!) of times.

  • How can i call a zreport from my bsp page.

    Hi friends,
    How can i call a zreport from my bsp page.
    Moosa

    Hi Friend,
    These are the codings  to be wirtten in BSP for transferring values to the REPORT
    DATA:wf_date TYPE ztable-ID.
          data:seltab type standard table of rsparams,
           wa_seltab like line of seltab,
         event TYPE REF TO if_htmlb_data.
    DATA:p_value TYPE REF TO CL_HTMLB_INPUTFIELD.
    event = cl_htmlb_manager=>get_event( runtime->server->request ).
    p_requ ?= CL_HTMLB_MANAGER=>GET_DATA(
                                            request  = runtime->server->request
                                            name     = 'inputField'
                                            id       = 'i1'
    if p_requ is not initial.
      wf_date = p_requ->value.
    endif.
    clear wa_seltab.
    if wf_date is not initial.
      wa_seltab-selname = 'P_REQU'.
      wa_seltab-kind = 'P'.
      wa_seltab-option = 'EQ'.
      wa_seltab-low = wf_date.
      append wa_seltab to seltab.
    endif.
    submit *ZSAMPLEAP1* with selection-table seltab AND RETURN  .(ZSAMPLEAP1 refers to the report name and AND RETURN for coming back to the BSP page after the completion of its operation in Report )
    IMPORT int_name TO int_name FROM MEMORY ID '*zid*'.(For importing the obtained value from Report)
    In Report
    REPORT  ZSAMPLEAP1.
    SELECT-OPTIONS: p_requ FOR ztable-id  NO INTERVALS.
    SELECT SINGLE name from ztable into int_name WHERE id = p_requ-low.
    WRITE:int_name.
        EXPORT int_name TO MEMORY  ID 'zsharmila'.
    With Regards,
    SHARMILA BRINDHA.M

  • How to read the java class file to convert it in java.

    hello all,
    i m developing the java application which generated the java code from the java 'class file' .
    Can anybody please help me, Is any java support for reading the class file? or how to know the class file format?
    I know the application javad, jad, javap which is doing the same thing.
    thanks for reply,
    - Jayd

    do you mean decompiling? there are tons of java decompilers available out there, what exactly are you trying to do here?

  • SQLPLUS: How to verify that java class file have been loaded

    Hi All,
    I just loaded my Java class file using CREATE OR REPLACE JAVA.
    Java was created sucessfuly, but how can I check or find out if my file have been loaded correctly.
    I also found a command :
    SQL>exec myjava.showobjects
    but i don't have the loadjava utility install....is there any command from SQL PLUS?
    thanks

    Thanks for the sql command....after that query what do I do next to see if for example tree.class is in the dba_object.
    Sorry, I am a newbie and the question may be a bit generic .....

  • How to sign a java class file!

    My applet program performs file i/o,loadlibrary operations.so i create a jar file which contains the all java class files of my appln and signed this jar file.My applet prgm works fine.
    But now my plm is, i should not create a jar file.how to sign class files? if anybody knows,plz help me.....

    Why can't you create jar files?

  • How can i call a DLL file from labview?

    Iam using a sensoray 2601 module.It is given as DLL file(S2600.DLL).How can i call this function from LabVIEW?
    Please Mark the solution as accepted if your problem is solved and donate kudoes

    As far as I can tell problems might occur with the call library function node if the the DLL from visual basic is actually an ActiveX dll if that is the case it seems calling the dll by using the Invoke node is the way to go.
    Have a look at this 
    /sletten

Maybe you are looking for

  • mx:Image no image preview in Design Mode

    Inside my Flash Builder (4.01) AIR project, the image preview in design mode for the mx:Image component does not show the image set with the source attribute. This seems to be a project specific problem. When I create a new project , insert mx:image

  • I recently updated my IPhone 4s to os 6 and my screen is frozen that I can't s

    I recently updated my iphone 4s to OS6 and now my phone is frozen. I can't even slide to unlock the phone.

  • Importing dvd's/music dvd's

    Does anyone know if music dvd's and movie dvd's can be imported to iTunes and then to the iPod? I have several I want to put in but I can't get it to work. Is there a program or a back door?

  • I seem to have Distortion in Podcasts only...

    For some reason when I download podcasts onto my Nano the audio distorts occasionally. They will be speaking and everything sounds great that you can't understand them for a bit then it returns to normal. This happens all throughout the podcasts and

  • Contact Manager Sample Application

    Hi Guys, I'm getting this error messages when I loaded contactmgr.mxml [MessagingError message='No service is configured to handle messages of type 'flex.data.messages.DataMessage'.'] at mx.messaging.config::ServerConfig$/getServiceIdForMessage() at