My First C++ Program, aget

Hi! I'm a newbie at C++. I'm following a video tutorial on YouTube by 'antiRTFM'. I've learned a lot so far, though this program was only made with what I know, so it probably has unnecessary, confusing syntax and is not anywhere near optimized. It was just a hack-together by a newbie (I don't even know anything about pointers or strcat yet!). . It's pretty rough around the edges, but it makes it a painless process to get, install and clean up AUR builds (albeit unsecurely). It depends on and uses makepkg, wget and tar directly. I actually do use it!
I am kinda proud of it though (it's my first real program!), and thought I'd share it here. Maybe someone would like to use it, maybe some gurus will offer me some kind advice, or maybe it can help someone who is having trouble in some obscure way. It's under the BSD license, so do whatever you want with it. It's probably too simple to even have a license anyway.
Here is the source code:-
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
int main(int argc, char* argv[])
system("mkdir /tmp/.aget");
chdir("/tmp/.aget");
for (int i = 1; i < argc; i++)
string target(argv[i]);
string docommand("");
string s1("wget -q http://aur.archlinux.org/packages/");
string s2("/");
string s3(".tar.gz");
docommand += s1;
docommand += target;
docommand += s2;
docommand += target;
docommand += s3;
cout << "Downloading AUR tarball for '" << target << "'..." << endl;
system(docommand.c_str());
for (int i = 1; i < argc; i++)
string target(argv[i]);
string docommand("");
string s1("tar xf ");
string s2(".tar.gz");
docommand += s1;
docommand += target;
docommand += s2;
cout << "Extracting '" << target << ".tar.gz'..." << endl;
system(docommand.c_str());
for (int i = 1; i < argc; i++)
string target(argv[i]);
string docommand("");
chdir("/tmp/.aget");
chdir(target.c_str());
system("makepkg -csim --noconfirm > /dev/null");
system("rm -rf /tmp/.aget");
return 0;
Thanks for looking, and sorry for my newbiness/standards-non-compliance(sp?). I guess I'm just kind of happy/excited to share it with someone. C++ is fun!

Cerebral wrote:
I'm curious why you chose to use C++ instead of writing a bash script - most of what this does would be possibly easier to accomplish in a script.   Was it for the learning experience?
I don't see anything necessarily bad about the program itself - good indentation, decent style (although I prefer avoiding 'using namespace', myself), no obvious bugs.  Not a bad first attempt.
Thanks! It was for the learning experience, although I had fun while coding it too.
SoleSoul wrote:Keep going. You are on the right track!
Just remember, for more complicated applications, that C++ is object oriented while C is procedural. I talk about the paradigm. It confused me in the beginning.
Heh, I'll sure try too!
Tesjo wrote:
I agree with both Cerebral and SoleSoul. Here is a simple rewrite (mostly copy and paste) with an object and use of a pointer, for you to chew on.
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
class packagelist{
int npkg;
string *target;
public:
packagelist (int,char**);
void download();
void extract();
void install();
packagelist::packagelist(int n, char* argv[]){
npkg=n-1;
target=new string[npkg];
for (int i=0;i<npkg; i++)
target[i]=argv[i+1];
void packagelist::download(){
for (int i=0;i<npkg; i++){
string docommand("");
string s1("wget -q http://aur.archlinux.org/packages/");
string s2("/");
string s3(".tar.gz");
docommand += s1;
docommand += target[i];
docommand += s2;
docommand += target[i];
docommand += s3;
cout << "Downloading AUR tarball for '" << target[i] << "'..." << endl;
system(docommand.c_str());
void packagelist::install(){
for (int i=0;i<npkg; i++){
string docommand("");
chdir("/tmp/.aget");
chdir(target[i].c_str());
cout << "Installing '" << target[i] <<"'... "<< endl;
system("makepkg -csim --noconfirm > /dev/null");
void packagelist::extract(){
for (int i=0;i<npkg; i++){
string docommand("");
string s1("tar xf ");
string s2(".tar.gz");
docommand += s1;
docommand += target[i];
docommand += s2;
cout << "Extracting '" << target[i] << ".tar.gz'..." << endl;
system(docommand.c_str());
int main(int argc, char* argv[])
system("mkdir /tmp/.aget");
chdir("/tmp/.aget");
packagelist packages(argc,argv);
packages.download();
packages.extract();
packages.install();
system("rm -rf /tmp/.aget");
return 0;
Wow! Thank you. I'm studying it now.
fumbles wrote:One way to extend your programme and learn a bit more is to replace the system commands with system calls: eg system(mkdir) with mkdir(), system(rm) with unlink etc . You could extend it again by adding checks: Open the parent directory and check if the folder already exists and so on.
Hmm, that's a good idea. I'll think I'll try to do that!

Similar Messages

  • Can't compile my first servlet program

    hi guys,
    there are some problems with compiling the first servlet program(helloservlet).
    the error is following
    C:\SERVLET-CODE\hello1>javac HelloServlet.java
    HelloServlet.java:4: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    HelloServlet.java:5: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    HelloServlet.java:15: cannot resolve symbol
    symbol : class HttpServlet
    location: class HelloServlet
    public class HelloServlet extends HttpServlet {
    ^
    HelloServlet.java:16: cannot resolve symbol
    symbol : class HttpServletRequest
    location: class HelloServlet
    public void doGet(HttpServletRequest request,
    ^
    HelloServlet.java:17: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class HelloServlet
    HttpServletResponse response)
    ^
    HelloServlet.java:18: cannot resolve symbol
    symbol : class ServletException
    location: class HelloServlet
    throws ServletException, IOException {
    ^
    6 errors
    i don't know why it can not find the import java.*
    and i already set up the classpath
    and my code is
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** Simple servlet used to test server.
    * <P>
    * Taken from More Servlets and JavaServer Pages
    * from Prentice Hall and Sun Microsystems Press,
    * http://www.moreservlets.com/.
    * &copy; 2002 Marty Hall; may be freely used or adapted.
    public class HelloServlet extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String docType =
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
    "Transitional//EN\">\n";
    out.println(docType +
    "<HTML>\n" +
    "<HEAD><TITLE>Hello</TITLE></HEAD>\n" +
    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<H1>Hello</H1>\n" +
    "</BODY></HTML>");
    please help me out of it...
    thank you all...

    hi man,
    thanks for the classpath, and i already did it in system environment.
    but it can not work either...
    do i really have to download the API, so where i have to put it after i download it...

  • Error coming while executing my first dynpro program....

    Hi ,
    I am new to this dynpro arena. I created my first test program and tried to execute it through SE80 but below error comes up. Can anyone help me in solving this error. If this is related to some configuration to be checked then please let me know the steps which i should follow to rectify it.
    Thanks in Advance
    Error when processing your request
    What has happened?
    The URL http://gcecc62:8000/sap/bc/webdynpro/sap/zak_prg3 was not called due to an error.
    Note
    The following error text was processed in the system ECC : Die URL enthält keine vollständige Domainangabe (gcecc62 statt gcecc62.).
    &#61607;     The error occurred on the application server gcecc62_ECC_00 and in the work process 0 .
    &#61607;     The termination type was: RABAX_STATE
    &#61607;     The ABAP call stack was:
    Method: CHECK of program CX_FQDN=======================CP
    Method: LATE_CONSTRUCTOR of program CL_WDR_UCF====================CP
    Method: HANDLE_REQUEST of program CL_WDR_UCF====================CP
    Method: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_WDR_MAIN_TASK==============CP
    Method: EXECUTE_REQUEST of program CL_HTTP_SERVER================CP
    Function: HTTP_DISPATCH_REQUEST of program SAPLHTTP_RUNTIME
    Module: %_HTTP_START of program SAPMHTTP
    What can I do?
    &#61607;     If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system ECC in transaction ST22.
    &#61607;     If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on the application server gcecc62_ECC_00 in transaction SM21.
    &#61607;     If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work process 0 in transaction ST11 on the application server gcecc62_ECC_00 . In some situations, you may also need to analyze the trace files of other work processes.
    &#61607;     If you do not yet have a user ID, contact your system administrator.
    Error code: ICF-IE-http -c: 800 -u: SAPUSER -l: E -s: ECC -i: gcecc62_ECC_00 -w: 0 -d: 20080412 -t: 162409 -v: RABAX_STATE -e: UNCAUGHT_EXCEPTION
    HTTP 500 - Internal Server Error
    Your SAP Internet Communication Framework Team

    Hello,
    It occurs because you don't have a FQDN configured at you server. To use web dynpros you must have it.
    You can find how to configurate FQDN in the following links:
    [http://help.sap.com/saphelp_nw2004s/helpdata/en/67/be9442572e1231e10000000a1550b0/content.htm], [http://help.sap.com/saphelp_nw2004s/helpdata/en/43/e86de5008b4d9ae10000000a155369/frameset.htm].
    Regards,

  • My first java program!! ALMOST done..I hope

    I've just written my first java program (part of a class I'm taking).. It's feeling kinda awkward since I'm a C++ programmer.. I've written most of the code but I'm still having problems and I thought I should show it to you to get some help..
    import java.lang.*;
    import java.util.*;
    public class Dice
    private static Random generator = new Random();
    int Die1, Die2, rolled, pairNum, pairSum;
    public Dice()
       int[] Dice_arr={Die1, Die2};
       new Random(System.currentTimeMillis());
       return;
      }//end_func_Dice
       public static roll()
         rolled = generator.nextInt(6) + 1;
         return rolled;
        }//end_func_roll
       public String toString()
         StringBuffer bfr = new StringBuffer("\n");
         System.out.println("Rolling Dice...");
          for(pairNum=0; pairNum==10; pairNum++)
            System.out.println("Pair"+pairNum+": "+Die1+","+Die2+" Sum= "+pairSum);
           }//end_for_
        }//end_func_ 
    }//end_class_Dice
    public static void main(String args[])
          for (int dieNum=0; dieNum==2; dieNum++)
            Dice.roll();
            Dice_arr[dieNum]=rolled;
           }//end_for_
         return;
        }//end_func_mainI need main to instatiate the Dice class and then use the toString to print the dice numbers and their sum 10 times..
    I hope this doesn't need much effort,
    Thanks a bunch in advance..

    Right now, my opinion in java is that it's too
    complicated for no reason compared to C++..It's not too complicated, it's just that you are new at this.
    Here's a little example of a simple class with a simple main method, the rest figure it out yourself, and with time read some java books, you won't learn java just by knowing C++.
    public class Human {
        // See this as C constants (although they're not their Equivalent)
        public static boolean MALE = true;
        public static boolean FEMALE = false;
        //member variables.
        private String name;
        private boolean sex;
        /** Creates a new instance of Human */
        public Human(String n, boolean s) {
            name = n;
            sex = s;
        }//End of CONSTRUCTOR.
        public String getName() {
            return name;
        }//End of getName
        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append("[Name: " + name);
            if(sex)
                sb.append(", sex: Male]");
            else
                sb.append(",sex: Female]");
            String returnValue = new String(sb);
            return returnValue;
        }//End of toString()
        //Just the main program, it could be at another class.
        public static void main(String[] args) {
            Human h = new Human("Pablo", Human.MALE);
            String theHumanAsAString = h.toString();
            System.out.println(theHumanAsAString);
        }//End of main method
    }//End of class

  • Trying to compile my first Java program !

    Hi,
    I am a new programmer.Looking to clarify a very simple doubt while compiling my first java program.
    I have set up jdk in the following directory on my PC , E:\j2sdk1.4.1_01\bin.
    Now when I create the first AClass.java file in the AClass directory under bin and try and compile it I get the following error.
    E:\j2sdk1.4.1_01\bin>java E:\j2sdk1.4.1_01\bin\AClass\AClass
    Exception in thread main
    java.lang.NoClassDefFoundError: E:\j2sdk1/4/1_01\bin\AClass\AClass
    Kindly help me how to fix this.

    hi,
    Just do this,
    set path & classpath either in the system environment veriable or in the command prompt as shown below.
    set PATH=%PATH%;E:\j2sdk1.4.1_01\bin
    set CLASSPATH=%CLASSPATH%;.
    Be careful, there is a trailing DOT (.) at the end of the classpath, and that is what needed for
    the JVM to find the class file. with this you would be able to run your program. Infact JDK1.4.x and higher
    doesn't requires classpath to be set, your system classpath variable needs a DOT (.)
    at the end of the classpath variable defined in the environment variable section of your computer or
    in the command prompt you need it to set it once for the current command prompt window before
    executing any java program.
    Regards
    Goodieguy

  • Cannot execute my first JSF Program

    Hey all. I am trying to execute my first JSF program but i get this output on the browser when i try to run my login.jsp file through tomcat version 5.
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /login.jsp(17,0) According to the TLD attribute for is mandatory for tag outputLabel
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:274)
         org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:722)
         org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1458)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2176)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2226)
         org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:759)
         org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1458)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2176)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2226)
         org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:759)
         org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1458)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2176)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2226)
         org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:759)
         org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1458)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2176)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2226)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2232)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:485)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2176)
         org.apache.jasper.compiler.Validator.validate(Validator.java:1515)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:253)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:459)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:142)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)Here is my login.jsp
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
        <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
        <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <f:view>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Login Page</title>
    <f:loadBundle basename="com.tutorial.messages" var="msg"/>
    </head>
    <body>
    <h:form>
    <h:messages layout="table"></h:messages>
    <h:panelGrid columns = "2">
    <h:outputLabel rendered="true" value="#{msg.name}"></h:outputLabel>
    <h:inputText value ="#{loginBean.name}"></h:inputText>
    <h:outputLabel rendered="true" value ="#{msg.password}"></h:outputLabel> }
    <h:inputSecret value="#{loginBean.password.convertedId}">
    <f:converter converterId="javax.faces.Long"></f:converter >
    <f:validator validatorId="com.tutorial.validatePassword"></f:validator >
    <h:commandButton action="login" value="Login"></h:commandButton>
    </h:inputSecret>
    </h:panelGrid>
    <h:commandButton action = "login" value = "#{msg.login}"></h:commandButton>
    </h:form>
    </f:view>
    </body>
    </html>Here is my welcome.jsp
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
        <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Welcome</title>
    <f:loadBundle basename="com.tutorial.messages" var ="msg"/>
    </head>
    <body>
    <f:view>
    <h:form>
    <h:outputLabel value = "#{msg.welcome} #{loginBean.name }"></h:outputLabel>
    </h:form>
    </f:view>
    </body>
    </html>I have a LoginBean class which is simple and i am sure nothing is wrong in that. the stack trace tells me that my outputLabel in jsp is not right? but by searching on goole and the tutorial i dont see anything wrong. here is my faces-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC
        "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
        "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
         <managed-bean>
              <managed-bean-name>
              loginBean</managed-bean-name>
              <managed-bean-class>
              com.tutorial.LoginBean</managed-bean-class>
              <managed-bean-scope>
              session</managed-bean-scope>
         </managed-bean>
         <navigation-rule>
              <display-name>
              login</display-name>
              <from-view-id>
              /login.jsp</from-view-id>
              <navigation-case>
                   <from-outcome>
                   login</from-outcome>
                   <to-view-id>
                   /welcome.jsp</to-view-id>
              </navigation-case>
         </navigation-rule>
         <validator>
              <display-name>
              Validate Password</display-name>
              <validator-id>
              com.tutorial.validatePassword</validator-id>
              <validator-class>
              com.tutorial.validatePassword</validator-class>
         </validator>
    </faces-config>Thank you so much for looking into it.

    its a Small issue
    just use the following
    <code><h:outputText rendered="true"
    value="#{msg.name}"></h:outputText></code>
    instead of <code><h:outputLabel rendered="true"
    value="#{msg.name}"></h:outputLabel> </code>
    and your problem will be fixed.Thanks Master. You are awesome ;). it worked. sorry i was using the tutorial for JSF in jbuilder. dont have intentions to learn right now until i am good in JSP but had to set up everything to run JSF.
    Thank you bro.

  • Error Message when running first java program

    Hi,
    I am reading "Sams Teach Yourself Java 6 in 21 Days" by Rogers Cadenhead. I am having a problem with compiling the sample program in the first part of the book, "HelloUser" which is supposed to print out "Hello (my name - Matt)" when run in the command line.
    I receive this error when trying to run it after having successfully compiled it (I enter java HelloUser while in correct folder):
    Exception in thread "main" java.lang.NoSuchMethodError: main
    I have correctly set the PATH and CLASSPATH settings for my PC (Windows XP). I am guessing that I need to define a "main" or something. I'm brand new to Java but am good with the scripting language PHP. Please tell me what I should do to correct this problem. Thanks in advance

    Here is the code for the program:
    public class HelloUser {
         public static void man(String[] arguments) {
              String username = System.getProperty("user.name");
              System.out.println("Hello " + username);
    }Here is what I enter in the Command Line:
    cd \JavaWork\j21work
    javac HelloUser.java
    java HelloUser
    There are no problems up until I enter the last line (java HelloUser) to run the program. By the way, I using JDK 6 update 1 with Windows XP.

  • My first java program. Design improvements?

    Hello all,
    I'm new to this forum (just joined today) so hi! I've been learning java for the last few months by reading a few books, and finally decided to take a crack at my first program (beyond hello world). This one is windows only. At work with a co worker we found that in windows 2000 the background images could get out of sync, so this program gives the user an alternative way to set the backgrounds.
    What I'm asking is if anyone has any time to kill and enjoys reading source code to take a look at it for me. If you see any issues with how the program was implemented and could be improved please let me know.
    Here's the link to the src: http://will.willandnikki.com/projects/bgchanger/BGChanger_src.zip
    Here's a link to my jar:
    http://will.willandnikki.com/projects/bgchanger/BGChanger.jar
    Thanks,
    Will

    Right now, my opinion in java is that it's too
    complicated for no reason compared to C++..It's not too complicated, it's just that you are new at this.
    Here's a little example of a simple class with a simple main method, the rest figure it out yourself, and with time read some java books, you won't learn java just by knowing C++.
    public class Human {
        // See this as C constants (although they're not their Equivalent)
        public static boolean MALE = true;
        public static boolean FEMALE = false;
        //member variables.
        private String name;
        private boolean sex;
        /** Creates a new instance of Human */
        public Human(String n, boolean s) {
            name = n;
            sex = s;
        }//End of CONSTRUCTOR.
        public String getName() {
            return name;
        }//End of getName
        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append("[Name: " + name);
            if(sex)
                sb.append(", sex: Male]");
            else
                sb.append(",sex: Female]");
            String returnValue = new String(sb);
            return returnValue;
        }//End of toString()
        //Just the main program, it could be at another class.
        public static void main(String[] args) {
            Human h = new Human("Pablo", Human.MALE);
            String theHumanAsAString = h.toString();
            System.out.println(theHumanAsAString);
        }//End of main method
    }//End of class

  • Error while executing first dynpro program

    Hi guys,
    I am new to dynpro area. Below is the setting in my profile maintenance (Tcode RZ10)
    icm/host_name_full        --  gcbipiep
    login/system_client        --   800
    SAPSYSTEMNAME      --    ECC
    SAPGLOBALHOST       --    gcecc62
    SAPSYSTEM               --     00
    INSTANCE_NAME        --    DVEBMGS00
    DIR_CT_RUN               ---   $(DIR_EXE_ROOT)\$(OS_UNICODE)\NTI386
    DIR_EXECUTABLE      ---   $(DIR_INSTANCE)\exe
    PHYS_MEMSIZE         --    512
    rdisp/wp_no_dia           --     6
    rdisp/wp_no_btc           --      3
    icm/server_port_0         --      PROT=HTTP,PORT=500$$
    ms/server_port_0          --     PROT=HTTP,PORT=81$$
    rdisp/wp_no_enq          ---      1
    rdisp/wp_no_vb            --       1
    rdisp/wp_no_vb2          --       1
    rdisp/wp_no_spo          --       1
    DIR_CLIENT_ORAHOME --   $(DIR_EXECUTABLE)
    When I go to my portal login page, I get below web address :
    http://gcbipiep:50000/irj/portal
    I created a program through SE80 and there it saves URL address as :
    http://gcbipiep:50000/sap/bc/webdynpro/sap/zak_prg1
    when I tried executing this program through SE80, I got below error webpage :
    404 - Not Found
    The requested resource does not exist
    Details:   Go to main page of this application!
    Please let me know what configuration I have missed.
    Thanks in advance
    Ajay
    Edited by: ajay jha on Apr 15, 2008 1:39 PM
    Edited by: ajay jha on Apr 15, 2008 1:42 PM

    Hi,
    I have seen that my Portal URL i.e. http://gcbipiep:50000/irj/portal and URL in SE80 is http://gcbipiep:50000/sap/bc/webdynpro/sap/zak_prg. I wish to know is this correct or it should be http://gcbipiep:50000/irj/portal/sap/bc/webdynpro/sap/zak_prg1
    Thanks
    Ajay

  • My first java programming - Need some help please!!!

    I have to create a simple java program which i am not good at i am ok in C but my java is quite bad. The program need to define a class called Student and with a string called StudentNAme, a integer StudentID(key), An array of 8 integers called Marks that holds the students marks for 8 modules. It also says Include appropriate accessors, mutators and constructor(s) as well as a method to update the student�s marks. Anybody please help me in this question. I prefer an simple example of this program so I can learn faster, I dont even know how to declare a class.. So sorry but please help me out and thanks in advance

    I would also suggest you try using an IDE like
    eclipse (free)
    www.eclipse.org
    This will help you get a working program much faster.But please do also tell them that if they have troubles using it, they're supposed to read the IDE manual instead of posting here.

  • The Naming problem in my first ejb program.

    Dear experts,
    I am new to Enterprise applications.
    I am ,now, in my first step in developinf Enterprise Java bean.
    I use Sun System Application Server.
    The following s my very first code:
    Hello.java (Remote interface)
    import java.rmi.*;
    import javax.ejb.*;
    public interface Hello extends EJBObject{
         public void displayMessage() throws RemoteException;
    HelloHome.java (Home interface)
    import java.rmi.*;
    import javax.ejb.*;
    public interface HelloHome extends EJBHome{
         public Hello create() throws RemoteException,CreateException;
    HelloBean.java (Bean Implementation class)
    import java.rmi.*;
    import javax.ejb.*;
    public class HelloBean implements SessionBean{
         public void displayMessage(){
              System.out.println("Success..Success..SLK won atlast");
         public void ejbCreate(){
         public void ejbRemove(){
         public void ejbActivate(){
         public void ejbPassivate(){
         public void setSessionContext(SessionContext ct){
    I did go thro the following steps:
    1.I save all these files inside c:\MyEjb folder.
    2.First I compile the following files with javac complier
         Hello.java,HelloHome.java and HelloBean.java
    3.I open deploytool and created a Application HelloApplication.It gives me HelloApplication.ear file inside c:\MyEjb folder.
    4.I created a bean jar into the HelloApplication.The bean jar created is Hello.jar.
    5.Then I deploy HelloApplication with out checking/selecting the Return Client jar check box.
    6.After the application is deployed, I select, from the tree view,LocalHost 4848.
    I select HelloApplication from the deployed applications list, and click the Click Jar...button.It returns HelloApplicationClient.jar into c:\MyEjb folder.
    Here goes my Client java file:
    HelloClient.java
    import javax.ejb.*;
    import javax.naming.*;
    import java.rmi.*;
    import java.util.*;
    public class HelloClient{
         public static void main(String s[]){
              try{
                   Properties prop = new Properties();
                   prop.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");
                   prop.put(javax.naming.Context.PROVIDER_URL,"file:c:\\");
                   Context ctx = new InitialContext(prop);
                   HelloHome hHome = (HelloHome)ctx.lookup("Hello");
                   Hello hObj = hHome.create();
                   hObj.displayMessage();
              }catch(Exception e){
                   e.printStackTrace();
    This also is in C:\MyEjb folder.
    Now I compile HelloClient.java.
    Then I tried to run HelloClient using java HelloClient
    It just says javax.naming.NameNotFoundException:Hello
    Why is this so? Does Sun App server uses any other naming service than FileSystem (fscontext) like CORBA Naming service COS Naming?If so I can download COS Naming provider and use that in my client code.
    Is this correct way to run my client code? or should I go thro File->New->Application Client...etc and use appclient utility?
    I tried that too and run using the command appclient -client HelloAppClient.jar -mainclass HelloClient
    Again I get the same exception,javax.naming.NameNotFoundException:Hello.
    I checked the JNDI Name for my HelloBean and its correctly set as 'Hello'.
    Why is this error? Should I have any special folder structure to run EJB?
    Help me resolve this.
    Thanx in advance
    unique

    Try rewriting your Hello client like this:
    import javax.ejb.*;
    import javax.naming.*;
    import java.rmi.*;
    import java.util.*;
    public class HelloClient
        public static void main(String s[])
            try
                Context initial = new InitialContext();
                Content myEnv   = (Context)initial.lookup("java:comp/env");
                Object o        = myEnv.lookup("ejb/Hello");
                HelloHome hHome = (HelloHome)PortableRemoteObject.narrow(o, HelloHome.class);
                Hello greeter   = hHome.create();
                greeter.displayMessage();
            catch(Exception e)
                e.printStackTrace();
    }See if that's better.

  • First Java Programming Assignment - Grad student needs Help

    Thank-you to whomever helps me out here (I have been waiting for the Professor to respond for 2 days now, and our asignment is due by midnight 2-nite. Here is my problem. We have a value called nPer. This value is defined as a double (it needs to since, it perfoms lots of calculations). Now the assigment calls for the print line to display the field in its integer format. So I have done the following:
    nPer=Math.ceil(nPer);
    This has caused the value to be represented as 181.0. Not good enough! The value needs to be truncated and represented as 181.
    The professor has provided us with directions that use the following syntax
    (int)181.0
    Putting that exact code in my program causes JBuilder to create an error message. Ergo, its not right. I have serached all over the tutorial looking for the proper method to resolve this, however - no luck. Could some kind sole please help??? Thank-you.

    You can look at either java.math.BigDecimal, if the
    true representation of the value and rounding are a
    concern, or java.text.NumberFormat if it's simply a
    matter of display.
    Your professor must be an old C programmer. Casting a
    double to an int? Oh, my. - MODBut that's what his assignment says, display it as an int. And the cast would work; I'm assuming he just didn't use it right.

  • First Servlet Program: Whats the error now?

    I have changed my web.xml file. Its small now:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>Brat</servlet-name>
    <servlet-class>Brat</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Brat</servlet-name>
    <url-pattern>/Brat</url-pattern>
    </servlet-mapping>
    </web-app>
    My URL is:
    http://localhost:8080/examples/Brat
    & I have copied Brat.class in the webapps,
    webapps/examples, webapps/examples/servlets direcories but still its complaining about its location. I am getting following errors at different imes:
    HTTP Status 503 - Servlet Brat is currently unavailable
    The requested service (Servlet Brat is currently unavailable) is not currently available.
    A Servlet Exception Has Occurred
    Exception Report:
    javax.servlet.ServletException: Wrapper cannot find servlet class Brat or a class it depends on
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:797)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:602)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:225)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2252)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:875)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:952)
         at java.lang.Thread.run(Thread.java:484)
    Root Cause:
    java.lang.ClassNotFoundException: Brat
         at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:1111)
         at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:976)
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:792)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:602)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:225)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2252)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:875)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:952)
         at java.lang.Thread.run(Thread.java:484)
    Can somebody plz help me?
    Zulfi.

    C:\, C:\WINNT are directories unrelated to Tomcat that Tomcat doesn't know about (unless you told it about them in the conf/server.xml file).
    A simple solution without editing your server.xml file is to use Tomcat's ROOT directory.
    This directory is by default <Tomcat install directory>\webapps\ROOT
    (For me it's : C:\Program Files\Tomcat 4.1\webapps\ROOT).
    In this ROOT directory you have the WEB-INF directory wich contains the web.xml file.
    Under this WEB-INF directory create a directory called "classes" and put a copy of you servlet class file in it.
    The complete path of your servlet class file then should be
    <Tomcat install directory>\webapps\ROOT\WEB-INF\classes\Brat.class
    Try this and report if it worked.

  • Compilation error for First Servlet program

    Hi,
    I have go the following program from a book bu is giving me a long list of errors maybe I have no imported the proper package.
    import java.servlet.*;
    import java.io.*;
    public class Brat extends GenericServlet
    public void init (ServletConfig sc)
    throws ServletException
    System.out.println("I don wana wake up");
    public void service (ServletRequest req, ServletResponse res)
    throws ServletException
    try{
    ServletOutputStream sos=res.getOutputStream();
    sos.println("I dont wanna do anyhing");
    sos.close();
    catch(IOException ioe) {ioe.printStackTrace();}
    public void destroy()
    System.out.println("I dont wana go to bed");
    Its giving me symbol not resolve errors for the
    following symbols
    ServletException, ServletConfig, ServletResponse etc.
    How can I get around with these errors?
    Zulfi.

    Sorry, but i handled with Servlets some time ago.
    Servlets are not contained in the standard SDK.
    There has been a servlet development kit, but it seems not to exist any more. (I cant't find it)
    But servlet technology is included in java server pages and other web applications, so you have to download i.g. J2EE SDK and to install it, to find the classes you need.
    (It's included in other packages too, i think.)
    http://java.sun.com/products/jsp/download.html
    If you've installed the used packages, then include only the packages you need. (Doc's should help)
    Make shure that the packages are included in your classpath.
    (Have been the files server.jar and servlet.jar in "former" times.)
    Sorry, but i can't give more advice, 'cause im not up to date with this subject.
    Maybe someone else can help?
    Good luck again.

  • Need help to run  The First EJB program

    hello i m new to the ejb
    i tried to run the very simple exaple i was able to compile the following code and deploy them to the j2ee server but i wavs un able to run the cilent program in the same machine
    here are the codes
    // this is remote intterface class
    public interface remote extends javax.ejb.EJBObject{
    public String show() throws java.rmi.RemoteException;
    //home interface
    import javax.ejb.*;
    import java.rmi.*;
    public interface homeinter extends EJBHome{
    remote create()throws CreateException,RemoteException;
    //bean
    import javax.ejb.SessionBean;
    import javax.ejb.EJBException;
    import java.rmi.RemoteException;
    import javax.ejb.SessionContext;
    public class bean implements SessionBean {
    SessionContext sct;
    public String show() throws RemoteException {
    return " this is from bean";
    public void ejbActivate(){}
    public void ejbPassivate(){}
    public void ejbCreate(){}
    public void ejbRemove(){}
    public void setSessionContext(SessionContext set){
    this.sct=set;
    // client
    import javax.ejb.*;
    import javax.rmi.*;
    import javax.naming.*;
    import java.rmi.*;
    public class client {
    public static void main(String[] args) {
    try{
    InitialContext ic= new InitialContext();
    Object obj= ic.lookup("MySecond");
    homeinter h=(homeinter)PortableRemoteObject.narrow(obj,homeinter.class);
    remote r=h.create();
    System.out.println("the return value is" + r.show());
    }catch(Exception e){
    e.printStackTrace();
    in the DOS prompt i tried to run the programme like
    set CPATH=.;c:\j2ee\lib\j2ee.jar;secondClient.jar
    java -Dorg.omg.CORBA.ORBInitialHost=lacalhost -classpath %CPATH% client
    then i had the following error mesage
    C:\ejb>set CPATH=.;c:\j2ee\lib\j2ee.jar;secondClient.jar
    C:\ejb>java -Dorg.omg.CORBA.ORBInitialHost=Localhost -classpath .;c:\j2ee\lib\
    j2ee.jar;secondClient.jar client
    Exception in thread "main" java.lang.NoSuchMethodError: loadClass0
    at com.sun.corba.ee.internal.util.JDKClassLoader.specialLoadClass(Native
    Method)
    at com.sun.corba.ee.internal.util.JDKClassLoader.loadClass(JDKClassLoade
    r.java:58)
    at com.sun.corba.ee.internal.util.JDKBridge.loadClassM(JDKBridge.java:18
    0)
    at com.sun.corba.ee.internal.util.JDKBridge.loadClass(JDKBridge.java:83)
    at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.loadClass(Util.java:37
    8)
    at javax.rmi.CORBA.Util.loadClass(Unknown Source)
    at javax.rmi.PortableRemoteObject.createDelegateIfSpecified(Unknown Sour
    ce)
    at javax.rmi.PortableRemoteObject.<clinit>(Unknown Source)
    at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.jav
    a:57)
    at com.sun.enterprise.naming.SerialContext.<init>(SerialContext.java:79)
    at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(
    SerialInitContextFactory.java:54)
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.init(Unknown Source)
    at javax.naming.InitialContext.<init>(Unknown Source)
    at client.main(client.java:10)
    pls give me a solution
    thank you

    1. which app server u r using ? R u using RI ?
    2. what is this secondclient.jar ?
    3. Have u added server specific jar containing implementation of IntialConrtextFactory in the classpath of client?
    4. If using RI, then I suppose u will have to set "Support Client Choice" (Possibly) to true, then generate client.jar.
    5. Which IDE u r using (If any) ?
    6. Are u sure that ur jar file (containng EJBs) deployed successfully ?
    7. Almost every server provides GUI console sort of , u can check whether it was deployed successfuly ?
    Pls update
    GiveMeJ
    Sanjeev

Maybe you are looking for

  • Multiple vendor payments with a single u201CYOURSELFu201D cheque

    Hi, How do we handle multiple vendor payments with a single u201CYOURSELFu201D cheque, drawn in favor of the paying banker? OR NEFT transfers in SAP. Thanks, M. Senthil

  • IMac multi display

    Hi, its a simple question but one i would love to know! With the iMac being built into the monitor, it it possible to link another stand-alone system up to the Intel core duo iMac so that the iMac is basically used as a monitor for this other system?

  • Structure changes in the LBWE, where does the field pool come from MCVBUK

    Example:  Customising Cockpit, lbwe > 2lis_11_vascl > Maintain structure In lbwe the field 'pool' for MCVBUK does not have all the fields that I can see if I look at Structure          MCVBUK using se11 such as FKSTK, FKSAK. What does this depend on

  • Where to buy oracle openworld presentations?

    Hi all, I've been searching for the whole oracle website and could not find the url for buying all the presentations for oracle openworld. (or just database presentations) can anybody help? thanks andrew

  • When will the ultrabeat bugs be fixed

    I worked this week-end with logic 8 and it's a pain to built a drum kit in ultrabeat with my own samples because sample preview don't work and when I manage to build my drum kit, the samples are missing when I load my previous projects ! Help !